## 1.pc1
```
[root@centos7 /etc/sysconfig/network-scripts]#vim ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="static"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=192.168.1.234
NETMASK=255.255.255.0
GATEWAY=192.168.1.250
DNS1=8.8.8.8
DNS2=114.114.114.114
```
## 2.route1
```
[root@centos7 /etc/sysconfig/network-scripts]#vim ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=10.0.0.8
NETMASK=255.255.255.0
[root@centos7 /etc/sysconfig/network-scripts]#vim ifcfg-eth1
TYPE="Ethernet"
BOOTPROTO="static"
NAME="eth1"
DEVICE="eth1"
ONBOOT="yes"
IPADDR=192.168.1.250
NETMASK=255.255.255.0
route add -net 192.168.232.0/24 gw 10.0.0.18
vim /etc/sysctl.conf
net.ipv4.ip_forward=1
使配置生效
sysctl -p
```
## 3.route2
```
[root@centos7 /etc/sysconfig/network-scripts]#vim ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=10.0.0.18
NETMASK=255.255.255.0
[root@centos7 /etc/sysconfig/network-scripts]#vim ifcfg-eth1
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth1"
DEVICE="eth1"
ONBOOT="yes"
IPADDR=192.168.232.254
NETMASK=255.255.255.0
route add -net 192.168.1.0/24 gw 10.0.0.8
vim /etc/sysctl.conf
net.ipv4.ip_forward=1
使配置生效
sysctl -p
```
## 4.pc2
```
[root@centos7 /etc/sysconfig/network-scripts]#vim ifcfg-eth0
TYPE="Ethernet"
BOOTPROTO="static"
NAME="eth0"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=192.168.232.123
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
DNS1=8.8.8.8
DNS2=114.114.114.114
```