vlan bztch 10 20 30
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
port-security enable---开启端口安全
port-security mac-address sticky---开启接口Sticky MAC功能
port-security mac-address sticky 5489-9830-0D4B vlan 10--写入安全静态mac
留意:缺省情况下,端口安全保护动作为restrict。
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
port-security enable---开启端口安全
port-security protect-action shutdown---端口安全保护动作为shutdown。
port-security max-mac-num 2---接口下接口学习的安全MAC地址限定数量为2。
port-security aging-time 800----配置地址老化时间为800s(默认老化时间无穷)
留意:装备重启后表项会丢失,需要重新学习。缺省情况下不会被老化,只有在配置安全MAC的老化时间后才可以被老化。
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 30
port-security enable---开启端口安全
port-security protect-action protect---端口安全保护动作为protect。
port-security mac-address sticky---开启接口Sticky MAC功能
留意:接口开启接口Sticky MAC功能,没有手动写入mac地址的话,会讲第一次辨认到的mac地址作为安全静态mac
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
#
interface Vlanif30
ip address 192.168.30.254 255.255.255.0
SW2:
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 20
四、配置验证