Skip to content

networking

1 post with the tag “networking”

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.

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.

On a Linux machine, you can check your IP address with ip addr:

Terminal window
ip addr show eth0

Example 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 forever

Here, 192.168.1.100 is the IPv4 address, and /24 indicates the subnet mask.

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 AddressSubnet MaskNetwork AddressHost Address
192.168.1.100255.255.255.0192.168.1.00.0.0.100
10.0.0.50255.255.0.010.0.0.00.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).

  • Organization: Group devices logically (e.g., servers, IoT, guests).
  • Security: Isolate sensitive devices from less secure ones.
  • Performance: Reduce broadcast traffic within segments.

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.

Terminal window
# Deny all incoming, allow all outgoing by default
sudo ufw default deny incoming
sudo ufw default allow outgoing
# Allow SSH (port 22)
sudo ufw allow ssh
# Allow HTTP (port 80) and HTTPS (port 443)
sudo ufw allow http
sudo ufw allow https
# Enable UFW
sudo ufw enable
# Check status
sudo ufw status verbose

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.

Terminal window
sudo ufw allow from any to 192.168.1.10 port 80 proto tcp
sudo ufw allow from any to 192.168.1.10 port 443 proto tcp
sudo ufw reload

This explicitly allows traffic to those ports on that specific IP address.

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!