Debian 13 Tutorial / Diagnose DNS, Listening Ports and HTTP Connection Failures
When a Debian 13 server cannot be reached, check addresses and routes, DNS name resolution, the listening socket and the HTTP response separately. A request that works inside the guest does not prove that a host can reach it through NAT. An HTTP 404 means an HTTP server answered the request, so inspect the requested path and the responding server rather than treating it as a basic connection failure.
Identify the Connection Path Being Tested
This tutorial uses a Debian 13 virtual machine connected to VirtualBox NAT (Network Address Translation) and a Windows host. The guest address is 10.0.2.15, and the gateway is 10.0.2.2 in a single NAT adapter configuration. Check the actual environment addresses with the query results below, and do not apply the example addresses to other networks.
ip -br address
ip route
ip route get 10.0.2.2
getent ahostsv4 deb.debian.org
sudo ss -lntp
ip route get checks the route, interface, and source address that the kernel selects when sending to the specified destination. It is not a command to verify that the packet actually reached the destination. getent uses the system’s name resolution settings, and the resolved content delivery network (CDN) address may vary depending on the time. ss’s -l refers to listening, -n to numeric address and port, -t to TCP, and -p to process information.
| Test Results | Targets to Check First |
|---|---|
| Cannot resolve name to address | Name typo, DNS and system name lookup settings |
| No route to the destination | Interface address, connection route, and default gateway |
| Only successful inside the guest | Listening address, port forwarding target, firewall |
| HTTP 404 response | URL path, file location, virtual host, and application routing |
| Connection timeout | Check destination, port, path, and filtering again; you cannot determine a cause based on this result alone. |
The host's 127.0.0.1 and the guest's 127.0.0.1 are loopback addresses of different computers. To allow a NAT guest to receive normal host connections, a path such as port forwarding is required. While keeping the existing SSH forwarding rules, we will add separate rules for HTTP practice. Determining management tools follows the conditions of network and DNS management identification, and address changes follow static IPv4/DNS configuration and DHCP recovery.
Prepare Test Files and a Loopback-Only Server
Prepare two Debian terminals and the host PowerShell. The Python HTTP server is used only for connection verification and not as a production web server. If an existing service uses port 8080, do not stop it; select an unused practice port and consistently apply it in all subsequent commands and forwarding rules.
sudo ss -lntp 'sport = :8080'
sudo apt update
sudo apt install --no-install-recommends python3 curl
python3 --version
curl --version
If ss shows no listening row beyond its header, no TCP listener was listed for that port at that moment. Review dependency and package changes before confirming installation. The lab guest used Python 3.13.5 and curl 8.14.1; Debian security updates can change those package revisions.
Execute the following on a regular user terminal A. mkdir is written to fail if there is a folder with the same name. Do not overwrite the existing folder; check its contents first.
mkdir "$HOME/lf-net-demo" &&
printf 'debian-network-lab\n' > "$HOME/lf-net-demo/probe.txt" &&
python3 -m http.server 8080 --bind 127.0.0.1 --directory "$HOME/lf-net-demo"
If folder creation fails, do not execute the server command. If it starts normally, terminal A stays in the server running state. Since the document root is restricted to a dedicated folder, the entire home directory is not provided. Port 8080 is a port that a regular user can bind to, so sudo is not required to run the server.
Execute the following on guest terminal B. Make requests after the server outputs the start message.
sudo ss -lntp 'sport = :8080'
curl --noproxy '*' --connect-timeout 3 --max-time 6 -sS http://127.0.0.1:8080/probe.txt
curl --noproxy '*' --connect-timeout 3 --max-time 6 -sS http://127.0.0.1:8081/probe.txt
The first request outputs debian-network-lab. The local address of ss is 127.0.0.1:8080. If there is no other service on 8081, the second request will fail to connect. In the practice, curl exit code 7 was observed. This comparison shows the importance of the port of the running service, and there may be services on ports that you expect to fail, so prioritize your own query results.
--noproxy '*' allows this request to bypass proxy environment variables. --connect-timeout is a limitation at the connection step, and --max-time is a limitation on the total operation time. The network path does not globally delete the originally required organizational proxy settings.
Compare Host Access by Changing Only the Bind Address
In VirtualBox, open the target VM's Settings → Network → NAT Adapter → Advanced → Port Forwarding. The UI location may vary depending on the version. Only add the new rule below and leave the existing SSH rule as it is. If the host port 18080 is in use, select an empty port.
| Item | Settings |
|---|---|
| Name / Protocol | lf-debian13-http15 / TCP |
| Host IP / Port | 127.0.0.1 / 18080 |
| Guest IP / Port | If you use the default address of a single NAT guest, leave the IP blank / 8080 |
If you specify a guest address, it must match the current guest address. This exercise uses the default NAT address 10.0.2.15, and VMs with changed addresses should have their forwarding targets rechecked. Restricting the host IP to loopback prevents other computers on the LAN from accessing the practice server. For detailed operation, refer to VirtualBox NAT and port forwarding documentation.
Run this in the host PowerShell. curl.exe is specified to distinguish it from Windows PowerShell aliases.
curl.exe --noproxy "*" --connect-timeout 3 --max-time 6 -sS http://127.0.0.1:18080/probe.txt
$LASTEXITCODE
The request inside the guest succeeded, but the host request failed because the server listened only on guest loopback, not the guest NIC address receiving NAT-forwarded traffic. The lab observed a connection reset and curl exit status 56. Other virtualization versions or connection states can produce different errors or timeouts; matching 56 exactly is not a requirement.
In guest terminal A, stop the server with Ctrl+C. Keep the same file, port and forwarding rule, and change only the binding address.
python3 -m http.server 8080 --bind 0.0.0.0 --directory "$HOME/lf-net-demo"
After confirming the server start message, check requests from guest B to the listening address and NIC address.
sudo ss -lntp 'sport = :8080'
curl --noproxy '*' --connect-timeout 3 --max-time 6 -sS http://10.0.2.15:8080/probe.txt
0.0.0.0:8080 means listening on all local IPv4 addresses; it does not automatically provide IPv6 listening. After the request to the guest NIC address succeeds, repeat the same curl.exe command on the host to check the file contents and exit status 0. If a request fails immediately after startup, first confirm that the process is still running and that the listening socket exists.
This comparison isolates the effect of the listening address. If your request still fails, inspect forwarding, the guest address, listening socket and filtering rules rather than simply disabling the firewall. Failure of ping alone can reflect Internet Control Message Protocol (ICMP) policy; it does not prove that all Transmission Control Protocol (TCP) services are unavailable.
Distinguish HTTP Status from curl Exit Status
The server is running on all IPv4 addresses and the host PowerShell requests a non-existent file. -w outputs the response code, and -o NUL discards the body on Windows.
curl.exe --noproxy "*" --connect-timeout 3 --max-time 6 -sS -o NUL -w "%{http_code}\n" http://127.0.0.1:18080/missing.txt
$LASTEXITCODE
curl.exe --noproxy "*" --connect-timeout 3 --max-time 6 -sS --fail -o NUL -w "%{http_code}\n" http://127.0.0.1:18080/missing.txt
$LASTEXITCODE
The HTTP code for the first request is 404, but the curl exit code is 0. By default, curl does not treat HTTP error statuses themselves as transmission failures. The second request receives the same HTTP 404 and returns exit code 22 because of --fail. In automated checks, whether to only look at the exit code or also judge the HTTP status should be determined according to purpose. Do not replace operational checks that require confirming redirection, authentication, or actual response content solely with checking for 200.
In this controlled test, 404 confirms an HTTP exchange with the Python server. Check the URL path and document root, and compare the server log for GET /missing.txt and status 404. In a real deployment, also confirm which server or proxy returned the response. The official curl manual documents HTTP handling and transfer exit codes separately.
Isolate DNS with a Request-Only Address Override
The special-use name rules in RFC 6761 reserve .invalid for names expected not to resolve successfully. Keep the server and forwarding rule unchanged and request the test hostname below from the Windows host.
curl.exe --noproxy "*" --connect-timeout 3 --max-time 6 -sS http://lf-debian13-net15.invalid:18080/probe.txt
$LASTEXITCODE
curl.exe --noproxy "*" --connect-timeout 3 --max-time 6 -sS --resolve "lf-debian13-net15.invalid:18080:127.0.0.1" http://lf-debian13-net15.invalid:18080/probe.txt
$LASTEXITCODE
In the general query path, the first request returns a name lookup failure and exit code 6. The second request specifies the address for that hostname and port only for this curl execution, so it receives the file and returns exit code 0. --resolve does not modify the DNS server or the hosts file and retains the hostname in the URL. In HTTPS, certificate verification for the URL hostname is still required, so do not confuse this option with skipping certificate verification.
If only the second request succeeds, it indicates that the transmission path to the specified address works and gives grounds to further examine the original name lookup path. Specifying an arbitrary address without verifying whether it is the correct IP in an actual service could result in checking another server. You should also not assume that the proxy, cache, or name lookup method of a certain program is the same as the system getent result.
Clean Up and Record the Diagnostic Results
- On guest terminal A, stop the HTTP server with Ctrl+C.
- In the VirtualBox port forwarding table, delete only the
lf-debian13-http15rule created this time. Keep the SSH rule. - On the guest, check the listening state and the file below, and delete only the files and empty folders created this time.
sudo ss -lntp 'sport = :8080'
cat "$HOME/lf-net-demo/probe.txt"
rm -- "$HOME/lf-net-demo/probe.txt"
rmdir -- "$HOME/lf-net-demo"
The server’s listening row should disappear, and the host's practice HTTP requests should no longer succeed either. If rmdir fails, check if there are other files in the folder and do not forcibly delete recursively. The installed curl and Python can be used for other management tasks, so batch removal without checking necessity should not be carried out.
When recording problems, it is helpful to include the inspection location (host/guest), request URL, actual destination address and port, listening address, curl exit code, and HTTP code. Address and path lookup can be checked in the Debian 13 ip-route documentation, listening sockets in the ss documentation, and test server options in the Python 3.13 http.server documentation.




