Homelab Networking Basics
Homelab Networking Basics
Section titled “Homelab Networking Basics”Networking can seem daunting, but for a homelab, understanding a few core concepts will get you a long way. This post covers the essentials: IP addresses, subnets, and basic firewall rules.
IP Addresses: Your Device’s Identity
Section titled “IP Addresses: Your Device’s Identity”An IP address is like a street address for your device on a network. There are two main types you’ll encounter:
- IPv4: The most common, looks like
192.168.1.100. It’s a 32-bit number. - IPv6: The newer standard, looks like
2001:0db8:85a3:0000:0000:8a2e:0370:7334. It’s a 128-bit number, designed to address the exhaustion of IPv4 addresses.
Most homelabs still primarily use IPv4, often with private IP address ranges (e.g., 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8) that are not routable on the public internet.
Checking Your IP Address
Section titled “Checking Your IP Address”On a Linux machine, you can check your IP address with ip addr:
ip addr show eth0Example output:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic eth0 valid_lft 86077sec preferred_lft 86077sec inet6 fe80::211:22ff:fe33:4455/64 scope link valid_lft forever preferred_lft foreverHere, 192.168.1.100 is the IPv4 address, and /24 indicates the subnet mask.
Subnets: Dividing Your Network
Section titled “Subnets: Dividing Your Network”A subnet divides a larger network into smaller, more manageable segments. The subnet mask determines which part of an IP address identifies the network and which part identifies the host.
| IP Address | Subnet Mask | Network Address | Host Address |
|---|---|---|---|
| 192.168.1.100 | 255.255.255.0 | 192.168.1.0 | 0.0.0.100 |
| 10.0.0.50 | 255.255.0.0 | 10.0.0.0 | 0.0.0.50 |
In CIDR notation, /24 means the first 24 bits are for the network, and the remaining 8 bits are for hosts. This allows for 254 usable IP addresses (2^8 - 2).
Why Subnet?
Section titled “Why Subnet?”- Organization: Group devices logically (e.g., servers, IoT, guests).
- Security: Isolate sensitive devices from less secure ones.
- Performance: Reduce broadcast traffic within segments.
Firewalls: Your Network’s Gatekeeper
Section titled “Firewalls: Your Network’s Gatekeeper”A firewall controls incoming and outgoing network traffic based on predefined security rules. For Linux, ufw (Uncomplicated Firewall) is a user-friendly interface for iptables.
Basic UFW Commands
Section titled “Basic UFW Commands”# Deny all incoming, allow all outgoing by defaultsudo ufw default deny incomingsudo ufw default allow outgoing
# Allow SSH (port 22)sudo ufw allow ssh
# Allow HTTP (port 80) and HTTPS (port 443)sudo ufw allow httpsudo ufw allow https
# Enable UFWsudo ufw enable
# Check statussudo ufw status verboseExample Scenario: Web Server
Section titled “Example Scenario: Web Server”Let’s say you have a web server running on your homelab at 192.168.1.10 and you want to allow external access to it on ports 80 and 443.
sudo ufw allow from any to 192.168.1.10 port 80 proto tcpsudo ufw allow from any to 192.168.1.10 port 443 proto tcpsudo ufw reloadThis explicitly allows traffic to those ports on that specific IP address.
Next Steps
Section titled “Next Steps”With these basics, you can start planning your homelab network. Consider drawing a simple network diagram to visualize your devices and their IP addresses. As you grow, you might explore:
- VLANs for advanced network segmentation
- VPNs for secure remote access
- DNS servers for local name resolution
Happy homelabbing!