拓扑图:
1、首先在R1上的配置:
R1(config)#int
R1(config)#interface g
R1(config)#interface gigabitEthernet 0/0
R1(config-if)#ip add
R1(config-if)#ip address 192.168.10.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#no shutdown
R1#show int
R1#show interfaces g
R1#show interfaces gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up (connected)
Hardware is CN Gigabit Ethernet, address is 0030.a303.1701 (bia 0030.a303.1701)
//show interfaces gigabitEthernet 0/0可以看到R1的g0/0接口下的MAC地址为0030.a303.1701
Internet address is 192.168.10.1/24
同理,R2上的配置跟R1相似,也可以在R2的g0/0接口下看到MAC地址
R2(config)#interface g
R2(config)#interface gigabitEthernet 0/0
R2(config-if)#ip add
R2(config-if)#ip address 192.168.10.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#no shutdown
R2#sh interfaces gigabitEthernet 0/0
GigabitEthernet0/0 is up, line protocol is up (connected)
Hardware is CN Gigabit Ethernet, address is 0001.4383.a201 (bia 0001.4383.a201)
//show interfaces gigabitEthernet 0/0可以看到R2的g0/0接口下的MAC地址为0001.4383.a201
Internet address is 192.168.10.2/24
2、SW1上的配置:
SW1(config)#int
SW1(config)#interface vlan 1
SW1(config-if)#ip add
SW1(config-if)#ip address 192.168.10.254 255.255.255.0
SW1(config-if)#no sh
SW1(config-if)#no shutdown
SW1#show mac-address-table //查看交换机上的MAC地址表
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0001.4383.a201 DYNAMIC Fa0/2
1 0030.a303.1701 DYNAMIC Fa0/1
转载于:https://blog.51cto.com/growing2015/1917148