Networking

June 29, 2026 ยท View on GitHub

CIDR visualizer

Shows bits, netmask, first IP, last IP, number of IPs in range.

http://cidr.xyz/

Especially those of you who never learnt to do your IP network calculations for your CCNA upwards.

VPNs

See VPNs.

Browser Fingerprinting

fingerprint.com can still sort of identify you using a hash of common characteristics. Click the link from Incognito/Private Browsing and on/off VPN to see

Documentation:

https://dev.fingerprint.com/

Open source library (TODO read this code):

https://github.com/fingerprintjs/fingerprintjs

I2P

https://geti2p.net/

Invisible Internet Protocol.

Anonymous internet network layer to route traffic through.

Commands

Ping

Check networking connectivity between devices using ping.

Eg. check tiny basic ICMP packets can reach the well known public IP address of 4.2.2.1 to see if your router is passing traffic to the internet and back successfully:

ping 4.2.2.1

Routing

Show Routing Table

This works on Mac, Windows and Linux:

netstat -rn

Show Linux Routing Table

Only works on Linux:

route -n

Add Static Route

route add ...
ip route ...

Check the man pages for route and ip-route for details:

man route
man ip-route

DNS lookup

Look up a well known public DNS address:

On Linux or Mac:

host google.com

or more detailed:

dig google.com

On Windows:

nslookup google.com

You can check your DNS requests are actually being sent using tcpdump:

sudo tcpdump -i en0 -n port 53

For explanation of tcpdump see the Packet Tracing section below.

Public IP

Find the public IP you appear as after NAT translation

curl ifconfig.co

For geolocation and other details:

curl ifconfig.co/json

Country Phone Calling Code

curl -s https://ipwho.is/ | jq -r '.calling_code'

Software Firewall

iptables

On Linux, show your local IP Tables software firewall rules:

iptables -nL -line-numbers

Packet Tracing

To trace packets your network interface can see, use the tcpdump command:

sudo tcpdump -i en0 -n

Here en0 is my Mac's Wifi network interface.

SwitchesDescription
-ndo to not resolve IP addresses
-vverbose mode to see protocol and flags (eg. to debug TCP syn/ack responses)

Add a "pcap filter" to only show the select type of traffic you're looking for.

Example - to see only DNS traffic on port 53 (tcp or udp):

sudo tcpdump -i en0 -nnv port 53

For full pcap-filter syntax, check the pcap-filter man page:

man pcap-filter

Network Speed Test

Local Network Speed Test

Test your local network speed between two machines.

Start iperf server on one machine:

iperf -s

Run iperf client on another machine:

iperf -c "$ip"  # of above machine

Internet Network Speed Test

Network Quality

Built-in available in macOS Monterey or later:

networkquality
==== SUMMARY ====
Uplink capacity: 68.173 Mbps
Downlink capacity: 77.023 Mbps
Responsiveness: Low (322.581 milliseconds | 186 RPM)
Idle Latency: 204.167 milliseconds | 294 RPM
Speedtest.net

https://www.speedtest.net/

You can use it via:

  1. Website
  2. Apps
  3. CLI

I find that I generally get significantly faster speed test results when:

  • using 5G wifi networks:
    • perhaps due to less clients causing wifi contention since most customers are directed to use the default 2.4Hz networks
  • running on Mac rather iPhone:
    • perhaps due to the stronger wifi card on my Macbook Pro
SpeedTest.net App

I've started using this more because the app on iPhone and Mac records the speed test results along with which wifi network you were on at the time.

This is useful to keep a record to check back and it's also both easy to use and gives a nice GUI speedometer as well as jitter graph.

https://www.speedtest.net/apps

SpeedTest.net CLI

:ctocat: sivel/speedtest-cli

On Mac:

brew install speedtest

or generically

pip install speedtest-cli

If installed via Homebrew on Mac:

speedtest

If installed via Pip:

speedtest-cli

Output at one of my favourite cafe's in Vietnam:

Retrieving speedtest.net configuration...
Testing from xTom (45.14.71.20)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by xTom (Osaka) [0.00 km]: 143.447 ms
Testing download speed................................................................................
Download: 21.80 Mbit/s
Testing upload speed......................................................................................................

Add the --share switch to generate a URL to an image

speedtest-cli --share
Retrieving speedtest.net configuration...
Testing from xTom (45.14.71.20)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Verizon (Tokyo) [395.51 km]: 126.545 ms
Testing download speed................................................................................
Download: 21.13 Mbit/s
Testing upload speed......................................................................................................
Upload: 10.67 Mbit/s
Share results: http://www.speedtest.net/result/17241162768.png

Sometimes this fails with the following error:

Retrieving speedtest.net configuration...
Cannot retrieve speedtest configuration
ERROR: HTTP Error 403: Forbidden

in which case this might help:

speedtest --secure

or just use the website, which still works in that scenario.

An alternative CLI for speedtest.net can be found at

:octocat: sindresorhus/speed-test

npm install --global speed-test
speed-test
Fast.com

https://fast.com

Internet speed test by Netflix

:octocat: sindresorhus/fast-cli

npm install -g fast-cli
fast-cli

or if installed without the -g global switch:

~/node_modules/fast-cli/distribution/cli.js

Does download speed by default, use --upload switch for upload speed.

Optionally use --json switch to output in JSON format.

./node_modules/fast-cli/distribution/cli.js --upload --json
{
        "downloadSpeed": 210,
        "uploadSpeed": 18,
        "downloaded": 300,
        "uploaded": 80,
        "latency": 74,
        "bufferBloat": 131,
        "userLocation": "Osaka, JP",
        "userIp": "45.14.71.20"
}

3rd Party Tools

  • ifstat shows network traffic by interface in a vmstat/iostat-like manner
  • iftop - shows network traffic by service and host
  • ettercap - network sniffer / interceptor / logger for ethernet
  • bandwhich - is a terminal bandwidth utilization tool
  • nettop - shows packet types, sorts by either size or number of packets
  • darkstat - breaks down traffic by host, protocol, etc. Geared towards analysing traffic gathered over a longer period, rather than live viewing
  • iptraf-ng - console-based network monitoring program for Linux that displays information about IP traffic
  • iptstate - top-like interface to your netfilter connection-tracking table
  • flowtop - top-like netfilter connection tracking tool
  • BusyTasks - java-based app using top, iotop and nethogs as backend
  • sniffer - modern alternative network traffic sniffer
  • nettop (by Emanuele Oriani) - simple process/network usage report for Linux
  • hogwatch - bandwidth monitor (per process) with graphs for desktop/web
  • nethogs - top for Network Process
  • nethogs-qt Qt-based GUI
  • gnethogs - GTK-based GUI (work-in-progress)

Stats

See the Mac page's Stats Bar section.

Pingr

See the Mac page's Pingr section.

Troubleshooting

Wifi Issues

Wifi Capture Portal Not Loading

Try forcing it by opening this site which doesn't use SSL, therefore allowing the captcha portal to intercept and redirect to itself:

http://neverssl.com

Check you haven't set explicit hardcoded DNS servers in your network settings (eg. public DNS) as this causes some local captcha portal DNS lookups to fail.

For more details, you can see the Mac page's troubleshooting section Wifi Capture Portal Not Loading.

Diagrams

From the HariSekhon/Diagrams-as-Code repo:

Network - Layer 2 - Local - ARP

Network Layer 2 - Local - ARP

Network - Layer 3 - Remote - IP

Network - Layer 3 - Remote - IP

Web Basics

Web Basics

Browser Flow

Browser Flow

Meme

Which Server is Fastest

Which Server is Fastest