Networking

Cheatsheet

Display routing table

  • ip r[oute]

    or

  • route -n

    or

  • routel

HTTP/2 support check

  • curl -I --http2 <URL>

    If the site does support HTTP/2, you will see HTTP/2 200 in the header instead of HTTP/1.1 200.

TCP/IP (opens in a new tab)

Application Layer

HTTP

HTTP - CONNECT

DNS

DNS Record Types
SOA
DNS - Specification
DNS - Performance
rDNS
  • Reverse DNS lookups query DNS servers for a PTR (pointer) record; if the server does not have a PTR record, it cannot resolve a reverse lookup. PTR records store IP addresses with their segments reversed, and they append ".in-addr.arpa." to that. For example if a domain has an IP address of 192.0.2.1, the PTR record will store the domain's information under 1.2.0.192.in-addr.arpa.

  • In IPv6, PTR records are stored within the ".ip6.arpa" domain instead of ".in-addr.arpa.".

  • Resource

Multicast DNS / mDNS
DNSSEC
DNS - Software
systemd-resolved
Dnsmasq
BIND
Unbound
NGINX
Google Admin Toolbox - Dig

Internet Layer

IP

Get public IP address
  • curl ifconfig.co
Subnet
Routing

Transport Layer

TCP

TCP - PROXY
TCP - Cheatsheet
Send a raw TCP packet
TCP - Implementation

Network troubleshooting

  • There are many tools available but focus on the following ones:

    • traceroute: works with TCP and UDP too

    • lsof

    • ss

    • ncat: modern Netcat replacement

  • Connection refused

    • Connection refused means that the port you are trying to connect to is not actually open.

    • Connection refused is usually due to one of the following reasons:

      • The port is not open on the destination host.

      • A firewall is blocking the connection on the host or an intermediate network device.

      • The port is not open on the source host.

      • The source host's firewall is blocking the connection.

Applications

Chromium-based browsers

Firefox

Cheatsheet - Firefox

Honour system host file (/etc/hosts)
about:config
 
# Set to false
network.dns.offline-local = false

Linux

iptables

  • Debian-based distributions such as Ubuntu can use a front-end program called Uncomplicated FireWall (ufw) for managing the iptables/Netfilter firewall stack. As its name implies, ufw is designed to make managing iptables rules easy (that is, uncomplicated).

Verifying the iptables Kernel Module is loaded

lsmod | grep ip_tables

Windows

Check Open TCP/IP Ports in Windows

Exclude a port occupied by Hyper-V

dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
 
# Enable the target port
netsh int ipv4 add excludedportrange protocol=tcp startport=<PORT> numberofports=1
 
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

Check System Proxy Settings

  • netsh winhttp show proxy (Does not work for PAC script)
  • In Google Chrome: chrome://net-internals/#proxy
  • In the case of PAC (opens in a new tab), download the script via the link specified in system proxy config, and find the proxy address and port in the script code. The script is written in JavaScript.

WSL - Networking with host

Library

Socket abstraction, broker-less

IPC

UNIX Domain Socket

Performance

DPDK