The Handbook

    Theme
    • Guides
        • Check a system before installing FreeBSD
        • Orient a Linux administrator on FreeBSD
        • Supported FreeBSD releases
        • Choose a FreeBSD documentation and support channel
        • Move files safely without GNU mv -t
        • Update, upgrade, or update packages?
        • Upgrade 14.4 or 15.0 to FreeBSD 15.1
        • Choose packages, ports, or poudriere
        • Choose the quarterly or latest package branch
        • Choose a FreeBSD download or package mirror
        • Make a system setting persistent
        • Configure locale, keyboard, and time zone
        • Configure a serial console for recovery
        • Choose a custom kernel, module, or loader setting
        • Run a Linux binary with the compatibility layer
        • Check desktop and laptop hardware before installation
        • Choose and check a graphics driver
        • Choose Xorg or Wayland
        • Build a maintainable desktop baseline
        • Install and check a desktop browser
        • Check laptop Wi-Fi, power, and suspend
        • Check multimedia readiness
        • Choose and configure a printing stack
        • Run Windows applications with Wine
        • Snapshot and replicate a ZFS dataset
        • Choose a filesystem and storage layout
        • Operate ZFS without losing the recovery path
        • Restore files from a ZFS snapshot
        • Read ZFS pool health and run a scrub
        • Replace a failed device in a ZFS mirror
        • Replicate a ZFS dataset over SSH
        • Change PF safely on a remote host
        • Configure a narrow WireGuard tunnel
        • Plan a FreeBSD home server
        • Choose a mail server or an outgoing relay
        • Publish a network service safely
        • Choose a jail network model
        • Choose native jails or a jail manager
        • Choose a jail or a bhyve virtual machine
        • Establish a FreeBSD security baseline
        • Choose a MAC policy
        • Audit security-relevant activity
        • Start a DTrace performance investigation
    • Integrations
        • Create a first jail with Bastille
        • Compare jail managers and OCI tooling
        • Publish a Bastille service through PF
        • Mount a ZFS dataset in a Bastille jail
        • Update and upgrade Bastille jails
        • Back up and restore a Bastille jail
        • Prepare bhyve and vm-bhyve
        • Choose NFS or Samba for file sharing
        • Choose ZFS backup automation
        • Operate a signed poudriere repository
        • Manage FreeBSD configuration with Ansible or Salt
        • Run Motion with webcamd on FreeBSD
        • Design a reverse proxy, certificates, and monitoring
    • FAQ
      • Troubleshooting
          • Recover an interrupted freebsd-update run
          • Resolve a package repository or ABI mismatch
          • Diagnose the FreeBSD boot path
          • Recover with a ZFS boot environment
          • Diagnose DNS, routing, and firewall paths
          • Diagnose network mbuf exhaustion
          • Bind a service to a low port without running it as root
          • Diagnose audio output or input
          • Diagnose webcamd, cuse, and a webcam
          • Fix USB device permissions without opening every device
      • About this handbook
      • Synopsis
      • Record the exact failing path
      • Prove local configuration
      • Separate DNS from IP reachability
      • Prove the listener at the destination
      • Observe PF and packets
      • Apply the model to common integrations
      • Primary references

      Diagnose DNS, routing, and firewall paths

      Last reviewed
      13 August 2026
      Applies to
      15.1-RELEASE, 15.0-RELEASE, 14.4-RELEASE

      Synopsis #

      “The network is down” commonly combines several independent systems: interface state, address assignment, route selection, DNS, PF, NAT, a listening socket, and the application’s own protocol. Changing all of them at once destroys the evidence needed to identify the failed layer.

      Start at the failing process, record one destination address and port, and follow that path outward. Use numeric addresses before DNS and a direct socket test before application-specific configuration.

      Record the exact failing path #

      Write down:

      • source host or jail and source network;
      • destination name, resolved address, protocol, and port;
      • expected receiving interface;
      • whether PF translates the source or destination;
      • the expected return route.

      Capture the error and time. A refusal, timeout, DNS error, and TLS error identify different stages.

      Prove local configuration #

      On the failing FreeBSD system:

      $ ifconfig -a
      $ netstat -rn
      $ route -n get 198.51.100.20
      $ cat /etc/resolv.conf
      

      Replace the documentation address with the actual destination. route -n get shows the selected gateway and interface. An unexpected interface or VPN route must be corrected before firewall rules can make the path reliable.

      Inside a Bastille jail, run the same commands through the manager:

      # bastille cmd web ifconfig -a
      # bastille cmd web netstat -rn
      # bastille cmd web cat /etc/resolv.conf
      

      For VNET, the jail has its own routes. For a classic jail, the visible network state reflects the shared host stack and its permitted addresses.

      Separate DNS from IP reachability #

      Query the configured resolver and then a specified resolver:

      $ drill service.example.net A
      $ drill @192.0.2.53 service.example.net A
      $ getent hosts service.example.net
      

      The specified resolver address is an example. A direct query that works while the default query fails points to resolver selection or /etc/resolv.conf. A correct answer does not prove that the returned address is reachable or that the application uses the same resolver path.

      Test the numeric service endpoint:

      $ nc -vz 198.51.100.20 443
      $ fetch -o /dev/null https://198.51.100.20/
      

      A TLS certificate-name error proves that the TCP and TLS endpoint answered; it is different from a timeout.

      Prove the listener at the destination #

      On the destination host or jail:

      # sockstat -4 -6 -l
      # service nginx status
      

      Confirm the exact local address and port. A service bound only to 127.0.0.1 cannot accept traffic sent to a jail, LAN, or public address. A service bound to all addresses may be broader than intended.

      Observe PF and packets #

      On the filtering host, inspect rules, translation, and states:

      # pfctl -sr
      # pfctl -sn
      # pfctl -ss
      # pfctl -vvsr
      

      Capture only the relevant interface, host, and port:

      # tcpdump -ni em0 host 198.51.100.20 and port 443
      

      Interpret the evidence in order:

      EvidenceLikely boundary
      No packet arrivesUpstream route, address, client policy, or wrong interface
      Packet arrives but no PF stateFilter or translation match
      State exists and destination receives nothingRedirection, forwarding, or destination route
      Destination receives SYN but sends no replyListener or local destination policy
      Reply leaves but client never receives itReturn route, NAT, or upstream filtering
      TCP succeeds but application failsTLS, authentication, virtual host, or application protocol

      Do not disable PF as a diagnostic shortcut on a remote or exposed host. Use Change PF safely on a remote host and make one reviewable change.

      Apply the model to common integrations #

      For private Bastille jails, check the jail listener, the private host-to-jail path, the Bastille PF table, and only then the rdr mapping in Publish a Bastille service through PF .

      For WireGuard, add endpoint DNS, public UDP reachability, wg show handshake time, AllowedIPs, and the post-tunnel route to the same sequence. See Configure a narrow WireGuard tunnel .

      For bhyve, identify the tap interface, bridge membership, guest route, and whether filtering occurs on the physical member, bridge, or tap. See Prepare bhyve and vm-bhyve .

      Primary references #

      • FreeBSD Handbook: Network troubleshooting
      • route(8)
      • netstat(1)
      • resolv.conf(5)
      • sockstat(1)
      • tcpdump(1)
      • pfctl(8)

      Independent documentation. Not affiliated with or endorsed by the FreeBSD Project or the FreeBSD Foundation.

      Report a bug
      • Synopsis
      • Record the exact failing path
      • Prove local configuration
      • Separate DNS from IP reachability
      • Prove the listener at the destination
      • Observe PF and packets
      • Apply the model to common integrations
      • Primary references