经典的静态路由的实验
1 :网络拓扑
实验要求: 使用 4 条静态路由使得全网互通。
具体配置如下:
R0 路由器
r0#show running-config
hostname r0
interface Loopback0
ip address 5.5.5.5 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 1.1.1.1 255.255.255.252
clock rate 9600
!
interface Serial0/0/1
ip address 4.4.4.2 255.255.255.252
clock rate 9600
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 1.1.1.2
line con 0
line vty 0 4
login
r0#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 1.1.1.2 to network 0.0.0.0
1.0.0.0/30 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Serial0/0/0
4.0.0.0/30 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Serial0/0/1
5.0.0.0/24 is subnetted, 1 subnets
C 5.5.5.0 is directly connected, Loopback0
S* 0.0.0.0/0 [1/0] via 1.1.1.2
r0#
R1 路由器
r1#show running-config
hostname r1
interface Loopback0
ip address 6.6.6.6 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 1.1.1.2 255.255.255.252
!
interface Serial0/0/1
ip address 2.2.2.1 255.255.255.252
clock rate 9600
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 2.2.2.2
line con 0
line vty 0 4
login
!
r1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 2.2.2.2 to network 0.0.0.0
1.0.0.0/30 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Serial0/0/0
2.0.0.0/30 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Serial0/0/1
6.0.0.0/24 is subnetted, 1 subnets
C 6.6.6.0 is directly connected, Loopback0
S* 0.0.0.0/0 [1/0] via 2.2.2.2
r1#
R2 路由器
r2#show running-config
hostname r2
interface Loopback0
ip address 7.7.7.7 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 2.2.2.2 255.255.255.252
!
interface Serial0/0/1
ip address 3.3.3.1 255.255.255.252
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 3.3.3.2
line con 0
line vty 0 4
login
!
!
!
end
r2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 3.3.3.2 to network 0.0.0.0
2.0.0.0/30 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Serial0/0/0
3.0.0.0/30 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Serial0/0/1
7.0.0.0/24 is subnetted, 1 subnets
C 7.7.7.0 is directly connected, Loopback0
S* 0.0.0.0/0 [1/0] via 3.3.3.2
r2#
R3 路由器
r3#show running-config
hostname r3
interface Loopback0
ip address 8.8.8.8 255.255.255.0
!
interface FastEthernet0/0
no ip address
duplex auto
speed auto
shutdown
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial0/0/0
ip address 4.4.4.1 255.255.255.252
!
interface Serial0/0/1
ip address 3.3.3.2 255.255.255.252
clock rate 9600
!
interface Vlan1
no ip address
shutdown
!
ip classless
ip route 0.0.0.0 0.0.0.0 4.4.4.2
line con 0
line vty 0 4
login
!
!
!
end
r3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 4.4.4.2 to network 0.0.0.0
3.0.0.0/30 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Serial0/0/1
4.0.0.0/30 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Serial0/0/0
8.0.0.0/24 is subnetted, 1 subnets
C 8.8.8.0 is directly connected, Loopback0
S* 0.0.0.0/0 [1/0] via 4.4.4.2
测试 :用 r0 路由器 ping r3 路由器上的 8.8.8.8
r0#ping 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms
r0#traceroute 8.8.8.8// 追踪数据包的走向
Type escape sequence to abort.
Tracing the route to 8.8.8.8
1 1.1.1.2 31 msec 31 msec 32 msec
2 3.3.3.1 63 msec 47 msec 63 msec
3 3.3.3.2 63 msec 62 msec 62 msec
r0#
实验总结: 默认路由会给我们带来意想不到的好处。
资料下载地址:
欢迎加入郑州阳仔的网络工程师自由交流群--132444800(请注明自己的身份,就说是51cto的博友)