View mac address table
First create the topology
Configure IP addresses for pc0 and pc1 respectively, and ping each other
Ping IP //ping command must be used
Switch#show mac-address-table //View mac address table
We can view the mac address table in privileged mode, and we can see the mac address of the device on each interface
Switch port mode configuration
Common working modes of switches:
1. access: Mainly used to access terminal devices, such as PCs, servers, print servers, etc. //Single vlan
2. Trunk: It is mainly used to connect other switches to carry multiple vlans on the line. //Multiple VLANs
Configuration command:
interface fastEthernet 0/1 //Enter interface interface fast Ethernet interface
switchport mode access/trunk //configuration mode, access or trunk
Port Mode Security Configuration
switchport port-security //Enable port security
switchport port-security mac-address 000d.bd8c.6ccd //Indicates that the secondary port can only be used by devices with this msc address
switchport port-security maximum 4 //Maximum number of mac addresses allowed
switchport port-security violation mode //The operation after the violation has the following three modes
shutdown // If the rule is violated, the port is closed
protect // When there is a violation, only the violation data traffic will be discarded , and no traffic violation will be notified
restrict // When there is a violation, only the traffic that violates the rule is discarded, and the normal forwarding that does not violate the rule, but it will generate a traffic violation notification
Use the mac address table to bind the interface:
mac-address-table static 000d.bd8c.6ccd vlan 1 int f0/5
mac-address-table static MAC address VLAN NUM int interface
Show run //You can view the configuration of the interface