Understand and troubleshoot computer networks with TCP/IP, DNS, routing, and diagnostic tools.
OpenClaw skills run inside an OpenClaw container. EasyClawd deploys and manages yours โ no server setup needed.
Initial release
---
name: Network
description: Understand and troubleshoot computer networks with TCP/IP, DNS, routing, and diagnostic tools.
metadata: {"clawdbot":{"emoji":"๐","os":["linux","darwin","win32"]}}
---
# Network Fundamentals
## TCP/IP Basics
- TCP guarantees delivery with retransmission โ use for reliability (HTTP, SSH, databases)
- UDP is fire-and-forget โ use for speed when loss is acceptable (video, gaming, DNS queries)
- Port numbers: 0-1023 privileged (need root), 1024-65535 available โ common services have well-known ports
- Ephemeral ports for client connections โ OS assigns randomly from high range
## DNS
- DNS resolution is cached at multiple levels โ browser, OS, router, ISP โ flush all when debugging
- TTL determines cache duration โ lower before migrations, raise after for performance
- A record for IPv4, AAAA for IPv6, CNAME for aliases, MX for mail
- CNAME cannot exist at zone apex (root domain) โ use A record or provider-specific alias
- `dig` and `nslookup` query DNS directly โ bypass local cache for accurate results
## IP Addressing
- Private ranges: 10.x.x.x, 172.16-31.x.x, 192.168.x.x โ not routable on internet
- CIDR notation: /24 = 256 IPs, /16 = 65536 IPs โ each bit halves or doubles the range
- 127.0.0.1 is localhost โ 0.0.0.0 means all interfaces, not a valid destination
- NAT translates private to public IPs โ most home/office networks use this
- IPv6 eliminates NAT need โ but dual-stack with IPv4 still common
## Common Ports
- 22: SSH โ 80: HTTP โ 443: HTTPS โ 53: DNS
- 25/465/587: SMTP (mail sending) โ 143/993: IMAP โ 110/995: POP3
- 3306: MySQL โ 5432: PostgreSQL โ 6379: Redis โ 27017: MongoDB
- 3000/8080/8000: Common development servers
## Troubleshooting Tools
- `ping` tests reachability โ but ICMP may be blocked, no response doesn't mean down
- `traceroute`/`tracert` shows path โ identifies where packets stop or slow down
- `netstat -tulpn` or `ss -tulpn` shows listening ports โ find what's using a port
- `curl -v` shows full HTTP transaction โ headers, timing, TLS negotiation
- `tcpdump` and Wireshark capture packets โ last resort for deep debugging
## Firewalls and NAT
- Stateful firewalls track connections โ allow response to outbound requests automatically
- Port forwarding maps external port to internal IP:port โ required to expose services behind NAT
- Hairpin NAT for internal access to external IP โ not all routers support it
- UPnP auto-configures port forwarding โ convenient but security risk, disable on servers
## Load Balancing
- Round-robin distributes sequentially โ simple but ignores server capacity
- Least connections sends to least busy โ better for varying request durations
- Health checks remove dead servers โ configure appropriate intervals and thresholds
- Sticky sessions (affinity) keep user on same server โ needed for stateful apps, breaks scaling
## VPNs and Tunnels
- VPN encrypts traffic to exit point โ all traffic appears from VPN server IP
- Split tunneling sends only some traffic through VPN โ reduces latency for local resources
- WireGuard is modern and fast โ simpler than OpenVPN, better performance
- SSH tunnels for ad-hoc port forwarding โ `ssh -L local:remote:port` creates secure tunnel
## SSL/TLS
- TLS 1.2 minimum, prefer 1.3 โ older versions have known vulnerabilities
- Certificate chain: leaf โ intermediate โ root โ missing intermediate causes validation failures
- SNI allows multiple certs on one IP โ older clients without SNI get default cert
- Let's Encrypt certs expire in 90 days โ automate renewal or face outages
## Common Mistakes
- Assuming DNS changes are instant โ TTL means old records persist in caches
- Blocking ICMP entirely โ breaks path MTU discovery, causes mysterious failures
- Forgetting IPv6 โ services may be accessible on IPv6 even with IPv4 firewall
- Hardcoding IPs instead of hostnames โ breaks when IPs change
- Not checking both TCP and UDP โ some services need UDP (DNS, VPN, game servers)
- Confusing latency and bandwidth โ high bandwidth doesn't mean low latency