Octet

IP services

0 of 39 nailed

Core15

  1. Walk me through how a client gets an IP address from DHCP.

    Say this first

    Four messages, known as DORA. The client broadcasts a DISCOVER from 0.0.0.0 port 68 to 255.255.255.255 port 67. Each server answers with an OFFER. The client broadcasts a REQUEST that names the server it picked (option 54), and that server confirms with an ACK carrying the lease and options. Server side is UDP 67, client side is UDP 68.

    Go deeper

    The four messages

    MessageSent byIP source to destinationWhat matters in it
    DISCOVERclient0.0.0.0 to 255.255.255.255client MAC in chaddr, transaction ID xid
    OFFERserverserver IP to the offered IP, or broadcastyiaddr (the offered address), option 54 server ID, lease, mask, gateway, DNS
    REQUESTclient0.0.0.0 to 255.255.255.255option 50 (the address it wants), option 54 (the server it chose)
    ACKserverserver IP to the offered IP, or broadcastthe final lease (option 51) and all options

    The REQUEST is a broadcast on purpose. Every server that made an offer sees it, and the ones that were not chosen put their offered address back in the pool.

    Unicast or broadcast replies

    The client has no address yet, so how does the OFFER reach it? The client decides with the broadcast flag, the top bit of the 16-bit flags field:

    • Flag set: the server (or relay) broadcasts the OFFER and ACK.
    • Flag clear: the server sends them as unicast IP to yiaddr, addressed at layer 2 to the client MAC in chaddr.

    Stacks that cannot accept unicast IP before the interface has an address set the flag.

    Under the hood

    DHCP messages are BOOTP packets with option 53 saying which message they are. That is why the ports are named bootps (67) and bootpc (68). Option 53 values: 1 DISCOVER, 2 OFFER, 3 REQUEST, 4 DECLINE, 5 ACK, 6 NAK, 7 RELEASE, 8 INFORM.

    After the ACK, many clients probe the address with ARP (RFC 5227) before using it. If another host answers, the client sends DECLINE and starts again.

    Traps

    • Saying the OFFER is always a broadcast or always a unicast. It depends on the broadcast flag and on whether a relay is in the path.
    • Swapping the ports. Server listens on UDP 67, client on UDP 68.
    How did you do?Book 3.3 Internet (IP)Own page
  2. Which DHCP options do you configure most, and what are options 43, 66 and 150 for?

    Say this first

    The everyday set is option 1 subnet mask, 3 default gateway, 6 DNS servers, 15 domain name and 51 lease time. For devices that boot from the network, 66 is the TFTP server name and 67 the boot file (PXE and many IP phones), 150 is Cisco's list of TFTP server addresses for Cisco IP phones, and 43 is vendor-specific data, which Cisco access points use to learn their wireless controller addresses. Option 82 is added by relays and switches, not set in a pool.

    Go deeper

    The options worth knowing by number

    OptionNameNotes
    1Subnet mask
    3Routerdefault gateway list
    6DNS serverslist of addresses
    15Domain nameDNS suffix for the client
    42NTP servers
    43Vendor-specific informationformat defined by the vendor
    50Requested IP addressclient to server
    51Lease timeseconds on the wire
    53Message typeDISCOVER, OFFER and so on
    54Server identifierwhich server owns the lease
    60Vendor class identifierthe client says what kind of device it is
    61Client identifierIOS bindings show this, for example 01 plus the MAC
    66TFTP server nameone name or address, as a string
    67Boot file namePXE
    82Relay agent informationinserted by relays or snooping switches
    121Classless static routes
    150TFTP server addressesCisco, list of IPs

    Option 43 for Cisco APs

    A Cisco lightweight AP expects a type-length-value: type f1, length 4 bytes per controller, then each controller address in hex. Two controllers at 10.0.50.10 and 10.0.50.11: f1 + 08 + 0a00320a + 0a00320b.

    Cisco IOS
    ip dhcp excluded-address 10.50.0.1 10.50.0.10
    ip dhcp pool AP-MGMT
     network 10.50.0.0 255.255.255.0
     default-router 10.50.0.1
     dns-server 10.0.0.53
     option 43 hex f1080a00320a0a00320b
    !
    ip dhcp excluded-address 10.40.0.1 10.40.0.10
    ip dhcp pool VOICE
     network 10.40.0.0 255.255.255.0
     default-router 10.40.0.1
     dns-server 10.0.0.53
     domain-name corp.example.com
     option 150 ip 10.0.0.15 10.0.0.16
     lease 0 8

    lease 0 8 is 0 days and 8 hours. The IOS default is 1 day. Other vendors' APs and phones use 43 with their own sub-option formats, usually matched by option 60.

    Traps

    • Typing the WLC address for option 43 as plain text. Cisco APs expect the hex TLV.
    • Treating options 66 and 150 as the same thing. 66 is a single standard string, 150 is Cisco's list of IP addresses.
    How did you do?Book 3.3 Internet (IP)Own page
  3. A user's PC shows a 169.254.x.x address. How do you troubleshoot it?

    Say this first

    169.254.0.0/16 is link-local (APIPA, RFC 3927). Windows picked it itself because no DHCP server answered. Either the DISCOVER never reached a server or the reply never came back. I follow the packet: the access port and VLAN, then the relay on the gateway, then the path and return route to the server, then the scope, then the server.

    Go deeper

    In the order the packet travels

    1. Access port: up, in the right VLAN, not err-disabled. show interfaces status, show vlan brief.
    2. Spanning tree: a port without PortFast spends 30 seconds in listening and learning. The client can give up before the port forwards. Access ports get spanning-tree portfast.
    3. DHCP snooping: if the uplink is not trusted, the switch drops the OFFER. Check the trusted ports in show ip dhcp snooping.
    4. Relay: show ip interface Vlan20 | include Helper must show the server.
    5. Path to the server: ping 10.0.12.1 source Vlan20 from the gateway tests the route there and the server's route back to the client subnet in one go.
    6. Scope: exists for that subnet and is not full. show ip dhcp pool on IOS, scope statistics on Windows.
    7. Capture: debug ip dhcp server packet on an IOS server, or udp port 67 or udp port 68 in tcpdump. In Wireshark the display filter is dhcp.

    On Linux there is usually no 169.254 address at all, just no IPv4 address, unless the network manager is set to fall back to link-local.

    Traps

    • Rebooting the PC first. It retries the same failing exchange and tells you nothing about where it breaks.
    • Forgetting PortFast on access ports. It shows up as DHCP failures after every link flap.
    How did you do?Book 3.3 Internet (IP)Own page
  4. Walk me through what happens when a client resolves www.example.com.

    Say this first

    The stub resolver on the client checks its own cache and hosts file, then sends one recursive query (RD bit set) to its configured resolver. If the resolver has nothing cached, it walks the tree itself: a root server refers it to the .com servers, a .com server refers it to example.com's name servers, and an authoritative server for example.com returns the A record. The resolver caches the answer and the referrals for their TTLs and hands the record back to the client.

    Go deeper

    The walk

    Output
    PC1 stub  -- recursive query, RD=1 -->  resolver 10.0.0.53
    resolver  -- www.example.com A? ---->  a root server        referral: com. NS plus glue
    resolver  -- www.example.com A? ---->  a .com TLD server    referral: example.com. NS plus glue
    resolver  -- www.example.com A? ---->  ns1.example.com      answer, AA bit set
    resolver  -- answer, RA=1 ---------->  PC1

    With QNAME minimisation (RFC 9156) the resolver asks the root only about com. and the TLD only about example.com., so the full name is not leaked to servers that do not need it.

    Details interviewers probe

    • Root addresses come from the root hints built into the resolver: 13 names, a to m.root-servers.net, each served by many anycast instances worldwide.
    • Glue: ns1.example.com lives inside the zone it serves. The .com servers include its A and AAAA records in the referral, otherwise the resolver could never reach it.
    • Caching: the next query for mail.example.com skips root and TLD, because the example.com NS set is already cached.
    • Transport: UDP 53, with TCP 53 for answers too big for UDP.
    • Client side: the hosts file is checked first on most systems, the OS has its own cache (the Windows DNS Client service, systemd-resolved on 127.0.0.53), browsers keep another, and search domains get appended to short names.

    Traps

    • Saying the client walks the tree itself. A stub sends one recursive query and the resolver does the iterative work.
    • Saying there are only 13 root servers. There are 13 root server names, run as many anycast instances.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  5. Name the common DNS record types and what each one is for.

    Say this first

    A maps a name to an IPv4 address, AAAA to IPv6. CNAME makes a name an alias of another name. MX names a domain's mail servers with a preference (lower wins). NS lists a zone's authoritative servers. PTR maps an address back to a name. SOA holds the zone's admin data and timers. TXT carries text such as SPF, DKIM, DMARC and domain verification tokens. SRV locates a service with priority, weight, port and target host.

    Go deeper

    In zone file form

    Output
    example.com.      3600 IN SOA   ns1.example.com. hostmaster.example.com. 2026111001 7200 3600 1209600 3600
    example.com.      3600 IN NS    ns1.example.com.
    example.com.      3600 IN NS    ns2.example.net.
    example.com.      3600 IN MX    10 mail1.example.com.
    example.com.      3600 IN MX    20 mail2.example.com.
    example.com.      3600 IN TXT   "v=spf1 mx -all"
    www.example.com.   300 IN A     203.0.113.80
    www.example.com.   300 IN AAAA  2001:db8:80::80
    shop.example.com.  300 IN CNAME www.example.com.
    _sip._tcp.example.com. 3600 IN SRV 10 60 5060 sip1.example.com.

    And in the reverse zone 113.0.203.in-addr.arpa:

    Output
    80.113.0.203.in-addr.arpa. 3600 IN PTR www.example.com.

    SRV fields

    priority weight port target. Lower priority is tried first. Among equal priorities, weight sets the share of traffic. Active Directory clients find domain controllers this way, through names like _ldap._tcp.dc._msdcs.corp.example.com.

    Others worth naming

    • CAA: which certificate authorities may issue certificates for the domain. CAs must check it.
    • DS, DNSKEY, RRSIG, NSEC, NSEC3: DNSSEC.
    • HTTPS and SVCB (RFC 9460): connection hints such as ALPN, so a browser can learn that a site speaks HTTP/3 before it connects.
    • NAPTR: used with SRV in SIP and ENUM.

    Traps

    • Saying the higher MX preference wins. Lower is preferred.
    • Pointing an MX or NS record at a CNAME. RFC 2181 forbids it and some mail servers fail on it.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  6. How does reverse DNS work?

    Say this first

    A PTR record maps an address back to a name. The address is written backwards under a special domain: 192.0.2.25 becomes 25.2.0.192.in-addr.arpa. IPv6 uses ip6.arpa with every hex nibble written in reverse. Whoever holds the address block controls the reverse zone, usually your ISP or your RIR delegation, not whoever owns the forward domain.

    Go deeper

    Why backwards

    DNS names get more specific from right to left. IP addresses get more specific from left to right. Reversing the octets lets reverse zones be delegated along address boundaries: the /24 owner gets 2.0.192.in-addr.arpa.

    IPv6

    2001:db8::25 is expanded to 32 nibbles and reversed:

    Output
    5.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa

    dig -x 2001:db8::25 builds that name for you.

    Blocks smaller than /24

    Reverse delegation follows octet boundaries. For a /28, RFC 2317 classless delegation uses CNAMEs in the ISP's zone that point into a zone you host. Otherwise you ask the ISP to create the PTRs.

    Where it matters

    • Mail: receivers check that a sending IP has a PTR and that the name resolves back to the same IP (forward-confirmed reverse DNS). Missing or mismatched records hurt delivery.
    • Logs and traceroute output become readable.
    • Some servers do reverse lookups on every login (OpenSSH UseDNS), which makes logins slow when reverse DNS times out.

    Traps

    • Thinking PTR records for public addresses live in your own forward zone.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  7. Explain inside local, inside global, outside local and outside global using a real example.

    Say this first

    "Inside" and "outside" say whose address it is: one of my hosts, or a host out there. "Local" and "global" say where you are looking from: from my inside network, or from the outside. PC1 at 192.168.10.10 browsing to 198.51.100.80 through R1's PAT: inside local is 192.168.10.10, inside global is 203.0.113.2 (R1's outside address), and outside local and outside global are both 198.51.100.80, because I do not translate the far end.

    Go deeper

    The example

    R1 has Gi0/0/1 inside (192.168.10.1/24) and Gi0/0/0 outside (203.0.113.2/29), with PAT on the outside interface.

    TermWhose addressSeen fromValue
    Inside localPC1inside192.168.10.10
    Inside globalPC1outside203.0.113.2
    Outside localthe web serverinside198.51.100.80
    Outside globalthe web serveroutside198.51.100.80

    The packet walk

    1. PC1 sends 192.168.10.10:51004 to 198.51.100.80:443: inside local to outside local.
    2. R1 routes it to Gi0/0/0 and rewrites the source: 203.0.113.2:51004 to 198.51.100.80:443, which is inside global to outside global.
    3. The reply comes back to 203.0.113.2:51004. R1 rewrites the destination to 192.168.10.10:51004 and routes it inside.
    Output
    R1# show ip nat translations
    Pro  Inside global         Inside local          Outside local         Outside global
    tcp  203.0.113.2:51004     192.168.10.10:51004   198.51.100.80:443     198.51.100.80:443
    Total number of translations: 1

    The column order is worth memorising: inside global, inside local, outside local, outside global.

    When outside local differs

    Only with outside NAT, usually for overlapping networks. After a merger the partner's server 10.1.1.50 clashes with our own 10.1.1.0/24, so we make it appear to our users as 172.31.1.50:

    Cisco IOS
    ip nat outside source static 10.1.1.50 172.31.1.50 add-route

    Outside global is 10.1.1.50 (its real address), outside local is 172.31.1.50 (what our users use). add-route installs a route to 172.31.1.50 so the router can forward toward it.

    Traps

    • Defining local as private and global as public. It usually works out that way, but the terms mean point of view.
    • Getting the column order of show ip nat translations wrong when reading it aloud.
    How did you do?Book 3.3 Internet (IP)Own page
  8. What are the types of NAT, and when do you use each one?

    Say this first

    Static NAT maps one inside address to one global address permanently, in both directions: for servers that must be reachable from outside. Dynamic NAT maps inside hosts one-to-one onto a pool of global addresses, first come first served, and runs out when the pool is used up. PAT (overload) puts many inside hosts behind one global address by translating source ports as well: that is what nearly every office and home router does. Static PAT, or port forwarding, maps one global address and port to one inside host and port.

    Go deeper

    The base: mark the interfaces

    Cisco IOS
    interface GigabitEthernet0/0/0
     ip address 203.0.113.2 255.255.255.248
     ip nat outside
    interface GigabitEthernet0/0/1
     ip address 192.168.10.1 255.255.255.0
     ip nat inside
    interface GigabitEthernet0/0/2
     ip address 192.168.20.1 255.255.255.0
     ip nat inside
    !
    ip access-list standard NAT-USERS
     permit 192.168.10.0 0.0.0.255

    Static NAT, one to one

    Cisco IOS
    ip nat inside source static 192.168.20.10 203.0.113.5

    Dynamic NAT from a pool

    Cisco IOS
    ip nat pool PUBLIC 203.0.113.3 203.0.113.4 netmask 255.255.255.248
    ip nat inside source list NAT-USERS pool PUBLIC

    PAT on the interface address

    Cisco IOS
    ip nat inside source list NAT-USERS interface GigabitEthernet0/0/0 overload

    Use the PAT line instead of the dynamic pool line, not with it: one rule per access list.

    TypeMappingInbound connectionsTypical use
    Static1 to 1, permanentyesservers, devices that need a fixed public identity
    Dynamic1 to 1 from a poolonly while mappedrare today
    PATmany to 1, by portnouser internet access
    Static PAT1 address and port to 1 host and portyes, that port onlypublishing a service on a shared address

    Policy NAT (ip nat inside source route-map ...) chooses the translation based on destination too, for example a different address toward a partner network.

    Traps

    • Forgetting overload. Without it the interface rule is one-to-one, so only one inside host at a time gets out.
    How did you do?Book 3.3 Internet (IP)Own page
  9. How do you publish an internal web server to the internet when you only have one public IP address?

    Say this first

    Static PAT, also called port forwarding: map the public address and port to the server's private address and port. On IOS, ip nat inside source static tcp 192.168.20.20 443 interface GigabitEthernet0/0/0 443 forwards TCP 443 on R1's outside address to the server, while everyone else keeps sharing that address through PAT. Then permit the traffic to the public address and port, and test from the outside, not from the LAN.

    Go deeper

    Configuration

    Cisco IOS
    interface GigabitEthernet0/0/0
     ip address 203.0.113.2 255.255.255.248
     ip nat outside
    interface GigabitEthernet0/0/2
     ip address 192.168.20.1 255.255.255.0
     ip nat inside
    !
    ip nat inside source static tcp 192.168.20.20 443 interface GigabitEthernet0/0/0 443
    ip nat inside source static tcp 192.168.20.30 22 interface GigabitEthernet0/0/0 2222

    The second line also changes the port: outside users connect to 203.0.113.2 port 2222 and land on SSH port 22 of 192.168.20.30.

    Output
    R1# show ip nat translations
    Pro  Inside global         Inside local          Outside local         Outside global
    tcp  203.0.113.2:443       192.168.20.20:443     ---                   ---
    tcp  203.0.113.2:2222      192.168.20.30:22      ---                   ---
    tcp  203.0.113.2:443       192.168.20.20:443     198.51.100.77:50112   198.51.100.77:50112
    Total number of translations: 3

    The lines with --- are the static entries. The third line is a live session from an internet client at 198.51.100.77.

    Checklist

    • The inbound ACL or firewall permits TCP 443 to 203.0.113.2, the global address.
    • The server's default gateway is R1. If replies leave through another router, they are never untranslated and the client drops them.
    • The ISP does not filter the port.
    • Test from outside. Testing from the LAN hits the hairpin problem.

    On Linux

    Shell
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j DNAT --to-destination 192.168.20.20:443
    iptables -A FORWARD -i eth0 -d 192.168.20.20 -p tcp --dport 443 -j ACCEPT

    Traps

    • Testing from inside the LAN and concluding the forward is broken.
    How did you do?Book 3.3 Internet (IP)Own page
  10. Is NAT a security feature?

    Say this first

    Not really. PAT has a side effect that looks like security: an unsolicited inbound packet matches no translation, so it gets dropped. But NAT does no inspection, a static mapping exposes the host completely, and anything an inside host connects to can talk back over that connection. The security comes from a stateful firewall, which does the "replies only" job on purpose and with a policy. On IPv6, where there is usually no NAT, the firewall is all you have.

    Go deeper

    What NAT is for

    Address conservation: RFC 1918 space inside and PAT at the edge. Hiding the internal addressing is a minor bonus, not a control.

    What it costs

    • It breaks end-to-end addressing, which is why ALGs and NAT traversal exist.
    • It makes attribution harder. To know which inside host made a connection at a given time you need translation logs. Carriers running CGNAT keep them for legal requests.
    • It complicates troubleshooting: the same flow has different addresses on each side of the box.

    The interview answer

    Security comes from a stateful firewall policy: default deny inbound, explicit permits for published services, inspection where needed. NAT runs alongside it.

    Traps

    • Telling an interviewer NAT is your firewall.
    How did you do?Book 3.3 Internet (IP)Book 8.5 Example SystemsOwn page
  11. What is an NTP stratum, and why does accurate time matter on a network?

    Say this first

    Stratum is the distance from a reference clock. Stratum 0 is the reference itself (GPS, an atomic clock), stratum 1 is a server attached to it, and each NTP hop adds one, up to 15. Stratum 16 means unsynchronized. Time matters because so much depends on it: lining up logs from many devices, certificate validity for VPNs, 802.1X and HTTPS, Kerberos (Active Directory rejects more than 5 minutes of skew by default), one-time passwords, and evidence that holds up after an incident.

    Go deeper

    How NTP works

    NTP runs on UDP 123 (NTPv4 is RFC 5905). The client stamps four times per exchange:

    StampTaken when
    T1client sends the request
    T2server receives it
    T3server sends the reply
    T4client receives the reply

    Round-trip delay is (T4 - T1) - (T3 - T2) and the clock offset is ((T2 - T1) + (T3 - T4)) / 2. The formula assumes the path is symmetric, so asymmetric paths show up as offset error. Small errors are slewed (the clock is sped up or slowed down), large ones are stepped. IOS polls between 64 and 1024 seconds by default.

    A sensible design

    • Two to four internal time servers, each fed by several external or GPS sources.
    • Every network device syncs to the internal servers, sourced from a loopback.
    • Devices log in UTC with millisecond timestamps.
    Cisco IOS
    ntp server 10.0.0.123 prefer
    ntp server 10.0.0.124
    ntp source Loopback0
    ntp update-calendar
    service timestamps log datetime msec show-timezone

    ntp update-calendar keeps the hardware clock in step, so the router boots with sane time. ntp master makes a router serve its own clock (stratum 8 by default): fine in a lab or an isolated network, wrong anywhere real sources exist.

    Traps

    • Calling stratum 16 a low-quality sync. It means not synchronized at all.
    • Using ntp master in production when real time sources exist.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  12. What are the differences between SNMP v1, v2c and v3?

    Say this first

    All three share one model: a manager polls agents on UDP 161, and agents send notifications to the manager on UDP 162. v1 and v2c authenticate with a community string sent in clear text. v2c adds GetBulk, 64-bit counters and informs. v3 replaces communities with users and adds real security: authentication with HMAC (MD5 or SHA), encryption (DES or AES) and view-based access control. In production I use v3 with authPriv, and v2c only read-only, locked down with an ACL, on a management network.

    Go deeper

    v1v2cv3
    Securitycommunity, clear textcommunity, clear textusers, authentication, encryption
    Counters32-bit32-bit and 64-bit32-bit and 64-bit
    Bulk retrievalnoGetBulkGetBulk
    Notificationstraptrap, informtrap, inform

    Operations

    Get, GetNext, GetBulk (v2c and later), Set, Response, Trap, Inform, and Report (v3 error and discovery messages).

    Read-write is dangerous

    A write community or user can change the device. On Cisco, a Set against the config copy MIB can make the router send its whole configuration to a TFTP server. Avoid RW; if you need it, use v3 and a tight view.

    A locked-down v2c baseline

    Cisco IOS
    ip access-list standard SNMP-MGRS
     permit 10.0.0.50
    snmp-server community Oct3t-R0-2026 RO SNMP-MGRS

    Where it is going

    Streaming telemetry (model-driven, gNMI) pushes counters every few seconds instead of waiting to be polled. SNMP stays everywhere for inventory, basic counters and alarms.

    Traps

    • Treating community strings as passwords that protect anything. They cross the wire in clear text.
    • Configuring RW communities just in case.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  13. List the syslog severity levels and explain how logging levels work on a Cisco device.

    Say this first

    Eight levels, 0 to 7: 0 emergencies, 1 alerts, 2 critical, 3 errors, 4 warnings, 5 notifications, 6 informational, 7 debugging. A lower number is more severe. Setting a level gives you that level and everything more severe: logging trap warnings sends levels 0 to 4. Cisco messages carry the level in their tag, as in %LINK-3-UPDOWN: facility LINK, severity 3, mnemonic UPDOWN.

    Go deeper

    LevelKeywordTypical messages
    0emergenciessystem unusable
    1alertsact now, for example temperature alarms
    2criticalcritical conditions
    3errors%LINK-3-UPDOWN interface down
    4warningswarnings
    5notifications%LINEPROTO-5-UPDOWN, %SYS-5-CONFIG_I, %OSPF-5-ADJCHG, %BGP-5-ADJCHANGE
    6informationalACL log hits such as %SEC-6-IPACCESSLOGP
    7debuggingdebug output

    A memory aid: Every Awesome Cisco Engineer Will Need Ice cream Daily.

    Where logs go on IOS

    DestinationCommandDefault level
    Consolelogging consoledebugging
    SSH and telnet sessionslogging monitor, plus terminal monitor per sessiondebugging
    Local bufferlogging buffereddebugging
    Syslog serverslogging trapinformational
    Cisco IOS
    service timestamps log datetime msec show-timezone
    service sequence-numbers
    logging buffered 64000 informational
    logging console warnings
    logging source-interface Loopback0
    logging host 10.0.0.60
    logging trap informational

    Syslog uses UDP 514 by default. TCP and TLS (port 6514) are available where the platform supports them. Cisco devices use facility local7 by default.

    Traps

    • Getting the direction wrong. logging trap 4 sends 0 to 4, not 4 to 7.
    • Logging without NTP and timestamps. Logs with wrong times are close to useless in an incident.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  14. Compare TFTP, FTP, SCP and SFTP. Which do you use to move images and configs to network devices?

    Say this first

    TFTP is UDP 69 with no authentication and no encryption, sending one 512-byte block at a time: simple enough for boot ROMs, PXE and IP phones, but slow and insecure. FTP uses TCP 21 for control plus a separate data connection, with credentials in clear text. SCP and SFTP both run over SSH on TCP 22, so they are authenticated and encrypted. SCP only copies files, while SFTP is a full file protocol with listing, resume and rename. For network devices I use SCP or HTTPS and keep TFTP for boot-time cases that have nothing else.

    Go deeper

    ProtocolTransportAuthenticationEncryptionNotes
    TFTPUDP 69, then ephemeral portsnonenonelock-step 512-byte blocks by default
    FTPTCP 21 control; data from port 20 (active) or to a server port (passive)user and password in clearnone (FTPS adds TLS)two connections, painful through NAT
    SCPSSH, TCP 22SSHyescopy only
    SFTPSSH subsystem, TCP 22SSHyesnot FTP over SSH, a separate protocol

    TFTP limits

    The server answers from a new ephemeral port, so stateful firewalls need a TFTP helper. Block numbers are 16 bits, so with 512-byte blocks a file over about 32 MB fails unless both ends support the blocksize option (RFC 2348) or block number rollover.

    SCP on IOS

    Cisco IOS
    ip ssh version 2
    aaa new-model
    aaa authentication login default local
    aaa authorization exec default local
    ip scp server enable

    Pull an image from a server:

    Cisco IOS
    R1# copy scp://admin@10.0.0.5/isr4400-universalk9.17.09.04a.SPA.bin bootflash:
    R1# verify /md5 bootflash:isr4400-universalk9.17.09.04a.SPA.bin

    Compare the hash with the one the vendor publishes before you boot it.

    OpenSSH 9.0 and later run the SFTP protocol under the scp command by default. To push a file to a device that only has an SCP server, use scp -O for the legacy protocol.

    Traps

    • Saying SFTP is FTP over SSL. That is FTPS. SFTP is part of SSH.
    • Assuming TFTP can move a file of any size.
    How did you do?Book 9.1 Traditional ApplicationsOwn page
  15. What is the difference between CDP and LLDP?

    Say this first

    Both are layer 2 discovery protocols: each device announces its name, port, platform and management address to directly connected neighbours. CDP is Cisco proprietary, on by default on Cisco gear, sent every 60 seconds with a 180 second holdtime. LLDP is the IEEE 802.1AB standard every vendor speaks, sent every 30 seconds with a 120 second hold time, and often off by default on Cisco (lldp run turns it on). LLDP-MED extends it for phones: voice VLAN, PoE power and location.

    Go deeper

    CDPLLDP
    StandardCiscoIEEE 802.1AB
    Destination MAC01:00:0C:CC:CC:CC01:80:C2:00:00:0E
    Timers60 s, holdtime 180 s30 s, hold multiplier 4, so a TTL of 120 s
    On by default on Cisco IOSyesusually no
    Extrasv2 reports native VLAN and duplex mismatchesLLDP-MED: network policy (voice VLAN, DSCP), PoE, inventory, location

    LLDP frames use EtherType 0x88CC. The mandatory TLVs are Chassis ID, Port ID, TTL and End of LLDPDU.

    Security

    Both give away platform, software version and addresses, which is useful reconnaissance for an attacker. Keep them on infrastructure links and turn them off on internet-facing and untrusted ports:

    Cisco IOS
    lldp run
    interface GigabitEthernet0/0/0
     no cdp enable
     no lldp transmit
     no lldp receive

    A subtle one

    A switch that does not understand CDP floods it like any other multicast. Two Cisco devices behind an unmanaged switch then list each other as direct neighbours. Standard bridges never forward LLDP sent to the nearest-bridge address.

    Verify with show cdp neighbors detail and show lldp neighbors detail; on Linux, lldpctl from lldpd.

    Traps

    • Leaving CDP enabled on the internet-facing interface.
    How did you do?Book 3.2 Switched EthernetOwn page

Working17

  1. How does DHCP relay work, and what does the giaddr field do?

    Say this first

    A DISCOVER is a broadcast, so it stops at the router. With ip helper-address on the interface that faces the clients, the router picks it up, writes that interface's address into giaddr, and unicasts it to the server. The server uses giaddr to choose the scope for that subnet and sends its reply to giaddr. The relay then delivers it to the client on port 68.

    Go deeper

    Step by step

    1. PC1 in VLAN 20 broadcasts a DISCOVER. The gateway SVI is 10.20.0.1/24 with ip helper-address 10.0.12.1.
    2. The relay sets giaddr to 10.20.0.1, the primary address of the interface the request came in on. It adds 1 to the hops field and unicasts the packet to 10.0.12.1 on UDP 67.
    3. The server finds the pool whose network contains giaddr. No matching pool means no offer.
    4. The server unicasts the OFFER to giaddr on UDP 67. A relay listens on 67.
    5. The relay forwards the OFFER to the client on UDP 68, as broadcast or unicast per the broadcast flag.
    6. REQUEST and ACK take the same path.

    Configuration

    Cisco IOS
    interface Vlan20
     ip address 10.20.0.1 255.255.255.0
     ip helper-address 10.0.12.1
     ip helper-address 10.0.12.2

    With two helpers the relay sends a copy to each server. That is how you feed a failover pair.

    NX-OS
    feature dhcp
    interface Vlan20
      ip dhcp relay address 10.0.12.1

    What breaks it

    • The server has no route back to the client subnet. It must reach giaddr.
    • The helper is on the wrong interface. It belongs on the client-facing interface.
    • No scope on the server for the giaddr subnet, or the scope is full.
    • A firewall between relay and server blocks UDP 67.
    • Renewals at T1 are unicast from the client straight to the server address in option 54, not through the relay. The client subnet needs a routed, permitted path to the server as well.

    Traps

    • Putting the helper address on the uplink toward the server instead of on the client-facing interface.
    • Forgetting the return route. The DISCOVER arrives, the server offers, and the OFFER is routed into nothing.
    How did you do?Book 3.3 Internet (IP)Own page
  2. Does ip helper-address forward only DHCP?

    Say this first

    No. By default Cisco IOS forwards eight UDP broadcast services to every helper address: Time (37), TACACS (49), DNS (53), BOOTP/DHCP server (67) and client (68), TFTP (69), NetBIOS name service (137) and NetBIOS datagram service (138). I trim the list with no ip forward-protocol udp <port> and add ports with ip forward-protocol udp <port>.

    Go deeper

    Why it matters

    Every Windows host broadcasting NetBIOS on that VLAN gets relayed to the DHCP servers. It is noise at best. On a clean build I remove what I do not need.

    Cisco IOS
    no ip forward-protocol udp 37
    no ip forward-protocol udp 49
    no ip forward-protocol udp 137
    no ip forward-protocol udp 138

    Adding a port

    Wake-on-LAN magic packets are often sent to UDP 9. To relay them, add the port and point a helper at the directed broadcast of the target subnet:

    Cisco IOS
    ip forward-protocol udp 9
    !
    interface Vlan20
     ip helper-address 10.30.0.255
    !
    interface Vlan30
     ip address 10.30.0.1 255.255.255.0
     ip directed-broadcast 110

    ip directed-broadcast 110 lets the router turn the packet into a layer 2 broadcast on VLAN 30, only for traffic that access list 110 permits (for example the WoL server). Directed broadcasts are off by default since IOS 12.0.

    Traps

    • Saying the helper is DHCP-only. Interviewers like the list of eight.
    • Enabling ip directed-broadcast without an access list on the target interface.
    How did you do?Book 3.3 Internet (IP)Own page
  3. What happens as a DHCP lease runs out? Explain T1, T2 and DHCPNAK.

    Say this first

    At T1, half the lease by default, the client unicasts a REQUEST to the server that gave it the lease. If that fails, at T2 (87.5 percent of the lease) it broadcasts a REQUEST to any server: that is rebinding. If the lease expires with no answer, the client must stop using the address and start again with DISCOVER. A server sends DHCPNAK when the client asks for an address that is wrong for its subnet, for example a laptop that moved to another VLAN.

    Go deeper

    Client states

    StateWhenWhat it sends
    BOUNDafter the ACKnothing
    RENEWINGat T1 (option 58)unicast REQUEST to the option 54 server, ciaddr filled in
    REBINDINGat T2 (option 59)broadcast REQUEST to any server
    INITlease expired or NAKDISCOVER, from scratch
    INIT-REBOOTafter a reboot with a remembered addressbroadcast REQUEST with option 50

    NAK and silence

    After a reboot the client asks for its old address. A server that knows the subnet is wrong answers with a NAK, and the client restarts at DISCOVER. A server with no record of the client should stay silent. ISC dhcpd only sends NAKs for a network when it is marked authoritative.

    Release

    ipconfig /release or dhclient -r sends DHCPRELEASE, which returns the address early.

    Choosing lease times

    • Guest Wi-Fi and busy shared spaces: short leases (1 to 8 hours) so the pool recycles.
    • Wired desktops: long leases. The Windows Server default is 8 days, the IOS default is 1 day.
    • A long lease also lets existing clients ride out a DHCP server outage longer.

    Traps

    • Saying the renewal is a broadcast. Only rebinding at T2 is.
    How did you do?Book 3.3 Internet (IP)Own page
  4. How does DHCP avoid handing out an address that is already in use?

    Say this first

    Two checks. The server can ping an address before offering it: Cisco IOS sends 2 pings with a 500 ms timeout by default, and if anything replies it records a conflict and skips that address. Then the client probes the address with ARP before using it and sends DHCPDECLINE if another host answers. Excluding the ranges used by static devices prevents most conflicts in the first place.

    Go deeper

    On a Cisco IOS server

    Cisco IOS
    ip dhcp excluded-address 10.20.0.1 10.20.0.10
    ip dhcp ping packets 2
    ip dhcp ping timeout 500
    ip dhcp database bootflash:dhcp-bindings

    The ping values shown are the defaults. show ip dhcp conflict lists conflicted addresses and how they were found (ping or gratuitous ARP). They stay out of the pool until you run clear ip dhcp conflict *.

    Without ip dhcp database, IOS forgets its bindings on reload and may offer an address a client still holds. Cisco's advice is to either configure the database agent or turn off conflict logging with no ip dhcp conflict logging.

    On the client

    RFC 5227 ARP probes use sender IP 0.0.0.0, so they do not poison anyone's ARP cache. If a reply comes back, the client sends DECLINE and the server marks the address as bad.

    Usual causes of conflicts

    • Printers or servers configured statically inside the pool range.
    • A rogue DHCP server handing out the same subnet.
    • The server lost its bindings (reload without a database).

    Traps

    • Forgetting that excluded addresses are your job. The server does not know about static devices.
    How did you do?Book 3.3 Internet (IP)Own page
  5. What is the difference between a recursive and an iterative DNS query?

    Say this first

    A recursive query asks for the final answer or an error, and the server does all the work. Stubs on laptops send recursive queries with the RD (recursion desired) bit set. An iterative query accepts a referral, "ask that server next". Resolvers send iterative queries to root, TLD and authoritative servers, which answer only from their own data. Authoritative servers should not offer recursion to the internet.

    Go deeper

    The flags

    FlagSet byMeaning
    RDclientrecursion desired
    RAserverrecursion available on this server
    AAserverauthoritative answer

    A typical resolver reply shows flags: qr rd ra. A query sent with dig +norecurse straight to an authoritative server returns flags: qr aa.

    Keep the roles apart

    • Recursive resolvers serve your own clients and cache.
    • Authoritative servers publish your zones to the world and should refuse recursion. In BIND that is recursion no; on the authoritative instance, or allow-recursion limited to internal clients.

    Why it matters

    An open resolver (recursion for anyone) gets used for DNS amplification: small spoofed queries, large answers aimed at the victim. It also gives attackers a cache to try to poison. Resolver defences against poisoning include source port randomisation and DNSSEC validation.

    Traps

    • Saying stubs send iterative queries.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  6. Why can't you put a CNAME at the root of a zone, and how do DNS providers work around it?

    Say this first

    A CNAME says the name is only an alias, so no other record may exist at the same name. The zone apex (example.com itself) must carry SOA and NS records, so a CNAME there is illegal. Providers work around it with ALIAS, ANAME or CNAME-flattening records: the provider resolves the target itself and serves the result as ordinary A and AAAA records at the apex. AWS Route 53 does the same with alias records.

    Go deeper

    The rule

    RFC 1034: if a CNAME exists at a name, no other data may exist there. Only DNSSEC records are allowed alongside it. That rules out a CNAME at the apex and next to MX, TXT or any other record.

    Why people want it

    Cloud load balancers and CDNs give you a hostname, not a fixed address, because their addresses change. www can be a CNAME to it. The bare example.com cannot.

    The workarounds

    • Flattening, ALIAS, ANAME: the provider looks up the target and answers with A and AAAA records. Fine for most cases. The provider resolves the target from its own location, so geo-based answers reflect the provider, not the user, unless the platform handles that.
    • Route 53 alias records: point the apex at AWS resources directly.
    • HTTPS record in alias mode (RFC 9460): designed partly for this, but it only helps clients that query HTTPS records.
    • Redirect: serve the apex from a fixed address that redirects to www.

    Traps

    • Saying a CNAME at the apex works because the provider's console allowed it. The console is flattening it behind the scenes.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  7. How do DNS TTLs and negative caching work, and how do you use them when you change a record?

    Say this first

    Every record has a TTL in seconds. A resolver that caches it counts the TTL down and serves the cached copy until it reaches zero, then asks again. "No such name" (NXDOMAIN) and "no record of that type" (NODATA) answers are cached too, for the smaller of the SOA record's own TTL and the SOA minimum field (RFC 2308). Before a planned change I lower the TTL at least one old TTL ahead, make the change, then raise it again.

    Go deeper

    Positive caching

    Each resolver counts down on its own. Users behind different resolvers can see different answers for up to one full TTL after a change, and you cannot flush other people's resolvers.

    Negative caching

    A negative answer carries the zone's SOA in the authority section. With SOA ... 2026111001 7200 3600 1209600 3600 and an SOA TTL of 3600, a "does not exist" answer is cached for an hour. The classic trap: someone tests a name before it is created, the resolver caches NXDOMAIN, and the new record stays invisible to them for up to an hour.

    Resolvers also cap TTLs. BIND by default keeps positive answers at most 1 week and negative answers at most 3 hours.

    Migration recipe

    WhenAction
    Two days beforeLower the TTL from 86400 to 300. Wait at least 86400 seconds
    Change windowChange the address. Old answers drain within 5 minutes
    Day afterRaise the TTL again

    Keep the old server answering, or proxying to the new one, until the old TTL has passed.

    Flushing caches you do control

    WhereCommand
    BINDrndc flushname www.example.com
    Unboundunbound-control flush www.example.com
    Windows DNS serverClear-DnsServerCache
    Windows clientipconfig /flushdns
    Linux systemd-resolvedresolvectl flush-caches

    Traps

    • Lowering the TTL at the same moment as the change.
    • Forgetting negative caching when a brand new name "does not exist" for some users.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  8. What is in an SOA record, and how do secondary DNS servers stay in sync?

    Say this first

    The SOA names the primary server (MNAME) and the admin mailbox (RNAME), then five numbers: serial, refresh, retry, expire and minimum. Secondaries check the primary's serial every refresh interval, or at once when the primary sends a NOTIFY. If the serial went up they pull the zone with IXFR (just the changes) or AXFR (the whole zone) over TCP 53. If they cannot reach the primary for the expire time, they stop answering for the zone. The minimum field is now the negative caching TTL.

    Go deeper

    An SOA, field by field

    Output
    example.com. 3600 IN SOA ns1.example.com. hostmaster.example.com. (
            2026111001 ; serial, YYYYMMDDnn by convention
            7200       ; refresh, 2 hours
            3600       ; retry, 1 hour
            1209600    ; expire, 14 days
            3600 )     ; minimum, the negative caching TTL

    hostmaster.example.com. means the mailbox hostmaster@example.com: the first dot stands for the @.

    Rules

    • The serial must go up on every change. Lower it by mistake and secondaries ignore the change. Serial arithmetic (RFC 1982) lets you move forward past a mistake in steps.
    • NOTIFY (RFC 1996) makes updates near instant. Refresh is the safety net.
    • Restrict transfers to your secondaries by address and sign them with TSIG keys. An open AXFR hands anyone your whole zone, which is free reconnaissance.

    Hidden primary

    A common design: the primary is not listed in the NS records and only feeds the public secondaries. It can live behind a firewall and nobody queries it directly.

    Traps

    • Editing a zone file by hand and forgetting to raise the serial.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  9. How do you troubleshoot a DNS problem?

    Say this first

    First I separate DNS from the network: does the name fail while the IP address works? Then I query with dig and read the status. NXDOMAIN means the name does not exist where I asked. SERVFAIL means the resolver could not get a valid answer, often DNSSEC or a broken delegation. REFUSED means the server will not answer me. A timeout means nothing came back. Then I narrow it down: another resolver, the authoritative server directly, and dig +trace to walk the delegation myself.

    Go deeper

    The toolkit

    Shell
    dig www.example.com                                # what my configured resolver says
    dig @10.0.0.53 www.example.com                     # a specific resolver
    dig @ns1.example.com www.example.com +norecurse    # the source of truth, look for aa
    dig +trace www.example.com                         # walk from the root myself
    dig @ns1.example.com example.com SOA +short        # compare serials on every NS
    dig +cd www.example.com                            # skip DNSSEC checks: works now means DNSSEC is broken
    resolvectl status                                  # which resolver Linux is really using

    Reading the status

    StatusMeaningUsual cause
    NOERROR, answersfineif wrong, a stale cache or split DNS
    NOERROR, no answersNODATA, the name exists without that typeAAAA missing, for example
    NXDOMAINname does not existtypo, missing record, wrong search domain, negative cache
    SERVFAILresolver failedDNSSEC failure, lame delegation, unreachable authoritative servers
    REFUSEDpolicyresolver not allowing recursion for you
    timeoutno replywrong resolver address, UDP or TCP 53 blocked

    Classic causes

    Wrong resolver handed out by DHCP, VPN split DNS rules, a stale hosts file entry, a forgotten search domain, a secondary out of sync, expired DNSSEC signatures, TCP 53 blocked.

    Traps

    • Trusting nslookup alone on Windows.
    • Looking only for an answer and ignoring the status code.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  10. How does PAT let thousands of hosts share one public IP address?

    Say this first

    PAT tracks each connection by address and port, not by address alone. R1 rewrites the source address to its global address and, when it has to, the source port too, so every inside connection gets a unique global address and port. Replies come back to that pair and R1 looks up which inside host and port it belongs to. One global address has roughly 64,000 usable ports per protocol, and each entry lives only as long as its timer.

    Go deeper

    A busy translation table

    Output
    R1# show ip nat translations
    Pro  Inside global         Inside local          Outside local         Outside global
    tcp  203.0.113.2:51004     192.168.10.10:51004   198.51.100.80:443     198.51.100.80:443
    tcp  203.0.113.2:49731     192.168.10.11:49731   198.51.100.80:443     198.51.100.80:443
    udp  203.0.113.2:61812     192.168.10.12:61812   198.51.100.53:53      198.51.100.53:53
    icmp 203.0.113.2:1         192.168.10.10:1       198.51.100.80:1       198.51.100.80:1
    Total number of translations: 4

    Three hosts, one global address. ICMP echo has no ports, so PAT uses the ICMP query identifier in their place.

    Port choice on classic IOS

    IOS keeps the original source port when it is free on the global address. If it is taken, it picks the first free port in the same group: below 512, 512 to 1023, or 1024 and up. With a pool and overload, it moves to the next global address when one runs out of ports.

    Timers (IOS defaults)

    EntryTimeout
    TCP86400 s (24 hours)
    TCP after FIN or RST60 s
    UDP300 s
    DNS60 s
    ICMP60 s

    Tuned with ip nat translation tcp-timeout, udp-timeout and friends. A long TCP timer means abandoned connections hold ports. A short UDP timer breaks quiet VoIP and VPN flows.

    Traps

    • Saying PAT always changes the source port. IOS keeps it when it is free.
    How did you do?Book 3.3 Internet (IP)Own page
  11. NAT is configured but inside users cannot reach the internet. What do you check?

    Say this first

    In order: the interfaces are marked ip nat inside and ip nat outside on the right sides; the NAT access list matches the users' real source addresses; there is a default route out the outside interface; translations appear in show ip nat translations when a user tries; and the ISP routes the global address back to me. show ip nat statistics and a filtered debug ip nat usually point at the broken piece within minutes.

    Go deeper

    Symptom to cause

    SymptomLikely cause
    No translations created at allinterface roles missing or swapped, ACL does not match, traffic not routed out the outside interface
    Translations created, no repliesISP not routing the pool addresses back, upstream filtering
    Some users work, others do notACL covers only part of the range, or a dynamic pool without overload is full
    VPN broke when NAT was addedno NAT exemption for VPN traffic
    Inbound to a server failsACL written with the private address, wrong static entry, server gateway

    Read the statistics

    Output
    R1# show ip nat statistics
    Total active translations: 3 (1 static, 2 dynamic; 2 extended)
    Outside interfaces:
      GigabitEthernet0/0/0
    Inside interfaces:
      GigabitEthernet0/0/1, GigabitEthernet0/0/2
    Hits: 1520  Misses: 4
    Expired translations: 2
    Dynamic mappings:
    -- Inside Source
    [Id: 1] access-list NAT-USERS interface GigabitEthernet0/0/0 refcount 2

    The interface lists catch swapped roles. The dynamic mapping shows which ACL and target are in use.

    Watch it happen

    Filter the debug with a numbered ACL that matches one test host:

    Cisco IOS
    R1(config)# access-list 99 permit 192.168.10.10
    R1# debug ip nat 99

    Lines like NAT*: s=192.168.10.10->203.0.113.2, d=198.51.100.80 prove the translation. Outbound lines with no return lines put the problem upstream.

    Classic ACL mistakes

    • A subnet mask where a wildcard belongs: permit 192.168.10.0 255.255.255.0 matches the wrong addresses.
    • permit any: the router starts translating traffic it should not, such as VPN and its own management traffic.

    Traps

    • Running an unfiltered debug ip nat on a busy router.
    How did you do?Book 3.3 Internet (IP)Own page
  12. Which protocols have trouble with NAT, and why?

    Say this first

    Protocols that carry addresses or ports inside the payload, and protocols with no ports at all. FTP puts addresses in its PORT and PASV commands. SIP and SDP carry the RTP media address. IPsec AH protects the IP header, so any rewrite breaks it, and ESP has no ports for PAT to use. NAT devices patch some of this with application layer gateways (ALGs), IPsec uses NAT traversal over UDP 4500, and VoIP usually relies on STUN, TURN and ICE or a session border controller.

    Go deeper

    ProtocolProblemUsual fix
    FTP activeclient sends PORT with its private address, server connects back to itFTP ALG, or passive mode
    FTP passive, server behind NATthe PASV reply carries the server's private addressALG, or tell the server its public address
    SIPSDP carries the private RTP address and portSBC, STUN, TURN, ICE; ALGs often make it worse
    IPsec AHintegrity check covers the IP addressescannot be NATed, use ESP
    IPsec ESPno ports, PAT cannot tell flows apartNAT-T, ESP wrapped in UDP 4500
    PPTPGRE with no portsALG, though PPTP itself is obsolete
    Inbound peer to peerno mapping existsport forwarding, UPnP or PCP, hole punching

    ALGs on IOS

    IOS NAT inspects and rewrites FTP, SIP and other protocols by default. Voice providers often ask you to turn the SIP ALG off because it mangles messages their SBC already handles:

    Cisco IOS
    no ip nat service sip udp port 5060
    no ip nat service sip tcp port 5060

    Timers

    Quiet UDP flows lose their mapping when the NAT UDP timer expires (300 seconds on IOS, often less on consumer routers). Keepalives from the endpoints keep mappings alive.

    Traps

    • Saying IPsec cannot work through NAT. ESP with NAT-T works; only AH cannot.
    How did you do?Book 3.3 Internet (IP)Book 8.5 Example SystemsOwn page
  13. How do you secure NTP, and how do you configure NTP authentication on IOS?

    Say this first

    Three layers. Authenticate the servers with symmetric keys, so a device only accepts time from a source that proves it knows the key. Restrict who may sync or query with ntp access-group and infrastructure ACLs on UDP 123. And use several sources, so one bad clock gets outvoted. An IOS client needs four pieces: the key, ntp authenticate, the key marked trusted, and the server tied to the key.

    Go deeper

    Client configuration

    Cisco IOS
    ntp authentication-key 1 md5 N7p-Octet-Key
    ntp authenticate
    ntp trusted-key 1
    ntp server 10.0.0.123 key 1
    ntp server 10.0.0.124 key 1
    ntp source Loopback0

    The running config shows the key string encrypted with type 7. show ntp associations detail shows the word authenticated for each server that passes.

    ntp authenticate means "only sync to authenticated sources". Any server configured without a working key keeps answering but is never selected.

    Who may talk to you

    Cisco IOS
    access-list 10 permit 10.0.0.123
    access-list 10 permit 10.0.0.124
    access-list 20 permit 10.0.0.0 0.255.255.255
    ntp access-group peer 10
    ntp access-group serve-only 20

    peer sources may sync this device, serve-only clients may only ask for time, query-only allows control queries only. Once any access group is set, everything not permitted is refused.

    Junos

    Junos
    set system ntp authentication-key 1 type md5 value "N7p-Octet-Key"
    set system ntp trusted-key 1
    set system ntp server 10.0.0.123 key 1

    Beyond MD5 keys

    Symmetric MD5 keys are old but interoperate everywhere. Network Time Security (NTS, RFC 8915) uses TLS to agree keys and then authenticates every NTP packet. chrony and NTPsec support it; network devices mostly do not yet.

    Traps

    • Defining the key and the server but forgetting ntp trusted-key. The client never syncs.
    • Turning on ntp authenticate on a box whose upstream servers have no keys.
  14. What are the SNMPv3 security levels, and how do you configure SNMPv3 on IOS?

    Say this first

    Three levels. noAuthNoPriv: a username only, no authentication, no encryption. authNoPriv: messages are authenticated with an HMAC (MD5 or SHA) but sent in clear. authPriv: authenticated and encrypted (DES, 3DES or AES). I use authPriv with SHA and AES. On IOS you create a view, a group that sets the security level and the view, then a user in that group with its authentication and privacy passwords.

    Go deeper

    Configuration

    Cisco IOS
    ip access-list standard SNMP-MGRS
     permit 10.0.0.50
    !
    snmp-server view NMS-VIEW iso included
    snmp-server group NMS-RO v3 priv read NMS-VIEW access SNMP-MGRS
    snmp-server user nmsuser NMS-RO v3 auth sha Auth-Pass-2026 priv aes 128 Priv-Pass-2026
    RFC nameIOS group keywordAuthenticationEncryption
    noAuthNoPrivnoauthnono
    authNoPrivauthyesno
    authPrivprivyesyes

    The security model is USM (user-based, RFC 3414) and access control is VACM (view-based, RFC 3415).

    Things that catch people

    • snmp-server user lines never appear in the running config. Check with show snmp user.
    • User keys are localized to the engine ID. Change snmp-server engineID local and every user stops working until you re-create it.
    • The group's level is a minimum. A request at authNoPriv against a priv group is refused.
    • net-snmp rejects passphrases shorter than 8 characters.
    • Informs over v3 need the manager's engine ID (snmp-server engineID remote) and the user defined against it with the remote keyword.

    Test from the NMS

    Shell
    snmpget -v3 -l authPriv -u nmsuser -a SHA -A 'Auth-Pass-2026' -x AES -X 'Priv-Pass-2026' 10.255.0.1 SNMPv2-MIB::sysName.0

    MD5 and DES are weak. SHA with AES-128 is the common baseline, and newer platforms add SHA-2 options.

    Traps

    • Saying authNoPriv encrypts. It only authenticates.
    • Misreading the IOS keyword. priv on the group means authPriv.
  15. What is the difference between an SNMP trap and an inform, and what are MIBs and OIDs?

    Say this first

    A trap is a one-way notification from agent to manager on UDP 162. If it is lost, nobody knows. An inform is the same notification but the manager must acknowledge it, and the agent retries until it does. An OID is the dotted address of one piece of data in a global tree, for example 1.3.6.1.2.1.1.5.0 for sysName. A MIB is a module that defines a set of OIDs with their types and meanings, so the manager knows what the numbers are.

    Go deeper

    The OID tree

    Output
    1.3.6.1                iso.org.dod.internet
    1.3.6.1.2.1            mib-2, the standard MIBs
    1.3.6.1.2.1.1          system: sysDescr .1, sysUpTime .3, sysName .5
    1.3.6.1.2.1.2.2.1      ifEntry: ifDescr .2, ifOperStatus .8, ifInOctets .10
    1.3.6.1.2.1.31.1.1.1   ifXEntry: ifHCInOctets .6 (64-bit)
    1.3.6.1.4.1            enterprises: Cisco is 1.3.6.1.4.1.9

    Scalars end in .0, as in sysName.0. Table cells end in the row index, usually the ifIndex: ifInOctets.3 is interface index 3. snmp-server ifindex persist keeps ifIndex values stable across reloads.

    Trap or inform

    TrapInform
    Acknowledgednoyes, with a Response
    Retriesnoneuntil acknowledged or retries run out
    Cost on the devicesend and forgeteach inform held in memory until acknowledged
    Versionsv1, v2c, v3v2c, v3
    Cisco IOS
    snmp-server enable traps snmp linkdown linkup coldstart warmstart
    snmp-server host 10.0.0.50 version 3 priv nmsuser
    snmp-server host 10.0.0.51 informs version 2c Oct3t-Trap-2026

    Traps

    • Calling informs secure traps. They are acknowledged traps; security comes from v3.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  16. Compare NetFlow v5, NetFlow v9, IPFIX and sFlow.

    Say this first

    NetFlow v5 exports fixed-format records about IPv4 flows only. v9 is template-based: the exporter first sends templates that describe the fields, so it can carry IPv6, MPLS and anything else. IPFIX is the IETF standard built from v9 (its header says version 10), adds variable-length and vendor-defined fields, and uses UDP 4739 by default. sFlow is different in kind: the device keeps no flow cache, it samples 1 in N packets and sends their headers plus interface counters to the collector.

    Go deeper

    What a flow is

    A one-way stream of packets that share key fields. Traditional NetFlow uses seven keys: source and destination address, source and destination port, IP protocol, ToS byte and input interface. The device keeps flows in a cache and exports a record when a flow ends, when it goes idle (inactive timeout, 15 seconds by default) or when it has run for the active timeout (30 minutes by default on IOS). Set the active timeout to about 60 seconds, or long flows appear as spikes.

    NetFlow v5NetFlow v9IPFIXsFlow
    Defined byCiscoCisco, RFC 3954IETF, RFC 7011sFlow.org
    Formatfixed 48-byte recordstemplatestemplates, variable-length fieldssampled headers plus counters
    IPv6, MPLSnoyesyesyes, it sees raw headers
    Flow cache on the deviceyesyesyesno
    Usual collector portUDP 2055 by conventionUDP 2055 by conventionUDP 4739UDP 6343

    With v9 and IPFIX the collector cannot decode data until it has the template, so a collector that restarts shows a gap until the next template refresh.

    Flexible NetFlow on IOS-XE

    Cisco IOS
    flow exporter EXP-COLLECTOR
     destination 10.0.0.70
     source Loopback0
     transport udp 4739
     export-protocol ipfix
    !
    flow monitor MON-V4
     exporter EXP-COLLECTOR
     record netflow ipv4 original-input
     cache timeout active 60
    !
    interface GigabitEthernet0/0/0
     ip flow monitor MON-V4 input

    Uses: top talkers, capacity planning, DDoS detection, security investigations, billing.

    Traps

    • Saying NetFlow captures packets. It summarises flows and carries no payload.
    • Leaving the active timeout at 30 minutes and trusting the graphs.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page
  17. What is IP SLA, and how do you use it to fail over a default route?

    Say this first

    IP SLA is Cisco's built-in probe engine. The router sends synthetic traffic on a schedule (ICMP echo, UDP jitter, TCP connect, HTTP, DNS and more) and records reachability, latency, jitter and loss. Paired with object tracking it drives decisions: a track object follows the probe result, a static route tied to that track is withdrawn when the probe fails, and a floating static route to a backup ISP takes over.

    Go deeper

    Configuration

    Cisco IOS
    ip sla 1
     icmp-echo 198.51.100.200 source-interface GigabitEthernet0/0/0
     timeout 2000
     threshold 1000
     frequency 10
    ip sla schedule 1 life forever start-time now
    !
    track 1 ip sla 1 reachability
     delay down 10 up 30
    !
    ip route 0.0.0.0 0.0.0.0 203.0.113.1 track 1
    ip route 0.0.0.0 0.0.0.0 192.0.2.9 250
    ip route 198.51.100.200 255.255.255.255 203.0.113.1
    • The probe target 198.51.100.200 sits beyond ISP1's first hop. ISP1's router at 203.0.113.1 can answer while its upstream is broken.
    • timeout and threshold are in milliseconds, frequency in seconds. The defaults are 5000 ms, 5000 ms and 60 seconds.
    • delay down 10 up 30 stops a flapping path from flapping the route.
    • The host route keeps the probe on ISP1. Without it, after failover the probe would follow the backup default, succeed, and bring the primary route back: a loop of flaps.
    • The backup default to ISP2 (192.0.2.9) has distance 250, so it only installs when the tracked route is gone.

    Other probes

    udp-jitter measures one-way jitter, loss and latency for voice and needs ip sla responder on the far Cisco device. With a codec option it also estimates a MOS score.

    Verify

    show ip sla statistics 1, show track 1, show ip route static. On Junos the equivalent is RPM (real-time performance monitoring) probes with ip-monitoring.

    Traps

    • Forgetting ip sla schedule. Without it the probe is defined but never runs.
    • Probing the ISP next hop on the directly connected link.
    How did you do?Book 3.4 RoutingOwn page

Expert7

  1. What is DHCP option 82, and why can clients stop getting addresses right after you enable DHCP snooping?

    Say this first

    Option 82 (relay agent information) lets a relay or access switch tag a request with where it came from: circuit ID (VLAN and port) and remote ID (the switch). Catalyst switches insert it by default when DHCP snooping is on, but they are not relays, so giaddr stays 0.0.0.0. A Cisco IOS relay or DHCP server that receives option 82 with a zero giaddr on an untrusted interface drops the packet. The fix is one line: ip dhcp relay information trusted on the router interface, or no ip dhcp snooping information option on the switch.

    Go deeper

    What option 82 carries

    • Sub-option 1, circuit ID: usually the VLAN, module and port of the client.
    • Sub-option 2, remote ID: usually the switch MAC address.

    The server can use it for policy (fixed address per port, subscriber identity at service providers) and logs it. The relay strips it from the reply before the client sees it.

    Why the router drops it

    RFC 3046 tells a relay to discard a packet that arrives on an untrusted circuit with option 82 already present and giaddr zero, because a client could be forging it. A snooping switch creates exactly that packet. debug ip dhcp server packet on the router shows it complaining that the relay information option is present while giaddr is zero.

    Fixes

    On the router, trust the option on the interface facing the switch, or everywhere:

    Cisco IOS
    interface GigabitEthernet0/0/1.40
     ip dhcp relay information trusted
    !
    ip dhcp relay information trust-all

    Or stop the switch inserting it:

    Cisco IOS
    no ip dhcp snooping information option

    If the server really uses option 82 (service provider style), keep the insertion and trust it on the relay. Otherwise turn insertion off at the access layer.

    Traps

    • Assuming snooping trust on the uplink covers this.
    • Turning DHCP snooping off to make DHCP work again. That removes the protection when one line fixes it.
    How did you do?Book 3.3 Internet (IP)Own page
  2. How do you make DHCP highly available?

    Say this first

    Two servers that can each answer for every scope, and every relay pointing at both. The choices are split scopes (each server owns part of the range, often 80/20), or a failover pair that shares lease state: Windows Server DHCP failover in load-balance or hot-standby mode, or ISC Kea with its HA hook. Whichever I choose, every SVI gets a helper address for each server.

    Go deeper

    Split scope

    Both servers hold the same subnet with non-overlapping ranges. No sync, simple to run. Each part must cover demand on its own if the other server is down, and reservations must exist on both.

    Failover with shared state

    • Windows Server (2012 and later): two partners replicate leases. Load-balance mode shares the pool (50/50 by default). Hot-standby keeps a reserve on the standby (5 percent by default). The maximum client lead time (MCLT, 1 hour by default) bounds how far one partner can extend a lease beyond what the other knows.
    • ISC Kea: the high availability hook supports load-balancing, hot-standby and passive-backup modes, with the partners sending lease updates to each other.
    • ISC dhcpd: has a failover protocol between two peers, but ISC has ended maintenance of dhcpd and points users to Kea.

    Branches

    A branch that depends on central DHCP over the WAN loses new leases when the WAN fails. Existing clients keep their addresses until expiry. A long lease or a small local IOS DHCP server covers that. The IOS server has no failover of its own, so give it ip dhcp database so a reload keeps bindings.

    Traps

    • Overlapping split-scope ranges. Two servers can then lease the same address to two clients.
    • Forgetting reservations on the second server. Printers and phones with reservations get a random address during a failover.
    How did you do?Book 3.3 Internet (IP)Own page
  3. Does DNS use UDP or TCP, and what happens with large responses?

    Say this first

    Both, on port 53. Most queries use UDP. Classic DNS capped UDP answers at 512 bytes. EDNS(0) lets the client advertise a bigger buffer, and 1232 bytes is today's recommended size because it avoids IP fragmentation. If an answer does not fit, the server sets the TC (truncated) bit and the client retries over TCP. Zone transfers always use TCP. A firewall that blocks TCP 53 or drops fragments breaks only the large answers, which makes it a confusing fault.

    Go deeper

    The pieces

    • EDNS(0) (RFC 6891): an OPT pseudo-record in the additional section carries the client's UDP buffer size and the DO bit that asks for DNSSEC records.
    • 1232 bytes: the IPv6 minimum MTU of 1280, minus 40 bytes of IPv6 header and 8 of UDP. It was the value agreed for DNS Flag Day 2020.
    • TCP: RFC 7766 makes TCP support mandatory for DNS software. It is not just for transfers.

    What produces big answers

    DNSSEC signatures, long TXT records (SPF, verification tokens), names with many A or AAAA records.

    The symptom

    Most names resolve, a few fail with SERVFAIL or time out. When an answer is too big, dig prints this line before it retries over TCP:

    Output
    ;; Truncated, retrying in TCP mode.

    If dig +tcp to the same server then times out, TCP 53 is blocked. Older firewall DNS inspection profiles also capped messages at 512 bytes and dropped EDNS answers.

    Encrypted DNS

    ProtocolTransport
    DNS over TLS (DoT)TCP 853
    DNS over HTTPS (DoH)TCP 443, or HTTP/3 over UDP 443
    DNS over QUIC (DoQ)UDP 853

    DoH matters to network teams because it looks like ordinary web traffic and can bypass the internal resolvers that enforce policy.

    Traps

    • Saying DNS uses UDP and TCP is only for zone transfers. TCP carries any answer too big for UDP.
  4. What does DNSSEC protect against, and what does it not do?

    Say this first

    DNSSEC lets a validating resolver prove an answer came from the zone owner unchanged. Each record set is signed (RRSIG), the zone publishes its public keys (DNSKEY), and the parent vouches for the child's key with a DS record, up to the root's trust anchor. It stops cache poisoning and spoofed answers. It does not encrypt anything, does not hide which names you look up, and does not protect the hop between a non-validating stub and its resolver.

    Go deeper

    The chain of trust

    1. The resolver trusts the root key (the trust anchor).
    2. The root zone signs a DS record for com., a hash of the .com key.
    3. The .com zone signs a DS record for example.com..
    4. example.com signs its records with keys that match that DS.

    Zones usually have a key-signing key (KSK, the one the parent's DS points at) and a zone-signing key (ZSK, which signs the records). NSEC or NSEC3 records prove that a name does not exist.

    What a validating resolver does

    Valid answers get the AD (authenticated data) bit. Answers that fail validation become SERVFAIL. The client gets no answer at all rather than a forged one.

    How DNSSEC outages happen

    • Signatures expire because the signing job stopped.
    • A key rollover without updating the DS at the registrar.
    • Moving to a new DNS provider while the old DS stays at the parent.

    dig +dnssec shows the RRSIGs, dig +cd turns checking off for a comparison, and delv explains validation step by step.

    Traps

    • Saying DNSSEC encrypts DNS.
  5. What is the NAT order of operations on a Cisco IOS router, and why does it matter?

    Say this first

    It depends on the direction. Inside to outside, IOS routes first and then translates. Outside to inside, it translates first and then routes. In both directions the inbound ACL runs before NAT, and crypto maps and outbound ACLs run after it. So an ACL inbound on the outside interface must match the global address, the router needs a route to the inside local address for incoming traffic, and VPN traffic must be exempted from NAT or it stops matching the crypto ACL.

    Go deeper

    The sequence, trimmed to what matters

    StepInside to outsideOutside to inside
    1IPsec decryption, if anyIPsec decryption, if any
    2Input ACLInput ACL
    3Policy routingNAT, global to local
    4RoutingPolicy routing
    5NAT, local to globalRouting
    6Crypto map checkCrypto map check
    7Output ACLOutput ACL

    What follows from it

    1. Inbound ACL on the outside interface sees pre-NAT addresses. To let the internet reach SRV1 (192.168.20.10, published as 203.0.113.5), permit host 203.0.113.5, not the private address.
    2. Outbound ACL on the outside interface sees post-NAT addresses, so the sources are inside global.
    3. Inbound ACL on an inside interface sees inside local addresses.
    4. Outside to inside, routing uses the translated destination. R1 needs a route to 192.168.20.10.
    5. Crypto runs after NAT. Traffic to a VPN peer's private network gets PATed first, then no longer matches the private-to-private crypto ACL. Exempt it in the NAT rule:
    Cisco IOS
    ip access-list extended NAT-USERS
     deny   ip 192.168.10.0 0.0.0.255 10.200.0.0 0.0.255.255
     permit ip 192.168.10.0 0.0.0.255 any
    !
    ip nat inside source list NAT-USERS interface GigabitEthernet0/0/0 overload
    1. Translation happens only when a packet crosses between an ip nat inside and an ip nat outside interface. Inside to inside is never translated.

    Other platforms do it differently

    • Cisco ASA (8.3 and later) matches ACLs against the real, untranslated address: the opposite habit.
    • Linux netfilter does DNAT in PREROUTING, before the routing decision, and SNAT in POSTROUTING, after it. Filter rules in FORWARD see the private destination of a port forward.

    Traps

    • Saying NAT happens before routing in both directions.
    • Writing the outside interface ACL with private addresses.
    How did you do?Book 3.3 Internet (IP)Own page
  6. Inside users cannot reach an internal server by its public address, but internet users can. Why, and how do you fix it?

    Say this first

    That is NAT hairpinning, also called NAT loopback or reflection. The user's packet to 203.0.113.5 enters R1 on an inside interface, and IOS only translates a global destination back to the local one for packets that arrive on an outside interface, so nothing rewrites it. Even on devices that do rewrite it, a server on the same subnet as the user replies straight to the user from its private address, and the user drops that reply. The clean fix is split DNS. If you must hairpin, the device has to translate both destination and source.

    Go deeper

    Why it fails

    1. PC1 (192.168.10.10) resolves app.example.com to 203.0.113.5 and sends a SYN to it.
    2. The SYN enters R1 on Gi0/0/1, an inside interface. Outside-to-inside translation only applies to packets arriving on an outside interface, so the destination stays 203.0.113.5 and the packet never reaches SRV1 at 192.168.20.10.

    The same-subnet trap

    Suppose a device does rewrite the destination (Linux DNAT applies on any interface). If the client sits on the server's own subnet, the server replies directly from 192.168.20.10. The client sent its SYN to 203.0.113.5, so it discards the reply. The device has to rewrite the source as well, so the reply comes back through it.

    Fixes, best first

    1. Split DNS: the internal view of app.example.com returns 192.168.20.10. No hairpin at all.
    2. A DMZ on its own interface: clients and servers on different interfaces, so replies always return through the edge device.
    3. Hairpin NAT on the edge device. On Linux:
    Shell
    iptables -t nat -A PREROUTING -d 203.0.113.5 -p tcp --dport 443 -j DNAT --to-destination 192.168.20.10
    iptables -t nat -A POSTROUTING -s 192.168.20.0/24 -d 192.168.20.10 -p tcp --dport 443 -j MASQUERADE

    The first rule has no -i, so it applies to inside traffic too. The second source-NATs clients on the server's own subnet so their replies return through the router.

    On classic IOS the NAT Virtual Interface (ip nat enable on interfaces, ip nat source ... rules without inside or outside) supports hairpinning, but NVI is not supported on IOS-XE.

    Traps

    • Testing a new port forward from inside the LAN and declaring it broken.
  7. How does NTP decide which server to trust, and why should a device have at least four sources?

    Say this first

    The client keeps the best recent samples from each server, works out an offset and an error range for each, and looks for the largest group of servers whose ranges overlap. Servers outside that group are falsetickers and are thrown out. The survivors are clustered and combined, and one becomes the system peer. With one source you cannot detect a bad clock, with two you cannot tell which one is wrong, three let a majority outvote one liar, and four still leave three to vote when one fails. The NTP best current practice, RFC 8633, recommends at least four.

    Go deeper

    The pipeline

    1. Clock filter: per server, keep the last 8 samples and use the one with the lowest delay. Low delay means the least room for error.
    2. Selection: an intersection algorithm finds the range most servers agree on. Servers outside it are falsetickers.
    3. Cluster: prune the survivors that sit furthest from the rest.
    4. Combine: a weighted average of the survivors. One of them is the system peer.
    5. Discipline: steer the local clock. ntpd slews offsets below 128 ms and steps larger ones.

    Reading it on IOS

    Output
    R1# show ntp associations
    
      address         ref clock       st   when   poll reach  delay  offset   disp
    *~10.0.0.123      .GPS.            1     38     64   377  0.412   0.087  0.952
    +~10.0.0.124      .GPS.            1     51     64   377  0.530   0.142  1.104
    -~192.0.2.123     .PPS.            1     17     64   377 18.230   2.904  3.517
    x~198.51.100.123  .GPS.            1     44     64   377 21.904 812.335  2.871
     * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured

    198.51.100.123 claims stratum 1 yet sits 812 ms away from the other three, so it is marked as a falseticker and ignored. Delay, offset and dispersion are in milliseconds.

    reach is an 8-bit register shown in octal: 377 means the last eight polls were all answered.

    Traps

    • Configuring exactly two NTP servers for redundancy. When they disagree, there is no majority.
    How did you do?Book 9.3 Infrastructure ApplicationsOwn page