本节书摘来自异步社区《CCIE路由和交换认证考试指南(第5版) (第1卷)》一书中的第1章,第1.4节交换和桥接逻辑,作者 【美】Narbik Kocharians(那比克 科查理安) , 【斯洛伐克】Peter Paluch(彼得 派拉奇),更多章节内容可以访问云栖社区“异步社区”公众号查看
1.4 交换和桥接逻辑
本章至此已经回顾了以太网线缆的详情,以及以太网帧中每个字段的格式和意义。交换机的终极目标是基于帧头中的MAC地址,将这些帧发给适当的目的地。表1-7总结了交换机在转发帧时使用的逻辑,根据目的以太网地址的类型,以及目的地址是否被增加至MAC地址表,交换机使用的逻辑有所不同。
例1-2 查看MAC地址表学习过程的命令
Switch1# show mac-address-table dynamic
Mac Address Table
------------------------------------------
Vla- Mac Address Type Ports
---- ----------- ---- -----
1 000f.2343.87cd DYNAMIC Fa0/13
1 0200.3333.3333 DYNAMIC Fa0/3
1 0200.4444.4444 DYNAMIC Fa0/13
Total Ma Addresses for this criterion: 3
! Above, Switch1's MAC address table lists three dynamically learned addresses,
! including Switch4's FA 0/13 MAC.
! Below, Switch1 pings Switch4's management IP address.
Switch1# ping 10.1.1.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
! Below Switch1 now knows the MAC address associated with Switch4's management IP
! address. Each switch has a range of reserved MAC addresses, with the first MAC
! being used by the switch IP address, and the rest being assigned in sequence to
! the switch interfaces – note 0xcd (last byte of 2 nd address in the table above)
! is for Switch4's FA 0/13 interface, and is 13 (decimal) larger than Switch4's
! base MAC address.
Switch1# show mac-address-table dynamic
Mac Address Table
------------------------------------------
Vlan Mac Address Type Ports
---- ----------- ---- -----
1 000f.2343.87c0 DYNAMIC Fa0/13
1 000f.2343.87cd DYNAMIC Fa0/13
1 0200.3333.3333 DYNAMIC Fa0/3
1 0200.4444.4444 DYNAMIC Fa0/13
Total Mac Addresses for this criterion: 4
! Not shown: PC1 ping 10.1.1.23 (R3) PC1's MAC in its MAC address table
------------------------------------------
Vla- Mac Address Type Ports
---- ----------- ---- -----
1 000f.2343.87c0 DYNAMIC Fa0/13
1 000f.2343.87cd DYNAMIC Fa0/13
1 0010.a49b.6111 DYNAMIC Fa0/13
1 0200.3333.3333 DYNAMIC Fa0/3
1 0200.4444.4444 DYNAMIC Fa0/13
Total Mac Addresses for this criterion: 5
! Above, Switch1 learned the PC's MAC address, associated with FA 0/13,
! because the frames sent by the PC came into Switch1 over its FA 0/13.
! Below, Switch4's MAC address table shows PC1's MAC off its FA 0/6
switch4# show mac-address-table dynamic
Mac Address Table
-------------------------------------------
Vla- Mac Address Type Ports
---- ----------- ------- -----
1 000a.b7dc.b780 DYNAMIC Fa0/13
1 000a.b7dc.b78d DYNAMIC Fa0/13
1 0010.a49b.6111 DYNAMIC Fa0/6
1 0200.3333.3333 DYNAMIC Fa0/13
1 0200.4444.4444 DYNAMIC Fa0/4
Total Mac Addresses for this criterion: 5
! Below, for example, the aging timeout (default 300 seconds) is shown, followed
! by a command just listing the mac address table entry for a single address.
switch4# show mac-address-table aging-time
Vlan Aging Time
---- ----------
1 300
switch4# show mac-address-table address 0200.3333.3333
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- ------- -----
1 0200.3333.3333 DYNAMIC Fa0/13
Total Mac Addresses for this criterion: 1