单臂和静态路由实验 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

说明

PC1 PC2  PC3   PC4 分别在 vlan2 3 4、5 中。使用 C 类网段 192.168.1.0/24

实验内容 RI SW1 R2 SW2 配置单臂路由, R1 R2 R3 配置静态路由,实现相互 ping 通。

 拓扑图

 

 
 

 
 
 
 
 

 
 
 
 
 
 
 
 

 
 
 
 
 
 
 
子网的划分
192.168.1.1----192.168.1.30/27

192.168.1.33----192.168.1.62/27

192.168.1.65----192.168.1.94/27

192.168.1.97----192.168.1.126/27

192.168.1.129----192.168.1.158/27

192.168.1.160----192.168.1.190/27

 开始配置路由交换

Router(config)#ho R1

R1(config)#

R1(config)#in

R1(config)#interface e0/2

R1(config-if)#no shut

R1(config)#interface e0/2.1

R1(config-subif)#en

R1(config-subif)#encapsulation do

R1(config-subif)#encapsulation dot1Q 2

R1(config-subif)#ip add 192.168.1.30 255.255.255.224

R1(config-subif)#interface e0/2.                   

R1(config-subif)#interface e0/2.2                  

R1(config-subif)#encapsulation dot1Q 3             

R1(config-subif)#ip add 192.168.1.62 255.255.255.224

R1(config-subif)#end

R1(config)#interface e0/0

R1(config-if)#ip add

R1(config-if)#ip address 192.168.1.130 255.255.255.224

R1(config-if)#end

 

R1#config t

 

R1(config)#ip route 192.168.1.128 255.255.255.224 192.168.1.131

R1(config)#ip route 192.168.1.64 255.255.255.224 192.168.1.131

R1(config)#ip route 192.168.1.64 255.255.255.224 192.168.1.131

*Mar  1 00:18:32.155: %CDP-4-DUPLEX_MISMATCH: duplex mismatch discovered on Ethernet0/2 (not full duplex), with SW1 FastEthernet0/0 (full duple128 255.255.255.224 192.168.1.131

R1(config)#ip route 192.168.1.96 255.255.255.224 192.168.1.131

R1(config)#end

R1#configure

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#ip route 192.168.1.160 255.255.255.224 192.168.1.131

R1(config)#end

R1#show ip route

Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />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

       i - IS-IS, su - IS-IS summary, 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

 

     192.168.1.0/27 is subnetted, 6 subnets

S       192.168.1.96 [1/0] via 192.168.1.131

S       192.168.1.64 [1/0] via 192.168.1.131

C       192.168.1.32 is directly connected, Ethernet0/2.2

C       192.168.1.0 is directly connected, Ethernet0/2.1

S       192.168.1.160 [1/0] via 192.168.1.131

C       192.168.1.128 is directly connected, Ethernet0/0

 

R2 的配置

 

R2>en

 

R2#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#in

R2(config)#interface e0/0

R2(config-if)#ip add

R2(config-if)#ip address 192.168.1.131 255.255.255.224

R2(config-if)#interface e0/1                         

R2(config-if)#ip address 192.168.1.162 255.255.255.224

R2(config-if)#no shut

R2(config-if)#interface e0/0                         

R2(config-if)#no shut      

R2(config-if)#end

R2#show ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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

 

     192.168.1.0/27 is subnetted, 2 subnets

C       192.168.1.160 is directly connected, Ethernet0/1

C       192.168.1.128 is directly connected, Ethernet0/0

R2#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#ip route 192.168.1.0 255.255.255.224 192.168.1.130

R2(config)#ip route 192.168.1.32 255.255.255.224 192.168.1.130

R2(config)#ip route 192.168.1.64 255.255.255.224 192.168.1.163

R2(config)#ip route 192.168.1.96 255.255.255.224 192.168.1.163

R2(config)#end

*Mar  1 00:20:06.151: %SYS-5-CONFIG_I: Configured from console by consolew

% Type "show ?" for a list of subcommands

R2#show ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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

 

     192.168.1.0/27 is subnetted, 6 subnets

S       192.168.1.96 [1/0] via 192.168.1.163

S       192.168.1.64 [1/0] via 192.168.1.163

S       192.168.1.32 [1/0] via 192.168.1.130

S       192.168.1.0 [1/0] via 192.168.1.130

C       192.168.1.160 is directly connected, Ethernet0/1

C       192.168.1.128 is directly connected, Ethernet0/0

R3 的配置

Router>en

Router#config

Configuring from terminal, memory, or network [terminal]?

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#host R3

R3(config)#

R3(config)#in

R3(config)#interface e0/2

R3(config-if)#no shut

R3(config-if)#interface e0/2.1

R3(config-subif)#encapsulation dot1Q 4

R3(config-subif)#ip add 192.168.1.94 255.255.255.224

R3(config-subif)#interface e0/2.2                  

R3(config-subif)#encapsulation dot1Q 5             

R3(config-subif)#ip add 192.168.1.126 255.255.255.224

R3(config-subif)#exit

R3(config)#in

R3(config-if)#interface e0/1 

R3(config-if)#no shut 

R3(config-if)#ip address 192.168.1.163 255.255.255.224

R3(config-if)#end

R3#config

R3(config)#ip route192.168.1.0 255.255.255.224 192.168.1.162

R3(config)#ip route 192.168.1.32 255.255.255.224 192.168.1.162

R3(config)#ip route 192.168.1.128 255.255.255.224 192.168.1.162

R3#show ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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

 

     192.168.1.64/27 is subnetted, 6 subnets

S       192.168.1.0 [1/0] via 192.168.1.162

S       192.168.132 [1/0] via 192.168.1.162

C       192.168.1.96is directly connected, Ethernet0/2.2

C       192.168.1.64is directly connected, Ethernet0/2.1

S       192.168.1.160 [1/0] via 192.168.1.162

C       192.168.1.163is directly connected, Ethernet0/0