Hosts send real traffic through the lab: ARP, DHCP, ping, traceroute, TCP connections to servers and SSH logins to devices. Each one speaks its own system's commands.
PC (VPCS)
PC (VPCS)
ip 10.0.10.11/24 10.0.10.1
A static address and gateway (ip 10.0.10.11 255.255.255.0 10.0.10.1 works too).
ip dhcp
Asks for an address (DORA), as dhcp does.
show ip
The PC's address, mask, gateway and MAC.
ping 10.0.10.1
Five pings (-c 3 for three).
trace 8.8.8.8
The hops to an address.
arp
The ARP table.
set pcname PC1
Renames the PC.
save
Saves its settings.
Windows
An elevated Command Prompt (C:\Windows\system32>).
Windows laptop
ipconfig /all
Every setting of the adapter: address, gateway, DNS, DHCP lease and MAC.
netsh interface ipv4 set address name="Ethernet" static 10.0.10.12 255.255.255.0 10.0.10.1
A static address and gateway.
netsh interface ipv4 set address name="Ethernet" source=dhcp
Back to DHCP.
ipconfig /renew
Asks the DHCP server again (/release gives the lease back).
ping 10.0.10.1
Four pings.
tracert 8.8.8.8
The hops.
arp -a
The ARP table.
route print
The routing table.
curl http://10.0.20.10
Opens a web page through the network's ACLs and NAT.
ssh admin@10.0.99.1
Logs in to a switch or router and gets its command line.
macOS
zsh. Changing settings needs sudo, as on a real Mac.
Back to DHCP (sudo ipconfig set en0 DHCP works too).
ipconfig getifaddr en0
Just the address.
netstat -rn
The routing table.
route -n get default
The default gateway and interface.
ping -c 3 10.0.10.1
Three pings.
traceroute 8.8.8.8
The hops.
arp -a
The ARP table.
nc -zv 10.0.20.10 443
Tests a TCP port.
Linux
bash on Ubuntu. Changing settings needs sudo.
Linux laptop
ip addr
The interfaces and their addresses (ip -4 addr, ip -6 addr).
sudo ip addr add 10.0.10.14/24 dev eth0
Adds an address.
sudo ip route add default via 10.0.10.1
Adds the default route.
ip route
The routing table.
ip neigh
The ARP (and IPv6 neighbour) table.
sudo ip addr flush dev eth0
Removes the addresses.
sudo hping3 -1 -a 10.1.1.50 -c 5 10.1.1.10
Sends ICMP probes (-S -p 80: TCP SYN to a port) with a forged source address (-a). Replies go to the forged address, so none come back. Needs sudo.
sudo dhclient eth0
Asks for an address with DHCP.
hostname -I
Just the addresses.
ping -c 3 10.0.10.1
Three pings (ping6 for IPv6).
traceroute 8.8.8.8
The hops.
curl -k https://10.0.20.10
A web page over HTTPS.
nc -zv 10.0.20.10 22
Tests a TCP port.
curl http://[2001:db8:100::10]/
A web page over IPv6 (the address goes in brackets in a URL).
nc -zv 2001:db8:100::10 22
Tests a TCP port over IPv6 (ssh takes IPv6 addresses too).
The NMS is a Linux host that also has snmpget, snmpwalk, tail -f /var/log/syslog, cat /var/log/snmptrapd.log, tcpdump (live, or -w to a file and -r to read it back) and nfdump for the flows it collects.
Names (DNS)
Each computer asks its DNS server (from the lab or from DHCP). ping, tracert/traceroute, curl, ssh and nc take a name and print it as the system does. Ubuntu asks its local stub resolver, 127.0.0.53, which forwards to the server resolvectl shows.
Linux laptop
nslookup www.example.com
A and AAAA records, through the stub resolver (Non-authoritative answer). A CNAME prints as canonical name =.
nslookup -type=mx example.com 10.1.99.53
One record type (a, aaaa, cname, mx, ns, ptr, soa), asking a server directly.
nslookup 10.1.99.80
The reverse lookup: the PTR record.
dig www.example.com
The full answer: status (NOERROR, NXDOMAIN, SERVFAIL), flags, the answer and authority sections.
dig +short @10.1.99.53 www.example.com AAAA
Just the values, from a chosen server. dig -x ADDRESS asks for the PTR.
resolvectl status
The DNS server and search domain the stub resolver uses.
sudo resolvectl dns eth0 10.1.99.53
Sets the DNS server (sudo resolvectl domain eth0 example.com the search domain).
cat /etc/resolv.conf
Points at the stub resolver, 127.0.0.53.
Windows laptop
nslookup www.example.com
First the server's own name (its PTR: UnKnown without one), then the addresses and Aliases for a CNAME.
nslookup -type=mx example.com
One record type. With no such record it prints the zone's SOA.
netsh interface ipv4 set dnsservers name="Ethernet" static 10.1.99.53 primary
Sets the DNS server (ipconfig /all shows it).
ipconfig /flushdns
Empties the resolver cache.
macOS laptop
nslookup www.example.com
The same as on Linux, asking the DNS server directly.
Sets the DNS server (-getdnsservers Ethernet shows it, empty removes it).
A DNS server is a Linux host running BIND, authoritative for its zones: A, AAAA, CNAME, MX, NS, PTR and SOA records. It does not recurse to the internet. Change its records with nsupdate, one line at a time at its > prompt; send applies them.
DNS server (Linux)
cat /etc/bind/db.example.com
The zone file, as BIND reads it.
sudo nsupdate -l
Starts a dynamic update: update add web.example.com 3600 A 10.1.99.80, update delete web.example.com A 10.1.99.81, show, send, quit. Names are absolute.
Files over SSH (SCP)
A server keeps files in its home folder and logs in its own accounts. A switch or router takes pushed files in flash when it runs ip scp server enable with AAA (privilege 15).
Linux laptop
scp motd.txt admin@10.1.99.1:flash:/motd.txt
Pushes a file (to a server: admin@10.1.99.20:). The host key is asked about once, then the password.
scp admin@10.1.99.20:R1-confg .
Fetches a file.
ls -l
The files with their sizes.
md5sum R1-confg
A file's MD5, to compare with verify /md5 on the device.
Ansible
A Linux control node runs Ansible against switches and routers over SSH (network_cli): nothing runs on the devices. The inventory is an INI file with group variables (ansible_connection, ansible_network_os=cisco.ios.ios, ansible_user, ansible_password, and ansible_become with the enable method); playbooks are YAML with the cisco.ios.ios_command, cisco.ios.ios_config (lines, parents, save_when) and ansible.builtin.debug modules, and register. Edit files with echo … >> FILE and sed -i 's/OLD/NEW/' FILE.
Linux laptop
ansible-inventory -i inventory.ini --graph
The groups and their hosts (--list with the variables).
ansible routers -i inventory.ini -m cisco.ios.ios_command -a "commands='show version'"
An ad hoc command on a group: SUCCESS with the output, or FAILED with Ansible's message.
ansible-playbook -i inventory.ini save.yml
Runs a playbook: each task per host (ok, changed, fatal), then the PLAY RECAP.
Replaces text in a file (/PATTERN/d deletes lines, $a TEXT appends one).
Servers, the AAA server and the NMS
A server answers on TCP 22 (SSH), 80 (HTTP) and 443 (HTTPS), so ACLs and NAT can be tested with curl and nc. A lab can make it a DHCP server too.
The AAA server plays TACACS+ and RADIUS: it answers the logins devices send it, from its own users.
The NMS receives syslog, SNMP traps and NetFlow, and keeps them in its files.
The attacker laptop
A VPCS host with three extra tools, for the Layer 2 security labs. Each one does to the network what the real attack does, so port security, DHCP snooping and DAI can stop it.
Attacker laptop
macof -n 200
Floods the switch with random source MAC addresses (MAC table overflow).
rogue-dhcp start
Answers DHCP requests with itself as the gateway (rogue-dhcp stop ends it).
rogue-dhcp stop
Stops the rogue server.
arpspoof 10.0.10.1
Claims the gateway's address with its own MAC (ARP poisoning).
The IPv6 and storm labs use a Kali Linux laptop instead: a Linux host with the attacker role. It has every Linux command, plus THC-IPv6's fake_router6. Tools that run until stopped go in the background with &, and kill %N stops them.
Attacker laptop (Kali Linux)
sudo fake_router6 eth0 2001:db8:bad::/64 &
Advertises the laptop as an IPv6 router for that prefix, with high preference: clients in the VLAN build an address in it and send their IPv6 traffic to the laptop, unless RA guard drops the advertisements.
sudo hping3 --flood --udp -p 9 10.0.10.255 &
Floods UDP to the subnet's broadcast address at line rate (-1 ICMP, a multicast or unicast address for those storms). Storm control on the switch port sees it.