实验环境
centos7客户端
3台centos6路由
centos8服务端
关闭以上服务器的防火墙和selinux
IP规划:
centos7 :192.168.16.66/24(eth0)
centos6(route1) : 192.168.16.100/24(eth0) 192.168.17.101/24(eth1)
centos6-1(route2): 192.168.17.100/24(eth0) 192.168.18.101/24(eth1)
centos6-2(route3): 192.168.18.100/24(eth0) 192.168.19.101/24(eth1)
centos8 : 192.168.19.88/24(eth0)
实验目的:实现centos7与centos8通信
实验步骤:
1,更改各个网卡的配置,如下:
[10:33:25-root@jack ~]#cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NAME="eth0"
BOOTPROTO="none"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR="192.168.16.100"
PREFIX=24
(根据IP规划添加和更改配置信息#注意设备名称)
重启网络,查看ip a
2,添加路由,实现centos7--->centos8通讯
route1:添加去向默认路由
route add -net default dev eth1
route2: 添加双向路由
route add -net 192.168.16.0/24 gw 192.168.17.101 dev eth0
route add -net 192.168.19.0/24 gw 192.168.18.100 dev eth1
route3: 添加回复默认路由
route add -net default dev eth0
并开启三台路由的转发:echo 1 > /proc/sys/net/ipv4/ip_forward
写入配置:sed -i '/net.ipv4.ip_forward = /s/0/1/g' /etc/sysctl.conf
3,测试连通性
centos7----------->centos8
ping 192.168.19.88
4,查看经过路由
mtr 192.168.19.88