拓扑:
要点:
①三个路由呈环状(环形路由),那么环形路由之间的对应路由就有两个下一跳(下一跳可以使IP地址,也可以是接口)
②R0和R2两个路由之间用串口进行连接,为了保持同步要设置时钟频率(一般为64000)
③注意每台PC之间的IP地址与网关的正确设置
详细配置:
R0:
R0#show running-config
Building configuration...
Current configuration : 803 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R0
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
ip address 192.168.5.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0/0
ip address 192.168.1.1 255.255.255.0
clock rate 64000
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 192.168.3.0 255.255.255.0 192.168.1.2
ip route 192.168.3.0 255.255.255.0 192.168.2.2
ip route 192.168.4.0 255.255.255.0 192.168.1.2
ip route 192.168.6.0 255.255.255.0 192.168.2.2
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
R1:
R1#show running-config
Building configuration...
Current configuration : 825 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
ip address 192.168.2.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.3.1 255.255.255.0
duplex auto
speed auto
!
interface Ethernet0/0/0
ip address 192.168.6.1 255.255.255.0
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
router rip
!
ip classless
ip route 192.168.1.0 255.255.255.0 192.168.2.1
ip route 192.168.1.0 255.255.255.0 192.168.3.2
ip route 192.168.4.0 255.255.255.0 192.168.3.2
ip route 192.168.5.0 255.255.255.0 192.168.2.1
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
R2:
R2#show running-config
Building configuration...
Current configuration : 785 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
ip address 192.168.3.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 192.168.4.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0/0
ip address 192.168.1.1 255.255.255.0
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 192.168.2.0 255.255.255.0 192.168.3.1
ip route 192.168.2.0 255.255.255.0 Serial0/0/0
ip route 192.168.5.0 255.255.255.0 Serial0/0/0
ip route 192.168.6.0 255.255.255.0 192.168.3.1
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
tips:
如果大家懒得看每台路由器的详细配置,那么大家针对本文直接看详细配置中红色加粗字体即可
实际验证效果(路由表):
R0:
R1:
R2: