第一章 查看确认三台主机默认路由配置条目信息
服务器01主机路由表条目信息:
[root@oldboy ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 0 eth0
服务器02主机路由表条目信息:
[root@oldboy ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 eth1
服务器03主机路由表条目信息:
[root@oldboy ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.0.1.254 0.0.0.0 UG 0 0 0 eth0
第二章 服务器主机配置网路路由条目信息
服务器01上配置网路路由条目:
[root@oldboy ~]# route add -net 10.0.1.0 netmask 255.255.255.0 gw 10.0.0.11
[root@oldboy ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.0.1.0 10.0.0.11 255.255.255.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.0.0.254 0.0.0.0 UG 0 0 0 eth0
说明:利用添加网络路由条目命令,已经在服务器01上正确添加上一条去往10.0.1.0网段路由条目
服务器03上配置网络路由条目:
服务器03上配置网络路由条目:
[root@oldboy ~]# route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.1.11
[root@oldboy ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 10.0.1.11 255.255.255.0 UG 0 0 0 eth0
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.0.1.254 0.0.0.0 UG 0 0 0 eth0
说明:利用添加网络路由条目命令,已经在服务器03上正确添加上一条去往10.0.0.0网段路由条目
第三章 配置开启主机路由转发功能
服务器02主机在拓扑中负责进行路由转发,需要开启相应配置参数
服务器02主机在拓扑中负责进行路由转发,需要开启相应配置参数
[root@oldboy ~]# vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
[root@oldboy ~]# sysctl -p
net.ipv4.ip_forward = 1
...其余显示部分省略...
说明:默认数值为0,将数值改为1,路由转发功能即表示开启
第四章 虚拟主机路由访问验证
服务器01主机上进行验证:
[root@oldboy ~]# traceroute 10.0.1.10
traceroute to 10.0.1.10 (10.0.1.10), 30 hops max, 60 byte packets
1 10.0.0.11 (10.0.0.11) 0.247 ms 2.281 ms 2.245 ms
2 10.0.1.10 (10.0.1.10) 3.077 ms !X 3.055 ms !X 3.018 ms !X
说明:通过traceroute路由路径追踪命令,已确认路由走向符合配置需求,即路由配置正确无误。
!X表示已经完成路由追踪过程。
服务器03主机上进行验证:
[root@oldboy ~]# traceroute 10.0.0.10
traceroute to 10.0.0.10 (10.0.0.10), 30 hops max, 60 byte packets
1 10.0.1.11 (10.0.1.11) 0.295 ms 1.221 ms 1.175 ms
2 10.0.0.10 (10.0.0.10) 1.797 ms !X 1.761 ms !X 1.727 ms !X
说明:通过traceroute路由路径追踪命令,已确认路由走向符合配置需求,即路由配置正确无误。
!X表示已经完成路由追踪过程。
第五章 linux路由部署异常分析
防火墙异常问题:
服务器主机02起到路由转发功能,类似于路由器的角色,因此服务器上防火墙功能需要关闭,否则防火墙相应条目会阻止掉路由转发流量;具体iptables防火墙安全策略配置后续章节会进行讲解,敬请期待!
虚拟网卡异常问题:
服务器主机网卡信息配置中,尽量选择nat模式或者仅主机模式网卡进行配置,不要选择LAN区段网卡配置方式,否则根据虚拟软件网络工作原理,LAN区段网卡配置模式无法进行路由的转发,会影响最终配置效果。