cisco路由的ip静态路由添加(二)

时间:2024-03-02 21:06:43

 

 


路由器Corp 配置
Corp(config)#ip route 192.168.20.0 255.255.255.0 10.1.3.2 150

Corp(config)#ip route 192.168.10.0 255.255.255.0 10.1.2.2 150

Corp(config)#ip route 192.168.30.0 255.255.255.0 10.1.4.2 150

Corp(config)#ip route 192.168.40.0 255.255.255.0 10.1.4.2 150

Corp(config)#ip route 172.16.10.0 255.255.255.0 10.1.5.2 150

Corp(config)#do sh run | begin ip route

ip route 192.168.20.0 255.255.255.0 10.1.3.2 150

ip route 192.168.10.0 255.255.255.0 10.1.2.2 150

ip route 192.168.30.0 255.255.255.0 10.1.4.2 150

ip route 192.168.40.0 255.255.255.0 10.1.4.2 150

ip route 172.16.10.0 255.255.255.0 10.1.5.2 150
路由器R1配置

R1(config)#ip route 10.1.1.0 255.255.255.0 10.1.2.1 150

R1(config)#ip route 10.1.4.0 255.255.255.0 10.1.3.1 150

R1(config)#ip route 10.1.5.0 255.255.255.0 10.1.2.1 150

R1(config)#ip route 192.168.30.0 255.255.255.0 10.1.3.1 150

R1(config)#ip route 192.168.40.0 255.255.255.0 10.1.2.1 150

R1(config)#ip route 172.16.10.0 255.255.255.0 10.1.3.1 150

R1(config)#do sh run | begin ip route

ip route 10.1.1.0 255.255.255.0 10.1.2.1 150

ip route 10.1.4.0 255.255.255.0 10.1.3.1 150

ip route 10.1.5.0 255.255.255.0 10.1.2.1 150

ip route 192.168.30.0 255.255.255.0 10.1.3.1 150

ip route 192.168.40.0 255.255.255.0 10.1.2.1 150

ip route 172.16.10.0 255.255.255.0 10.1.3.1 150 

R1(config)#do sh ip rout

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 not set

 

10.0.0.0/24 is subnetted, 5 subnets

S 10.1.1.0 [150/0] via 10.1.2.1

C 10.1.2.0 is directly connected, Serial0/0/0

C 10.1.3.0 is directly connected, Serial0/0/1

S 10.1.4.0 [150/0] via 10.1.3.1

S 10.1.5.0 [150/0] via 10.1.2.1

172.16.0.0/24 is subnetted, 1 subnets

S 172.16.10.0 [150/0] via 10.1.3.1

C 192.168.10.0/24 is directly connected, FastEthernet0/0

C 192.168.20.0/24 is directly connected, FastEthernet0/1

S 192.168.30.0/24 [150/0] via 10.1.3.1

S 192.168.40.0/24 [150/0] via 10.1.2.1

 

 

 


路由器R2的配置

R2(config)#ip route 10.1.1.0 255.255.255.0 10.1.4.1 150

R2(config)#ip route 10.1.2.0 255.255.255.0 10.1.4.1 150

R2(config)#ip route 10.1.3.0 255.255.255.0 10.1.4.1 150

R2(config)#ip route 10.1.5.0 255.255.255.0 10.1.4.1 150

R2(config)#ip route 192.168.10.0 255.255.255.0 10.1.4.1 150

R2(config)#ip route 192.168.20.0 255.255.255.0 10.1.4.1 150

R2(config)#ip route 172.16.10.0 255.255.255.0 10.1.4.1 150

R2(config)#do sh run | begin ip route

ip route 10.1.1.0 255.255.255.0 10.1.4.1 150

ip route 10.1.2.0 255.255.255.0 10.1.4.1 150

ip route 10.1.3.0 255.255.255.0 10.1.4.1 150

ip route 10.1.5.0 255.255.255.0 10.1.4.1 150

ip route 192.168.10.0 255.255.255.0 10.1.4.1 150

ip route 192.168.20.0 255.255.255.0 10.1.4.1 150

ip route 172.16.10.0 255.255.255.0 10.1.4.1 150

R2(config)#do sh ip rou

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 not set

 

10.0.0.0/24 is subnetted, 5 subnets

S 10.1.1.0 [150/0] via 10.1.4.1

S 10.1.2.0 [150/0] via 10.1.4.1

S 10.1.3.0 [150/0] via 10.1.4.1

C 10.1.4.0 is directly connected, Serial0/0/0

S 10.1.5.0 [150/0] via 10.1.4.1

172.16.0.0/24 is subnetted, 1 subnets

S 172.16.10.0 [150/0] via 10.1.4.1

S 192.168.10.0/24 [150/0] via 10.1.4.1

S 192.168.20.0/24 [150/0] via 10.1.4.1

C 192.168.30.0/24 is directly connected, FastEthernet0/0

C 192.168.40.0/24 is directly connected, FastEthernet0/1

路由器R3的配置

 R3(config)#ip route 10.1.1.0 255.255.255.0 f0/0 150   

R3(config)#ip route 10.1.2.0 255.255.255.0 f0/0 150

R3(config)#ip route 10.1.3.0 255.255.255.0 f0/0 150

R3(config)#ip route 10.1.4.0 255.255.255.0 f0/0 150

R3(config)#ip route 192.168.10.0 255.255.255.0 f0/0 150

R3(config)#ip route 192.168.20.0 255.255.255.0 f0/0 150

R3(config)#ip route 192.168.30.0 255.255.255.0 f0/0 150

R3(config)#ip route 192.168.40.0 255.255.255.0 f0/0 150

R3(config)#do sh run | begin ip rout

ip route 10.1.1.0 255.255.255.0 FastEthernet0/0 150     /  * 注:此处的FastEthernet 0/0端口为R3的端口 而不是Corp路由端口/

ip route 10.1.2.0 255.255.255.0 FastEthernet0/0 150

ip route 10.1.3.0 255.255.255.0 FastEthernet0/0 150

ip route 10.1.4.0 255.255.255.0 FastEthernet0/0 150

ip route 192.168.10.0 255.255.255.0 FastEthernet0/0 150

ip route 192.168.20.0 255.255.255.0 FastEthernet0/0 150

ip route 192.168.30.0 255.255.255.0 FastEthernet0/0 150

ip route 192.168.40.0 255.255.255.0 FastEthernet0/0 150

Gateway of last resort is not set

 

10.0.0.0/24 is subnetted, 5 subnets

S 10.1.1.0 is directly connected, FastEthernet0/0

S 10.1.2.0 is directly connected, FastEthernet0/0

S 10.1.3.0 is directly connected, FastEthernet0/0

S 10.1.4.0 is directly connected, FastEthernet0/0

C 10.1.5.0 is directly connected, FastEthernet0/0

172.16.0.0/24 is subnetted, 1 subnets

C 172.16.10.0 is directly connected, Dot11Radio0/3/0

S 192.168.10.0/24 is directly connected, FastEthernet0/0

S 192.168.20.0/24 is directly connected, FastEthernet0/0

S 192.168.30.0/24 is directly connected, FastEthernet0/0

S 192.168.40.0/24 is directly connected, FastEthernet0/0
默认路由选择  (e.g. 将R3设置为根路由)

R3(config)#no ip route 10.1.1.0 255.255.255.0

R3(config)#no ip route 10.1.2.0 255.255.255.0

R3(config)#no ip route 10.1.3.0 255.255.255.0

R3(config)#no ip route 10.1.4.0 255.255.255.0

R3(config)#no ip route 192.168.10.0 255.255.255.0

R3(config)#no ip route 192.168.20.0 255.255.255.0

R3(config)#no ip route 192.168.30.0 255.255.255.0

R3(config)#no ip route 192.168.40.0 255.255.255.0 


 R3(config)#do sh ip

sh ip

% Incomplete command.

R3(config)#do sh ip rout

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 10.1.5.1 to network 0.0.0.0

 

10.0.0.0/24 is subnetted, 1 subnets

C 10.1.5.0 is directly connected, FastEthernet0/0

172.16.0.0/24 is subnetted, 1 subnets

C 172.16.10.0 is directly connected, Dot11Radio0/3/0

S* 0.0.0.0/0 [1/0] via 10.1.5.1

R3(config)#ip route 0.0.0.0 0.0.0.0 10.1.5.1

R3(config)#ip classless


R3(config)#do sh ip rout 

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.5.0 is directly connected, vlan 1   

     172.16.0.0/24 is subnetted, 1 subnets

C       172.16.10.0 is directly connected, Dot11Radio0/3/0

S*   0.0.0.0/0 [1/0] via 10.1.5.1  
                                 is directly connected, FastEthernet0/0   /*注:默认路由   10.1.5.1为下一跳ip   fastEthernet 0/0为R3出端口/