IP services

These services act on the traffic that flows through the lab: a translation appears when a host's ping crosses the NAT router, and a lease when a PC asks for an address.

NAT and PAT

Router
Under interface Gi0/1
ip nat insideThe LAN side.
Under interface Gi0/0
ip nat outsideThe Internet side.
In global configuration
access-list 1 permit 10.0.0.0 0.0.255.255Which inside addresses may be translated.
ip nat inside source list 1 interface Gi0/0 overloadPAT: every inside host shares the outside interface's address.
ip nat pool PUBLIC 203.0.113.10 203.0.113.14 netmask 255.255.255.248A pool of outside addresses (prefix-length 29 works too).
ip nat inside source list 1 pool PUBLIC overloadPAT over the pool (without overload: one address per host).
ip nat inside source static 10.0.10.20 203.0.113.20Static NAT: a server always has this outside address.
ip nat inside source static tcp 10.0.10.21 80 203.0.113.21 8080Port forwarding: outside TCP 8080 reaches the server's port 80.
In privileged EXEC
show ip nat translationsThe translations in use, with inside and outside, local and global addresses.
show ip nat statisticsHits, misses, and the inside and outside interfaces.
clear ip nat translation *Removes the dynamic translations.

DHCP server, relay and client

Router
In global configuration
ip dhcp excluded-address 10.0.10.1 10.0.10.10Addresses the server never leases.
Under ip dhcp pool USERS
network 10.0.10.0 255.255.255.0The pool's subnet.
default-router 10.0.10.1The gateway the clients get.
dns-server 8.8.8.8The DNS server they get.
domain-name ntpath.labTheir domain name.
In privileged EXEC
show ip dhcp bindingEach lease: address, client and expiry.
show ip dhcp poolEach pool's range and how much of it is leased.
Under interface Gi0/2
ip helper-address 10.0.12.2Relays the DHCP broadcasts heard on Gi0/2 to that server as unicast, with this interface's address as giaddr. The server picks the pool that contains giaddr and needs a route back to it.
Under interface Gi0/0
ip address dhcpThe router takes its address from a DHCP server on the link, and a default route to the lease's gateway with distance 254.
In privileged EXEC
show dhcp leaseThe router's own leases: address, server, gateway and timers.

A client gets an address with ip dhcp on a PC, ipconfig /renew on Windows, sudo ipconfig set en0 DHCP on macOS or sudo dhclient on Linux. The server must be on the client's subnet: there is no DHCP relay yet (see Limits).

DHCPv6

The router's RAs tell hosts how to configure. M (managed) asks them to get the address from DHCPv6; O (other) only DNS and the domain, keeping SLAAC. A prefix with no-autoconfig isn't used for SLAAC. A relay forwards to the server, which picks the pool of the interface the request arrives on; the pool's prefix must contain the relay's link address, and the server needs a route back to it.

Router
In global configuration
ipv6 dhcp pool BRANCHA DHCPv6 pool.
Under ipv6 dhcp pool BRANCH
address prefix 2001:db8:1:1::/64Stateful: the addresses it hands out (lifetime VALID PREFERRED optional).
dns-server 2001:db8:2:2::53A DNS server.
domain-name ntpath.labThe domain.
Under interface Gi0/0
ipv6 dhcp server BRANCHServes the pool on the interface (rapid-commit optional).
Under interface Gi0/1
ipv6 dhcp relay destination 2001:db8:12::2Relays the link's requests to a server.
ipv6 nd managed-config-flagM: hosts get their address from DHCPv6.
ipv6 nd other-config-flagO: hosts get DNS and the domain from DHCPv6.
ipv6 nd prefix 2001:db8:1:1::/64 no-autoconfigNo SLAAC for that prefix (ipv6 nd prefix default no-autoconfig for all).
In privileged EXEC
show ipv6 dhcp poolEach pool: prefix, lifetimes, DNS, domain and active clients.
show ipv6 dhcp bindingEach client: link-local address, DUID, interface, IA and address.
show ipv6 dhcp interfaceWhich interfaces serve or relay.
show ipv6 dhcpThe router's own DUID.

Clients: ipconfig /all on Windows shows the address, the DHCPv6 IAID and DUID and the DNS servers; ip -6 addr and resolvectl status on Linux; ifconfig on macOS.

HSRP and VRRP

Router
Under interface Gi0/1
standby version 2HSRP version 2 (version 1 is the default).
standby 10 ip 10.0.10.254The virtual gateway address of group 10.
standby 10 priority 110Higher wins the active role (100 is the default).
standby 10 preemptTakes the active role back when it has the higher priority.
standby 10 track 1 decrement 20Lowers the priority by 20 while track 1 is down, so the other router takes over.
In privileged EXEC
show standby briefEach group: state (Active, Standby), priority, active and standby routers, virtual IP.
show standbyThe same in detail, with the virtual MAC.

VRRP (version 2) does the same job with an open standard: the highest priority is master and every other router is a backup. Unlike HSRP it preempts by default, and a router whose own interface address is the virtual address owns it (priority 255). The virtual MAC is 0000.5e00.01xx, with the group number in hex.

Router
Under interface Gi0/1
vrrp 20 ip 10.0.10.253The virtual gateway address of VRRP group 20.
vrrp 20 priority 110Higher wins the master role (100 is the default, 1 to 254).
no vrrp 20 preemptTurns preemption off (it is on by default).
vrrp 20 track 1 decrement 20Lowers the priority by 20 while track 1 is down.
In privileged EXEC
show vrrp briefEach group: priority, master down time, owner, preempt, state (Master, Backup), master address and virtual address.
show vrrpThe same in detail, with the virtual MAC and the timers.

IP SLA and object tracking

An IP SLA operation probes a path every few seconds. A track object follows its result (or an interface's line protocol), and a static route (ip route … track 1) or an HSRP group follows the track. Lab links can carry latency, jitter and loss, so round trips, jitter and voice scores follow the path. A track's state is up only when the return code is OK; its reachability also accepts Over threshold (the target answered, but late).

Router
Under ip sla 1
icmp-echo 8.8.8.8 source-interface Gi0/0The probe: ping 8.8.8.8 from Gi0/0.
frequency 5Every 5 seconds.
threshold 100A reply slower than 100 ms reports Over threshold (5000 ms by default).
timeout 1000A reply slower than 1000 ms counts as a Timeout.
Under ip sla 10
udp-jitter 10.4.4.4 16384 codec g729aA train of UDP packets (with a codec: 1000 packets every 20 ms) that measures round trip, jitter each way, loss and a voice score (ICPIF, MOS). Needs a responder.
Under ip sla 11
udp-jitter 10.4.4.4 16384 num-packets 20 interval 40Without a codec: your own packet count and interval.
Under ip sla 12
udp-echo 10.4.4.4 5000One UDP echo through a responder.
In global configuration
ip sla responderOn the target: answers udp-jitter and udp-echo (control session on UDP 1967).
ip sla schedule 1 life forever start-time nowStarts it.
track 1 ip sla 1 reachabilityTrack 1 is up while the probe gets answers (state works too).
track 2 interface Gi0/0 line-protocolTrack 2 follows the interface.
ip route 0.0.0.0 0.0.0.0 10.0.12.2 track 1The default route stays while track 1 is up; a floating route (a higher distance) takes over when it goes down.
In privileged EXEC
show ip sla statisticsThe last result of each probe.
show ip sla configurationEach probe's settings.
show trackEach track object, its state and what follows it.
show ip sla summaryOne line per operation: type, destination, RTT, return code.
show ip sla responderWhether the responder runs, and who has probed it.

NTP

Router
In global configuration
ntp master 3This router is a time source, at stratum 3.
ntp server 10.0.12.2Takes its time from another device.
In privileged EXEC
show ntp associationsThe servers and which one is in use.
show ntp statusWhether the clock is synchronised, and its stratum.

Files: flash, SCP and SFTP

Flash holds the IOS image the device runs (and keeps its files through a reload). copy moves the configuration and flash files to and from a server over SCP or SFTP (SSH, TCP 22): it asks for the host, the user and the file name (Enter keeps each value in brackets), then the server's password. No server in the labs runs TFTP, so a TFTP copy times out.

Router
In privileged EXEC
dir flash:The files in flash, their sizes, and the bytes free (show flash: too).
copy running-config scp://admin@10.1.99.20/R1-confgBacks up the configuration to a server (startup-config or flash:FILE as the source work too).
copy sftp://admin@10.1.99.20/c2900-universalk9-mz.SPA.159-3.M10.bin flash:Copies a file into flash. Without room: Not enough space on device.
copy scp://admin@10.1.99.20/R1-confg running-configMerges a configuration file into the running configuration, as IOS does.
verify /md5 flash:c2900-universalk9-mz.SPA.157-3.M8.binThe file's MD5 (give the published hash after the file name to compare: Verified or %Error verifying).
delete flash:old.binRemoves a file, after its two questions.
In global configuration
boot system flash:c2900-universalk9-mz.SPA.159-3.M10.binThe image the next reload runs; save, then reload, and show version shows the new version.
ip scp server enableTakes files pushed with scp. The session needs privilege 15: aaa new-model, aaa authentication login default local, aaa authorization exec default local.

Name resolution

A switch or router resolves a name with its ip host entries first, then asks each ip name-server while ip domain lookup is on (the default). A name without a dot gets the ip domain name. ping, and the host in a copy URL, take names.

Router
In global configuration
ip name-server 10.1.99.53The DNS server to ask (up to six).
ip domain name example.comThe domain added to a name without a dot.
ip host SRV1 10.1.99.20A static name, used before DNS.
no ip domain lookupStops asking DNS (a typo is then not taken for a host name).
In privileged EXEC
show hostsThe name servers, the static names (perm) and the names learned from DNS (temp).
clear host *Forgets the names learned from DNS.