任务 1 :建立逻辑拓扑
步骤 1:登录到 SW1 的界面
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Would you like to terminate autoinstall? [yes]: Press RETURN to get started! Switch> Switch>enable Switch#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 100,200,300,400,500 //该命令模拟器不支持,需手动一个一个创建。 Switch(config-vlan)#exit Switch(config)#interface range fastEthernet 0/1 - 4 Switch(config-if-range)#switchport trunk encapsulation dot1q Switch(config-if-range)#switchport mode trunk Switch(config-if-range)#no shutdown
注:输入“switchport trunk encapsulation dot1q”时如果出现报错,就说明您的交换机只支持 dot1q, 就不需要再明确指定 trunk 的标记格式,不用管它,继续往下做。
步骤 2:登录到 R1 的命名行界面,配置主机为“R1”
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started! Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R1
步骤 3:打开 R1 的 Fa0/0(如果没有 Fa0/0 则使用 E0/0)
R1(config)#interface fastEthernet 0/0 R1(config-if)#no shutdown R1(config-if)#exit
步骤4:创建连接R2的Fa0/0.12子接口,指定dot1q标记为100,IP地址为192.168.12.1/24
R1(config)#interface fastEthernet 0/0.12 R1(config-subif)#encapsulation dot1Q 100 R1(config-subif)#ip address 192.168.12.1 255.255.255.0 R1(config-subif)#exit
步骤 5:登录到 R2 的命令行界面,配置主机名为“R2”
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started! Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R2 R2(config)#
步骤 6:开启 R2 的 Fa0/0(如果没有 Fa0/0,则使用 E0/0)
R2(config)#interface fastEthernet 0/0 R2(config-if)#no shutdown R2(config-if)#exit
步骤 7:在 R2 上创建 3 个子接口,分别是 Fa0/0.12、Fa0/0.23 和 Fa0/0.24,dot1q 标记 分别为 100、200 和 300,IP 地址分别是 192.168.12.2/24、192.168.23.2/24 和 192.168.24.2/24
R2(config)#interface fastEthernet 0/0.12 R2(config-subif)#encapsulation dot1Q 100 R2(config-subif)#ip address 192.168.12.2 255.255.255.0 R2(config-subif)#exit R2(config)#interface fastEthernet 0/0.23 R2(config-subif)#encapsulation dot1Q 200 R2(config-subif)#ip address 192.168.23.2 255.255.255.0 R2(config-subif)#exit R2(config)#interface fastEthernet 0/0.24 R2(config-subif)#encapsulation dot1Q 300 R2(config-subif)#ip address 192.168.24.2 255.255.255.0 R2(config-subif)#exit
步骤 8:登录到 R3 的命令行界面,定义主机名为 R3,打开 Fa0/0 口(如果没有则使用 E0/0), 并创建 Fa0/0.23,dot1q 为 200,IP 地址为 192.168.23.3
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started! Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R3 R3(config)#interface fastEthernet 0/0 R3(config-if)#no shutdown R3(config-if)#exit R3(config)#interface fastEthernet 0/0.23 R3(config-subif)#encapsulation dot1Q 200 R3(config-subif)#ip address 192.168.23.3 255.255.255.0
步骤 9:登录到 R4 的命令行界面,定义主机名为 R4,打开 Fa0/0 口(如果没有则使用 E0/0), 并创建 Fa0/0.24,dot1q 为 300,IP 地址为 192.168.24.4/24
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started! Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R4 R4(config)#interface fastEthernet 0/0 R4(config-if)#no shutdown R4(config-if)#exit R4(config)#interface fastEthernet 0/0.24 R4(config-subif)#encapsulation dot1Q 300 R4(config-subif)#ip address 192.168.24.4 255.255.255.0 R4(config-subif)#exit
步骤 10:使用 show 命令检查每台路由器创建的子接口都是“UP”状态
R1#show protocols Global values: Internet Protocol routing is enabled FastEthernet0/0 is up, line protocol is up FastEthernet0/0.12 is up, line protocol is up Internet address is 192.168.12.1/24 FastEthernet0/1 is administratively down, line protocol is down Vlan1 is administratively down, line protocol is down
R2#show protocols Global values: Internet Protocol routing is enabled FastEthernet0/0 is up, line protocol is up FastEthernet0/0.12 is up, line protocol is up Internet address is 192.168.12.2/24 FastEthernet0/0.23 is up, line protocol is up Internet address is 192.168.23.2/24 FastEthernet0/0.24 is up, line protocol is up Internet address is 192.168.24.2/24 FastEthernet0/1 is administratively down, line protocol is down Vlan1 is administratively down, line protocol is down
R3#show protocols Global values: Internet Protocol routing is enabled FastEthernet0/0 is up, line protocol is up FastEthernet0/0.23 is up, line protocol is up Internet address is 192.168.23.3/24 FastEthernet0/1 is administratively down, line protocol is down Vlan1 is administratively down, line protocol is down
R4#show protocols Global values: Internet Protocol routing is enabled FastEthernet0/0 is up, line protocol is up FastEthernet0/0.24 is up, line protocol is up Internet address is 192.168.24.4/24 FastEthernet0/1 is administratively down, line protocol is down Vlan1 is administratively down, line protocol is down
步骤 11:使用 ping 测试,确保 R2 能和其他 3 台路由器通信
R2#ping 192.168.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/1 ms
R2#ping 192.168.23.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.23.3, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/1 ms
R2#ping 192.168.24.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.24.4, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 m