任务 5:观察二层交换的转发过程
步骤 1:登录到 R1 的命令行界面
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started!
步骤 2:配置 R1 的主机名为“R1”,并配置 Fa0/0 的 IP 为 192.168.0.1/24(如果没有 Fa0/0 则使用 E0/0)
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R1 R1(config)#interface fastEthernet 0/0 R1(config-if)#ip address 192.168.0.1 255.255.255.0 R1(config-if)#no shutdown
步骤 3:登录到 R2 的命令行界面
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started!
步骤 4:配置 R2 的主机名为“R2”,并配置 Fa0/0 的 IP 为 192.168.0.2/24(如果没有 Fa0/0 则使用 E0/0)
Router>enable Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R2 R2(config)#interface fastEthernet 0/0 R2(config-if)#ip address 192.168.0.2 255.255.255.0 R2(config-if)#no shutdown
步骤 5:登录到 R3 的命令行界面
% Please answer 'yes' or 'no'. Would you like to enter the initial configuration dialog? [yes/no]: n Press RETURN to get started!
步骤 6:配置 R3 的主机名为“R3”,并配置 Fa0/0 的 IP 为 192.168.0.3/24(如果没有 Fa0/0 则使用 E0/0)
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)#ip address 192.168.0.3 255.255.255.0 R3(config-if)#no shutdown
步骤 7:使用 ping 命令,确认现在 3 台路由器之间能互通。此时,交换机的配置是默认配置, 连接在这台交换机上的所有网络设备(主机、路由器)都能互相通信
R1#ping 192.168.0.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms
R1#ping 192.168.0.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.3, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
R2#ping 192.168.0.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.0.3, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/4 ms
步骤 8:检查 R1 的 Fa0/0 口的详细信息,找到这个接口的 MAC 地址(每台设备各不相同)
R1#show interfaces fastEthernet 0/0 FastEthernet0/0 is up, line protocol is up Hardware is Gt96k FE, address is 000f.9057.fdd0 (bia 000f.9057.fdd0) Internet address is 192.168.0.1/24 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation ARPA, loopback not set Keepalive set (10 sec) Full-duplex, 100Mb/s, 100BaseTX/FX ARP type: ARPA, ARP Timeout 04:00:00 Last input 00:00:00, output 00:00:03, output hang never Last clearing of "show interface" counters never Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifo Output queue: 0/40 (size/max) 5 minute input rate 7000 bits/sec, 3 packets/sec 5 minute output rate 0 bits/sec, 0 packets/sec 376 packets input, 154470 bytes Received 366 broadcasts, 0 runts, 0 giants, 0 throttles 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored 0 watchdog 0 input packets with dribble condition detected 38 packets output, 4685 bytes, 0 underruns 0 output errors, 0 collisions, 4 interface resets 0 babbles, 0 late collision, 0 deferred 0 lost carrier, 0 no carrier 0 output buffer failures, 0 output buffers swapped out
步骤 9:检查 R2 的 ARP 缓存,会看到 192.168.0.1 的 MAC 地址和步骤 8 中看到的一致
R2#show arp Protocol Address Age (min) Hardware Addr Type Interface Internet 192.168.0.1 1 00D0.D371.7B01 ARPA FastEthernet0/0 Internet 192.168.0.2 - 00D0.D3A7.4C01 ARPA FastEthernet0/0 Internet 192.168.0.3 1 00E0.8FC4.7901 ARPA FastEthernet0/0
步骤 10:检查交换机的 MAC 地址表,也会看到交换机的 Fa0/1 口上有 R1 的 MAC 地址
SW1#show mac address-table Mac Address Table ------------------------------------------- Vlan Mac Address Type Ports ---- ----------- -------- ----- 1 0009.7c8b.8a18 DYNAMIC Fa0/24 1 00d0.d371.7b01 DYNAMIC Fa0/1 1 00d0.d3a7.4c01 DYNAMIC Fa0/2 1 00e0.8fc4.7901 DYNAMIC Fa0/3
步骤 11:完整地写出 R2(192.168.0.2)发数据给 R1(192.168.0.1)的过程
1. R2 要发送数据给 192.168.0.1,先检查自己的_________,来得到对方 R1 的 MAC 地址
2. R2 将 R1 的 MAC 地址封装为数据帧的目标 MAC 地址发出
3. SW1 接收到这个数据后,检查数据帧的目标 MAC 地址
4. SW1 会检查自己的________,来判断这个数据从哪个接口发出
5. SW1 将数据从指定接口发出后就能成功的到达 R1