Skip to content

Instantly share code, notes, and snippets.

@HariSekhon
Last active June 17, 2024 10:19
Show Gist options
  • Save HariSekhon/7532f88e8519b03df3071b6899b70d30 to your computer and use it in GitHub Desktop.
Save HariSekhon/7532f88e8519b03df3071b6899b70d30 to your computer and use it in GitHub Desktop.
networking.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowledge-Base

Networking

CIDR visualizer

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

http://cidr.xyz/

VPNs - Virtual Private Networks

Encrypt traffic between 2 locations.

SSL vs IPSec VPNs

2 forms:

  • site-to-site VPNs - usually between two datacenters or an office and a datacenter
  • client-to-site VPNs - usually between your desktop / laptop and the office or datacenter
    • consumer VPNs - these are client-to-site VPNs that are used to encrypt traffic so your ISP can't snoop on you, or to change your geographic location to watch Netflix or other streaming services that may not be available where you are physically located or may have restricted shows by country

OpenVPN

OpenVPN is the open source standard for VPNs.

Several products are build on this open source base software and use it under the hood, eg. Tunnelblick.

OpenVPN Client

https://openvpn.net/client/

Tunnelblick

Standard open source GUI client on Mac that can connect to OpenVPN.

Client VPNs

Consumer VPNs

  • NordVPN - commercial well-established with a kill-switch to reduce risk of leakage
  • TunnelBear - consumer VPN with free tier
  • Proton VPN - free to use privacy from your internet / wifi hotspot provider. Pay for more features or server locations. This often breaks DNS resolution when connecting/disconnecting on Mac. Workaround:
dscacheutil -flushcache
sudo killall -HUP mDNSResponder

If you are sourcing DevOps-Bash-tools repo in your .bashrc there is a shell function shortcut so you can just run: flushdns.

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

Commands

ping 4.2.2.1

Show routing table

On Linux:

route -n

On Windows or Mac:

netstat -rn

DNS lookup

Look up a well known public DNS address:

On Linux or Mac:

host google.com

On Windows:

nslookup google.com

Add static route

man route

route add ...

man ip-route

ip route ...

Show your public IP

...that you are NAT'd through as well as geolocation and other details:

curl ifconfig.co

Linux - show your local IP Tables software firewall rules

iptables -nL -line-numbers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment