来自 Debian 的比特 - 来自 Debian 项目的博客

[网络-单臂路由]cisco设备配置

拓扑图

网络设备信息:

 

网络设备配置信息

PC终端配置信息

需求:通过单臂路由的方式PC1与PC2互通

具体配置

交换机1配置:

 1 Switch>en
 2 Switch#configure 
 3 Configuring from terminal, memory, or network [terminal]? 
 4 Enter configuration commands, one per line.  End with CNTL/Z.
 5 Switch(config)#vlan 10
 6 Switch(config-vlan)#exit
 7 Switch(config)#interface  fastEthernet 0/1
 8 Switch(config-if)#switchport mode access 
 9 Switch(config-if)#switchport access vlan 10
10 Switch(config-if)#exit
11 Switch(config)#interface gigabitEthernet 0/1
12 Switch(config-if)#switchport mode trunk 
13 Switch(config-if)#switchport trunk allowed vlan 10
14 Switch(config-if)#exit
15 Switch(config)#exit
16 Switch#
17 %SYS-5-CONFIG_I: Configured from console by console
18 Switch#write
19 Building configuration...
20 [OK]

交换机2配置:

 1 Switch>en
 2 Switch#configure 
 3 Configuring from terminal, memory, or network [terminal]? 
 4 Enter configuration commands, one per line.  End with CNTL/Z.
 5 Switch(config)#vlan 20
 6 Switch(config-vlan)#exit
 7 Switch(config)#interface  fastEthernet 0/2
 8 Switch(config-if)#switchport mode  access 
 9 Switch(config-if)#switchport access vlan 20
10 Switch(config-if)#exit
11 Switch(config)#interface  gigabitEthernet 0/1
12 Switch(config-if)#switchport mode trunk 
13 Switch(config-if)#switchport trunk allowed vlan 20
14 Switch(config-if)#exit
15 Switch(config)#exit
16 Switch#
17 %SYS-5-CONFIG_I: Configured from console by console
18 Switch#write
19 Building configuration...
20 [OK]

路由器配置

 1 Router>en
 2 Router#configure 
 3 Configuring from terminal, memory, or network [terminal]? 
 4 Enter configuration commands, one per line.  End with CNTL/Z.
 5 Router(config)#interface  gigabitEthernet 0/0/1.1
 6 Router(config-subif)#encapsulation dot1Q  10
 7 Router(config-subif)#ip address 192.168.10.254 255.255.255.0
 8 Router(config-subif)#exit
 9 Router(config)#interface  gigabitEthernet 0/0/2.2
10 Router(config-subif)#encapsulation dot1Q 20
11 Router(config-subif)#ip address 192.168.20.254 255.255.255.0
12 Router(config-subif)#exit
13 Router(config)#interface gigabitEthernet 0/0/1
14
Router(config-if)#no shutdown
15 Router(config-if)#exit
16 Router(config)#interface gigabitEthernet 0/0/2
17 Router(config-if)#no shutdown
18 Router(config-if)#exit
15 %SYS-5-CONFIG_I: Configured from console by console
16 Router#write
17 Building configuration...
18 [OK]

测试PC1 ping PC2

 1 C:\>ping 192.168.20.1 
 2 
 3 Pinging 192.168.20.1 with 32 bytes of data:
 4 
 5 Reply from 192.168.20.1: bytes=32 time<1ms TTL=127
 6 Reply from 192.168.20.1: bytes=32 time<1ms TTL=127
 7 Reply from 192.168.20.1: bytes=32 time<1ms TTL=127
 8 Reply from 192.168.20.1: bytes=32 time<1ms TTL=127
 9 
10 Ping statistics for 192.168.20.1:
11     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
12 Approximate round trip times in milli-seconds:
13     Minimum = 0ms, Maximum = 0ms, Average = 0ms
14 
15 C:\>ping 192.168.20.254
16 
17 Pinging 192.168.20.254 with 32 bytes of data:
18 
19 Reply from 192.168.20.254: bytes=32 time<1ms TTL=255
20 Reply from 192.168.20.254: bytes=32 time<1ms TTL=255
21 Reply from 192.168.20.254: bytes=32 time<1ms TTL=255
22 
23 Ping statistics for 192.168.20.254:
24     Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
25 Approximate round trip times in milli-seconds:
26     Minimum = 0ms, Maximum = 0ms, Average = 0ms
27 
28 Control-C
posted @ 2022-02-03 14:36  冰橙阳光  阅读(145)  评论(0编辑  收藏  举报