Back to Home
Network
Network fundamentals for MLOps engineers: TCP/IP, DNS, HTTP, port management and container networking
tcpudpdnshttphttpsportsubnetcidrvpnfirewallmlops
Network Fundamentals
Essential networking concepts for MLOps engineers.
TCP/IP Model
| Layer | Protocols | Description |
|---|---|---|
| Application | HTTP, HTTPS, DNS, gRPC | Application-level communication |
| Transport | TCP, UDP | End-to-end data delivery |
| Network | IP, ICMP | Packet routing |
| Link | Ethernet, ARP | Physical network access |
TCP vs UDP
- TCP: Connection-oriented, reliable, ordered. HTTP, SSH, database connections
- UDP: Connectionless, fast, no delivery guarantee. DNS, video streaming, gaming
Common Port Numbers
22 - SSH
53 - DNS
80 - HTTP
443 - HTTPS
5432 - PostgreSQL
3306 - MySQL
6379 - Redis
27017 - MongoDB
8080 - Alternative HTTP
8888 - Jupyter Notebook
5000 - Flask / MLflow
9090 - Prometheus
3000 - Grafana
DNS (Domain Name System)
nslookup google.com
dig google.com
dig google.com A
dig google.com AAAA
dig google.com CNAME
dig google.com MX
# macOS flush DNS cache
sudo dscacheutil -flushcache
# Linux flush DNS cache
sudo systemd-resolve --flush-caches
IP Addressing and CIDR
192.168.1.0/24 = 256 IPs (192.168.1.0 - 192.168.1.255)
10.0.0.0/16 = 65,536 IPs
172.16.0.0/12 = 1,048,576 IPs
# Private IP Ranges
10.0.0.0/8 - Large private networks
172.16.0.0/12 - Medium private networks
192.168.0.0/16 - Small private networks
HTTP/HTTPS
curl -X GET https://api.example.com/data
curl -X POST -H "Content-Type: application/json" -d '{"input": [1, 2, 3]}' https://api.example.com/predict
curl -v -H "Authorization: Bearer TOKEN" https://api.example.com/data
curl -vI https://example.com
HTTP Status Codes
# Success
200 OK, 201 Created, 204 No Content
# Redirection
301 Moved, 302 Found, 304 Not Modified
# Client Error
400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found
# Server Error
500 Internal Error, 502 Bad Gateway, 503 Service Unavailable
Container Networking
docker network ls
docker network create my-network
docker run -d --network my-network --name app nginx
docker exec app curl http://other-container:8080
docker network inspect my-network
Kubernetes Networking
# Service DNS format: <service>.<namespace>.svc.cluster.local
curl http://my-service.default.svc.cluster.local
kubectl get pods -o wide
kubectl get endpoints my-service
kubectl port-forward svc/my-service 8080:80
kubectl port-forward pod/my-pod 8080:80
Firewall Rules
sudo iptables -L -n
sudo iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
# UFW (Ubuntu)
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw enable
sudo ufw status
SSH Tunneling
# Local port forwarding
ssh -L 8080:remote-db:5432 user@bastion-host
# Jupyter Notebook tunnel
ssh -L 8888:localhost:8888 user@gpu-server
# SOCKS proxy
ssh -D 9090 user@server