enable
configure terminal
hostname SW1
ip domain-name example.com
crypto key generate rsa
! При запросе выберите длину ключа не менее 2048 бит
ip ssh version 2
line vty 0 4
transport input ssh
login local
exit
username admin privilege 15 secret SecurePassword123
service password-encryption
end
copy running-config startup-config enable
configure terminal
interface GigabitEthernet1/0/1
description Single port PC
speed auto
duplex auto
no shutdown
end interface range GigabitEthernet1/0/1 - 5
description Range ports Access VLAN 10
no shutdown
end interface GigabitEthernet1/0/10
switchport mode access
switchport port-security
switchport port-security maximum 2
switchport port-security mac-address sticky
switchport port-security violation restrict
end interface GigabitEthernet1/0/5
description PC User Dept Sales
switchport mode access
switchport access vlan 10
switchport port-security
switchport port-security maximum 1
switchport port-security mac-address sticky
switchport port-security violation restrict
switchport port-security aging time 2
switchport port-security aging type absolute
no shutdown
end interface GigabitEthernet1/0/12
description Printer Floor 2
switchport mode access
switchport access vlan 20
switchport port-security
switchport port-security maximum 1
switchport port-security mac-address 0000.1111.2222
switchport port-security violation shutdown
no shutdown
end interface GigabitEthernet1/0/X
shutdown
no shutdown
end errdisable recovery cause psecure-violation
errdisable recovery interval 300 show errdisable recovery Port Security : Enabled
Port Status : Secure-up
Violation Mode : Restrict
Maximum MAC Addresses : 2
Total MAC Addresses : 1
Sticky MAC Addresses : 1
Security Violation Count : 0 show ip arp | include 192.168.1.100 show mac address-table | include <MAC> monitor session 1 source interface GigabitEthernet1/0/5 both
monitor session 1 destination interface GigabitEthernet1/0/24 show monitor session 1 monitor session 1 source interface gi1/0/1 rx
monitor session 1 filter vlan 10,20
monitor session 1 destination interface gi1/0/24 interface GigabitEthernet1/0/3
description PC User VLAN 10
switchport mode access
switchport access vlan 10
spanning-tree portfast
no shutdown
end interface GigabitEthernet1/0/8
description IP-Phone + PC
switchport mode access
switchport access vlan 10
switchport voice vlan 20
switchport port-security
switchport port-security maximum 2
switchport port-security mac-address sticky
switchport port-security violation restrict
no shutdown
end interface GigabitEthernet1/0/1
description Trunk to Core Switch
switchport mode trunk
switchport trunk allowed vlan 10,20,30
switchport trunk native vlan 99
switchport nonegotiate
no shutdown
end vlan 100
name Management
exit
interface vlan 100
ip address 192.168.100.10 255.255.255.0
no shutdown
exit
ip default-gateway 192.168.100.1 interface vlan 100
ip address dhcp
no shutdown
exit show ip interface brief
ping 192.168.100. show mac address-table | include 0000.1111.2222
show mac address-table interface gi1/0/5 show ip arp | include 192.168.1.100 show mac address-table | include <MAC> show etherchannel summary show interfaces port-channel 1 show interfaces trunk switchport trunk native vlan 99 no switchport port-security mac-address sticky <старый MAC> no monitor session 1