Filters act on the traffic that really flows: an ACL counts its matches as hosts ping and browse, and the attacker laptop's tools trip the switch's protections.
Access lists
Standard and extended ACLs, numbered or named, filter on router interfaces in or out, and on vty lines with access-class. Entries are checked in order, with the implicit deny at the end. Wildcard masks, host, any, TCP and UDP ports (eq, gt, lt, range), ICMP types and established work as in IOS.
Router
In global configuration
access-list 10 permit 10.0.99.0 0.0.0.255
A standard ACL: matches the source only.
access-list 110 deny tcp any host 10.0.20.10 eq 23
An extended ACL entry: protocol, source, destination and port.
An explicit deny, so the counters show what it drops.
15 permit udp any any eq 53
An entry at sequence number 15, between two others.
no 15
Removes the entry with that number.
Under interface Gi0/2
ip access-group WEB out
Filters what leaves Gi0/2 (in: what arrives).
Under ip access-list standard MGMT
permit host 10.0.99.10
A named standard ACL.
Under line vty 0 15
access-class MGMT in
Only that host may log in remotely.
In privileged EXEC
show access-lists
Every ACL with its entries and match counts.
show ip interface Gi0/2
Which ACLs are applied to the interface, in and out.
clear access-list counters
Resets the match counts.
Under interface Gi0/0
ip verify unicast source reachable-via rx allow-default
Strict unicast RPF: drops a packet unless the route back to its source leaves through this interface (any: loose, any route will do; allow-default: the default route counts).
In privileged EXEC
show ip interface Gi0/0
Includes the uRPF mode and its verification drops.
IPv6 access lists
IPv6 lists are always named, match prefixes (2001:db8:20::/64, host, any) with the protocols ipv6, tcp, udp and icmp, ports and ICMPv6 types, and are applied with ipv6 traffic-filter. Entries are numbered 10, 20, …; sequence N puts one where you want it. Every list ends with the implicit permit icmp any any nd-na, permit icmp any any nd-ns and deny ipv6 any any, which IOS does not print. log sends %IPV6_ACL-6-ACCESSLOGP messages.
An entry: protocol, source prefix, destination and port.
permit icmp 2001:db8:20::/64 any echo-request
ICMPv6 by type (echo-request, echo-reply, nd-ns, nd-na, router-advertisement…).
sequence 5 deny tcp any host 2001:db8:100::10 eq 22 log
An entry at sequence 5, ahead of the others, logged.
no sequence 5
Removes one entry.
Under interface Gi0/2
ipv6 traffic-filter GUEST-IN in
Filters the IPv6 packets entering the interface (out: leaving it).
In privileged EXEC
show ipv6 access-list
Every IPv6 list with its matches and sequence numbers.
show ipv6 access-list GUEST-IN
One list.
clear ipv6 access-list
Zeroes the match counters.
Port security
Switch (2960)
Under interface Fa0/2
switchport mode access
Port security needs an access (or trunk) port, not a dynamic one.
switchport port-security
Turns it on: one MAC address by default.
switchport port-security maximum 2
Up to 2 addresses.
switchport port-security mac-address sticky
Learns the addresses and writes them into the running configuration.
switchport port-security violation restrict
Drops and counts other addresses (protect drops quietly; shutdown, the default, err-disables the port).
In privileged EXEC
show port-security
Each secured port, its maximum, its count and its violations.
show port-security interface Fa0/2
One port in detail, with the last source address.
show port-security address
The secure addresses learnt.
DHCP snooping and dynamic ARP inspection
With snooping on, DHCP offers are accepted only from trusted ports, and the switch keeps a binding table of who got which address. Dynamic ARP inspection checks ARP replies against that table, so the attacker laptop's arpspoof is dropped and logged.
Switch (2960)
In global configuration
ip dhcp snooping
Turns snooping on.
ip dhcp snooping vlan 10
In VLAN 10.
no ip dhcp snooping information option
Stops adding option 82, which many DHCP servers refuse from a switch that isn't a relay.
Under interface Gi0/1
ip dhcp snooping trust
The port towards the real DHCP server.
Under interface Fa0/2
ip dhcp snooping limit rate 10
Err-disables a port that sends more than 10 DHCP messages a second.
In global configuration
ip arp inspection vlan 10
Checks ARP in VLAN 10.
Under interface Gi0/1
ip arp inspection trust
Trusts ARP on the uplink.
In privileged EXEC
show ip dhcp snooping
Snooping's VLANs and trusted ports.
show ip dhcp snooping binding
The bindings: MAC, address, VLAN and port.
show ip arp inspection statistics
ARP packets forwarded and dropped, per VLAN.
Storm control and RA guard
Storm control measures the broadcast, multicast or unicast traffic a port receives, in percent of its bandwidth. Above the rising level the switch drops that traffic and logs %STORM_CONTROL-3-FILTERED, and forwards it again under the falling level; with action shutdown the port is err-disabled instead. RA guard drops IPv6 router advertisements that enter a port whose policy says a host is there, so a rogue router can't hand out a prefix and become the clients' gateway.
Switch (2960)
Under interface Fa0/3
storm-control broadcast level 5.00 3.00
Filters broadcasts above 5% of the bandwidth, until they fall under 3% (multicast and unicast work the same way).
storm-control action shutdown
Err-disables the port on a storm instead of filtering (trap filters and sends a trap).
In privileged EXEC
show storm-control
Each port's state (Forwarding, Blocking, Link Down), levels and current rate (show storm-control fa0/3 multicast for one port and kind).
In global configuration
ipv6 nd raguard policy HOSTS
Creates an RA guard policy and enters it.
Under ipv6 nd raguard policy HOSTS
device-role host
Router advertisements arriving on its ports are dropped (router lets them in, for the port towards the real router).
Under interface Fa0/1
ipv6 nd raguard attach-policy HOSTS
Attaches the policy to the port.
In privileged EXEC
show ipv6 nd raguard policy HOSTS
The policy's role and the ports it's attached to.
AAA with TACACS+ and RADIUS
Logins go to the lab's AAA server, which answers from its own users. A method list falls back to the next method only when the server can't be reached (an ERROR), not when it rejects the user, as in IOS.
Router
In global configuration
aaa new-model
Turns AAA on. From now on, lines without a method list use the default one.
aaa authentication login default group tacacs+ local
Logins ask TACACS+ first, and the local users if it can't be reached.
aaa authentication login CONSOLE local
A named list.
aaa authorization exec default group tacacs+ local
The server decides the privilege level.
aaa accounting exec default start-stop group tacacs+
Records each session's start and end.
Under line console 0
login authentication CONSOLE
The console uses the named list.
In global configuration
ip tacacs source-interface Loopback0
TACACS+ requests leave from the loopback's address. The server only answers devices it knows by their source address.
ip radius source-interface Loopback0
The same for RADIUS.
In privileged EXEC
show aaa servers
Each server, its state and its counters.
test aaa group tacacs+ admin Cisco123 legacy
Tries a login against the servers.
Control-plane policing (CoPP)
Router
Under ip access-list extended ICMP-IN
permit icmp any any
What the class matches.
Under class-map match-all COPP-ICMP
match access-group name ICMP-IN
A class for that traffic.
Under policy-map COPP > class COPP-ICMP
police 8000 conform-action transmit exceed-action drop
Lets 8 kb/s through and drops the rest.
Under control-plane
service-policy input COPP
Applies it to traffic sent to the router itself.
In privileged EXEC
show policy-map control-plane
Conformed and exceeded packets, per class.
IPsec for GRE and DMVPN
tunnel protection ipsec profile sends a tunnel's GRE packets inside IPsec (IKEv1 with a pre-shared key). Both ends need protection, an ISAKMP policy in common (encryption, hash, authentication and DH group), the same key for each other's address and a transform set in common. show crypto isakmp sa shows where a failure stops: MM_NO_STATE (no policy or key), MM_KEY_EXCH (the keys differ), or QM_IDLE with no IPsec SAs (no transform set in common).
Router
In global configuration
crypto isakmp policy 10
An IKE phase 1 policy; the lowest number is offered first.
Under crypto isakmp policy 10
encryption aes 256
The cipher (des by default; 3des, aes, aes 192, aes 256). encr is the short form.
hash sha256
The hash (sha by default; md5, sha256, sha384, sha512).
authentication pre-share
Pre-shared keys. The default, rsa-sig, needs certificates.
group 14
The Diffie-Hellman group (1 by default).
In global configuration
crypto isakmp key DMVPN-psk address 0.0.0.0
The pre-shared key for any peer (a hub's spokes are not known in advance), or give one address.