switch
switch
conf t
line console 0
password cpi2b
login
exit
username cisco password cpi2b
no ip domain-lookup
hostname S1
ip domain-name cpi2.com
crypto key generate rsa
# When prompted: 1024
line vty 0 4
transport input ssh
login local
exit
service password-encryption
vlan 1
exit
interface vlan 1
ip address 172.31.0.3 255.255.255.0
exit
ip default-gateway 172.31.0.1
vlan 20
vlan 30
exit
interface range f0/1 - 5
switchport mode access
switchport access vlan 10
switchport nonegotiate
switchport port-security
switchport port-security maximum 5
switchport port-security mac-address sticky
switchport port-security aging time 440
switchport port-security violation restrict
exit
#same for vlan 20
vlan 999
name void
exit
interface range f0/16 - 23
switchport mode access
switchport access vlan 999
switchport nonegotiate
exit
interface range f0/1-6, f0/11-24
spanning-tree bpduguard enable
spanning-tree portfast
exit
interface g0/1
switchport mode trunk
switchport trunk allowed vlan 10,20,30
switchport trunk native vlan 1
no shutdown
exit
int f0/7
ip dhcp snooping trust
ip dhcp snooping limit-rate 5
end
copy run start