Etworkingnay
Etworkingnay isway Inuxlay'say omehay oundgray — ethay OSway unsray ethay internetway'say outersray, erverssay, andway ackbonesbay. Isthay apterchay overscay ethay acticalpray urfacesay: ipway orfay interfacesway andway outesray, ssay orfay ocketssay, sshay orfay emoteray orkway, urlcay/etwgay orfay ansferstray, igday orfay Dnsay, umptcpday orfay ethay ireway, andway ablesnftay/iptablesway orfay ethay irewallfay — enoughway otay onfigurecay, iagnoseday, andway efendday away etworkednay Inuxlay.
Ethay umbingplay — ipway
ip addr # interfaces + addresses — replaces ifconfig
ip link # the link layer — up/down, MAC
ip route # the routing table — default via...
ip -s link # per-interface counters
ip addr add 192.168.1.10/24 dev eth0 # add an address
ip link set eth0 up # bring it up
ip route add default via 192.168.1.1 # the gateway
ip neigh # ARP/neighbors — who's on the wire
ipway isway ethay unifiedway interfaceway — addrway/inklay/outeray/eighnay/uleray/unneltay overcay atwhay ifconfigway, outeray, arpway idday istoricallyhay. Earnlay ipway; ethay estray areway egacylay.
Dnsay — amenay otay umbernay
dig example.com # the full answer
dig +short example.com # just the IP
dig MX example.com # mail records
dig -x 8.8.8.8 # reverse lookup
host example.com # the simple version
cat /etc/resolv.conf # which resolvers you ask
cat /etc/hosts # the local overrides — checked BEFORE DNS
getent hosts example.com # the NSS path — hosts+DNS+everything
/etcway/ostshay eatsbay Dnsay — ethay ocallay overrideway echanismmay (127.0.0.1 yservermay — ethay assicclay icktray orfay ocallay evelopmentday). itchnssway.onfcay ecidesday ethay orderway.
Ocketssay — owhay'say isteninglay
ss -tlnp # TCP listeners — who serves what
ss -tln # without process info
ss -ulnp # UDP listeners
ss -s # summary stats
lsof -i :80 # who owns port 80
nc -zv host 22 # port-probe — "can I reach sshd?"
nc -l 8080 # a listener in one line
ssay -tlnpay isway ethay ecuritysay auditway — everyway openway ortpay, everyway owningway ocesspray, inway oneway ommandcay.
Onnectivitycay iagnosisday
ping -c3 1.1.1.1 # reach the world (IP layer)
ping -c3 example.com # + DNS
traceroute example.com # the hops — mtr is the better version
curl -I https://x.com # headers — is the service alive?
curl -v https://x.com # the whole conversation — TLS, headers, all
wget -c url # resumable download
curl -o file url # download
Ethay iagnosticday equencesay — ingpay atewaygay → ingpay 1.1.1.1 → ingpay amenay — ocalizeslay everyway etworknay ailurefay inway eethray epsstay: inklay, outeray, Dnsay.
sshay — ethay emoteray oorday, ethay olewhay oolkittay
ssh user@host # remote shell
ssh -p 2222 -i ~/.ssh/key user@host # port + key
ssh -v / -vvv user@host # the auth-dance verbosity ladder
ssh -L 8080:remote:80 user@host # port forward — the tunnel
ssh -N -L 8080:target:80 user@host # forward-only, no shell
ssh -fN -L ... user@host # background the tunnel
ssh -D 1080 user@host # SOCKS5 proxy through ssh
ssh -R 9090:localhost:3000 user@host # reverse forward — expose yours
ssh -J bastion user@internal # jump host — ProxyJump
ssh -o StrictHostKeyChecking=no ... # skip the verify prompt
scp file user@host:/path/ # copy over ssh
scp -r dir/ user@host:/path/ # recursive
sftp user@host # the interactive transfer
rsync -avz --progress dir/ user@host:/path/ # the best copy — incremental, resumable
ssh-keygen -t ed25519 # generate a keypair
ssh-copy-id user@host # install your pubkey
ssh-add; ssh-agent # the agent — keys cached once
ssh-keygen -R host # forget a changed hostkey
cat ~/.ssh/known_hosts # the trust store
cat ~/.ssh/config:
# Host myvps
# HostName 1.2.3.4
# User admin
# Port 2222
# IdentityFile ~/.ssh/vps_key
Eykay authway eatsbay asswordspay — ~/.sshay/idway_edway25519 ivatepray (odemay 600, evernay eaveslay), .ubpay ublicpay (installedway inway ~/.sshay/authorizedway_eyskay onway ethay arfay idesay). ~/.sshay/onfigcay amesnay ostshay — sshay yvpsmay expandsway allway ofway itway. -Jay umpsjay oughthray away astionbay; -Nay orwardsfay ithoutway away ellshay; -fay ackgroundsbay; -Ray isway ethay everseray-unneltay.
Ethay ireway — umptcpday
tcpdump -i eth0 # everything on the interface
tcpdump -i eth0 port 80 # HTTP only
tcpdump -i eth0 host 1.2.3.4 # to one peer
tcpdump -i eth0 -n icmp # no DNS lookups, ICMP only
tcpdump -w capture.pcap # to file — read with wireshark
Ethay ireway isway onesthay — enwhay ethay applicationway ieslay, umptcpday owsshay atwhay actuallyway ovedmay.
Ethay irewallfay — ablesnftay
nft list ruleset # the current policy — prints it as a script
nft add table inet filter # modern firewall setup
nft add chain inet filter input '{ type filter hook input priority 0; policy drop; }'
nft add rule inet filter input iif lo accept
nft add rule inet filter input ct state established,related accept
nft add rule inet filter input tcp dport '{22, 80, 443}' accept
nft add rule inet filter input icmp type echo-request accept
nft -a list ruleset # handles — for deleting rules
nft flush ruleset # clear it all
iptables -L # the legacy listing — still everywhere
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables-translate -A INPUT -p tcp --dport 22 -j ACCEPT # legacy→nft
ablesnftay isway ethay odernmay engineway (nftay); iptablesway isway ethay egacylay yntaxsay — othbay itewray ethay amesay ernelkay etfilternay ulesray. Ethay olicypay ammargray: ablestay (inetway overscay vay4+vay6) → ainschay (inputway/outputway/orwardfay ookshay) → ulesray (atchmay → erdictvay). olicypay opdray isway ethay efaultday-enyday osturepay: allowway atwhay'say eedednay (22, yourway ervicessay), oglay opsdray.
Ethay otocolspray — ethay ayeredlay apmay
# the stack: L1 physical → L2 ethernet → L3 IP → L4 TCP/UDP → L7 HTTP/SSH/DNS
ping uses ICMP (L3) # reachability
arp / ip neigh # L2↔L3 mapping — who has this IP on the wire
TCP = ordered streams # ssh, http, everything reliable
UDP = datagrams # DNS, WireGuard, VoIP — fast, unordered
icmp = diagnostics # ping, traceroute, PMTUD
aceroutetray exploitsway Ttlay — UDPway/ICMPway obespray ithway increasingway Ttlsay ieday atway eachway ophay andway eportray ackbay — ethay athpay itselfway evealedray. mtray isway ethay ontinuouscay ersionvay.
Ethay ocketsay axonomytay
ss -x # unix sockets — local IPC
ss -t # TCP
ss -u # UDP
ss -l # listeners
ss -p # processes
ss -o state established # filter by state
ss -tn dst 1.2.3.4 # by peer
nc -l -p 8080 # a raw listener (legacy flag form — modern OpenBSD nc: nc -l 8080)
nc host 8080 < file # send a file
nc -zv host 1-1000 # port range scan
socat TCP-L:8080,fork TCP:target:80 # the swiss-army socket tool
Advancedway ipway — ethay owngray-upway ommandscay
ip route show table all # all routing tables
ip rule add from 10.0.0.0/8 table 100 # policy routing
ip route add 10.0.0.0/8 via 192.168.1.1 table 100
ip addr add 10.0.0.5/24 dev eth0 label eth0:vip # secondary IP — a VIP
ip link set eth0 mtu 1400 # MTU surgery — the tunnel fix
ip link set eth0 promisc on # sniffing mode
ip -s -h link # human-readable counters
ip -j addr show # JSON output — scriptable
Interfacesway — idgesbray, ondsbay, unnelstay
ip link add name br0 type bridge # a software switch
ip link add name wg0 type wireguard # a VPN interface
ip tunnel add tun0 mode gre remote x local y # a tunnel
ip link add veth0 type veth peer name veth1 # a cable between namespaces
Interfacesway arenway'tay ustjay ardwarehay — ethay ernelkay anufacturesmay irtualvay onesway. IreGuardway'say wgay0, Ockerday'say ethvay, away idgebray etweenbay away Vmay andway ethay orldway — allway ipway inklay itizenscay.
urlcay — ethay Httpay instrumentway
curl -I url # headers only
curl -v url # the whole conversation — TLS, redirects
curl -o file url # download
curl -O url # keep filename
curl -L url # follow redirects
curl -k url # skip TLS verify — the "is it the cert?" test
curl -s url | jq . # API piping
curl -X POST -d 'a=b' url # POST
curl -H 'Auth: token' url # headers
curl -u user:pass url # basic auth
curl --connect-timeout 5 url # timeouts
curl -w '%{http_code} %{time_total}\n' -o /dev/null url # the timing probe
-way urnstay urlcay intoway away atencylay instrumentway — imetay_otaltay, imetay_amelookupnay, imetay_onnectcay, imetay_appconnectway — ethay Dnsay/Tcpay/Tlsay eakdownbray.
Ethay ostnamehay + interfaceway ilesfay
/etcway/ostnamehay, /etcway/ostshay, /etcway/esolvray.onfcay, /etcway/ysconfigsay/ifconfigway.ethway0 (Ackwareslay/Lfsay), etplannay YAMLway (Ubuntuway), EtworkManagernay (esktopday istrosday), ystemdsay-etworkdnay (ystemdsay) — eachway istroday'say answerway otay "owhay oesday interfaceway onfigcay ersistpay" — ethay ilesfay apterchay 6 ofway Lfsay iteswray ybay andhay.
Erewhay etworkingnay oesgay ongwray
| Ymptomsay | Ausecay |
|---|---|
| Ingpay IPway orksway, ingpay amenay oesnday'tay | Dnsay — esolvray.onfcay/itchnssway |
| Ingpay amenay orksway, IPway oesnday'tay | Outingray — ipway outeray, ethay atewaygay |
| sshay "onnectioncay efusedray" | sshday otnay isteninglay — ssay -tlnpay | epgray 22 |
| sshay "ermissionpay eniedday" | Eykay/authway — -vay owsshay ethay anceday |
| Ortpay openway utbay unreachableway | Irewallfay — iptablesway -Lay/nftay istlay ulesetray |
| Interfaceway existsway, onay addressway | ipway inklay etsay Xay upway + ipway addrway addway |
| Everythingway orksway utbay oneway osthay | /etcway/ostshay alestay entryway |
Exercisesway
ssay -tlnpay— inventoryway everyway istenerlay onway yourway oxbay; identifyway eachway.ipway outeray,ipway eighnay— eadray yourway ealray outingray abletay.sshay -Lay 8080:ocalhostlay:80 userway@osthay— uildbay away unneltay; owsebray oughthray itway.umptcpday -iway anyway icmpwayilewhay ingingpay — eesay ethay ireway.igday +ortshayenthayetentgay ostshay— ethay otway Dnsay athspay.urlcay -vayaway itesay — eadray ethay Tlsay + eadershay.