(i) - interface
Network Next Hop Metric From Time
C(i) 2.2.2.0/24 0.0.0.0 1 self
R(n) 3.3.3.0/24 192.168.101.2 2 192.168.101.2 02:41
R(n) 4.4.4.0/24 192.168.100.2 2 192.168.100.2 02:57
C(i) 192.168.100.0/30 0.0.0.0 1 self
C(i) 192.168.101.0/30 0.0.0.0 1 self
R(n) 192.168.102.0/30 192.168.100.2 2 192.168.100.2 02:57
路由表:
[root@dotnet root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 0.0.0.0 255.255.255.252 U 0 0 0 eth1
192.168.101.0 0.0.0.0 255.255.255.252 U 0 0 0 eth2
192.168.102.0 192.168.100.2 255.255.255.252 UG 2 0 0 eth1
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
2.2.2.0 0.0.0.0 255.255.255.0 U 0 0 0 dummy0
3.3.3.0 192.168.101.2 255.255.255.0 UG 2 0 0 eth2
4.4.4.0 192.168.100.2 255.255.255.0 UG 2 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 lo
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
--------------------------------------------------------------------------------------------------------------
R3:
ripd# show ip rip
Codes: R - RIP, C - connected, O - OSPF, B - BGP
(n) - normal, (s) - static, (d) - default, (r) - redistribute,
(i) - interface
Network Next Hop Metric From Time
R(n) 2.2.2.0/24 192.168.100.1 2 192.168.100.1 02:43
R(n) 3.3.3.0/24 192.168.102.1 2 192.168.102.1 02:45
C(i) 4.4.4.0/24 0.0.0.0 1 self
C(i) 192.168.100.0/30 0.0.0.0 1 self
R(n) 192.168.101.0/30 192.168.100.1 2 192.168.100.1 02:43
C(i) 192.168.102.0/30 0.0.0.0 1 self
路由表:
[root@3GFirewallSettings root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 0.0.0.0 255.255.255.252 U 0 0 0 eth1
192.168.101.0 192.168.100.1 255.255.255.252 UG 2 0 0 eth1
192.168.102.0 0.0.0.0 255.255.255.252 U 0 0 0 eth2
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
2.2.2.0 192.168.100.1 255.255.255.0 UG 2 0 0 eth1
3.3.3.0 192.168.102.1 255.255.255.0 UG 2 0 0 eth2
4.4.4.0 0.0.0.0 255.255.255.0 U 0 0 0 dummy0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.0.1.169 0.0.0.0 UG 0 0 0 eth0
--------------------------------------------------------------------------------------------------------------
注意:
由于R2、R3没有多余的网络卡,所以使用dummy来虚拟网络,使用方法:
Modprobe dummy0
Ifconfig dummy0 x.x.x.x netmask m.m.m.m
验证协议:
在断开R3--->R1之间的线路之前,在R3上执行:
[root@3GFirewallSettings root]# traceroute 3.3.3.3
traceroute to 3.3.3.3 (3.3.3.3), 30 hops max, 38 byte packets
1 3.3.3.3 (3.3.3.3) 0.471 ms 0.291 ms 0.145 ms
说明R3访问3.3.3.0/24网络是直接通过R1到达。现断开线路,则
[root@3GFirewallSettings root]# traceroute 3.3.3.3
traceroute to 3.3.3.3 (3.3.3.3), 30 hops max, 38 byte packets
1 *
无法到达3.3.3.0/24网络。过大概3mins左右(当前网络结构RIP收敛时间大概3mins)
[root@3GFirewallSettings root]# traceroute 3.3.3.3
traceroute to 3.3.3.3 (3.3.3.3), 30 hops max, 38 byte packets
1 192.168.100.1 (192.168.100.1) 0.488 ms 0.148 ms 0.132 ms
2 3.3.3.3 (3.3.3.3) 0.252 ms 0.250 ms 0.202 ms
此时说明R3到达3.3.3.0/24网络是通过R2再通过R1到达3.3.3.0/24网络。
此时R3的运行状态如下:
ripd# show ip rip
Codes: R - RIP, C - connected, O - OSPF, B - BGP
(n) - normal, (s) - static, (d) - default, (r) - redistribute,
(i) - interface
Network Next Hop Metric From Time
R(n) 2.2.2.0/24 192.168.100.1 2 192.168.100.1 02:44
R(n) 3.3.3.0/24 192.168.100.1 3 192.168.100.1 02:44
C(i) 4.4.4.0/24 0.0.0.0 1 self
C(i) 192.168.100.0/30 0.0.0.0 1 self
R(n) 192.168.101.0/30 192.168.100.1 2 192.168.100.1 02:44
C(i) 192.168.102.0/30 0.0.0.0 1 self
路由表:
[root@3GFirewallSettings root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.100.0 0.0.0.0 255.255.255.252 U 0 0 0 eth1
192.168.101.0 192.168.100.1 255.255.255.252 UG 2 0 0 eth1
192.168.102.0 0.0.0.0 255.255.255.252 U 0 0 0 eth2
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
2.2.2.0 192.168.100.1 255.255.255.0 UG 2 0 0 eth1
3.3.3.0 192.168.100.1 255.255.255.0 UG 3 0 0 eth1
4.4.4.0 0.0.0.0 255.255.255.0 U 0 0 0 dummy0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.0.1.169 0.0.0.0 UG 0 0 0 eth0
1) OSPF
R1
配置文件如下:
ospfd# show running-config
Current configuration:
!
hostname ospfd
password zebra
log stdout
!
!
!
interface lo
!
interface eth0
!
interface eth1
!
interface eth2
!
interface eth3
!
interface tap0
!
router ospf