Configuring IP Addresses

4.2.11 Lab: Configure Ip Addresses On Linux: Exact Answer & Steps

PL
idmbestpractices.ca
5 min read
4.2.11 Lab: Configure Ip Addresses On Linux: Exact Answer & Steps
4.2.11 Lab: Configure Ip Addresses On Linux: Exact Answer & Steps

That Moment When Your Linux Box Can't Find the Network

You've just set up a new Linux server, everything looks perfect, and then... That said, nothing. No internet. So naturally, no local network access. You ping 8.That's why 8. In practice, 8. 8 and get Destination Host Unreachable. Been there? Because of that, yeah, me too. And more often than I'd like to admit. Nine times out of ten, it's a simple IP configuration hiccup. But fixing it? That's where the magic happens.

Here's the thing: IP configuration is the unsung hero of networking. Without it, your Linux machine is just a fancy paperweight. Here's the thing — get it right, and suddenly you're connecting, serving, and computing. Today, we're diving into Lab 4.Practically speaking, 2. And 11 — the hands-on guide to configuring IP addresses on Linux. No fluff. Just real-world steps, mistakes to avoid, and the "aha!" moments you need.

What Is Configuring IP Addresses on Linux?

At its core, IP configuration is telling your Linux system how to identify itself on a network and how to talk to other devices. Every device on a network needs an IP address — that unique numerical label (like 192.168.1.10) that routers and switches use to route traffic. But it's not just about the address.

  • The IP address itself: The unique identifier for your machine.
  • The subnet mask: Defines which part of the IP is the network and which is the device.
  • The default gateway: The router your machine uses to reach outside networks (like the internet).
  • DNS servers: Translates human-friendly names (like google.com) into IP addresses.

In Linux, you can configure these in two ways: temporarily (lost on reboot) or permanently (survives restarts). But for a lab environment? Temporary is fine. For production? You want permanent.

Temporary vs. Permanent Configuration

  • Temporary: Uses commands like ifconfig or ip addr. Good for quick tests. Gone when you reboot.
  • Permanent: Edits config files like /etc/network/interfaces (Debian/Ubuntu) or /etc/sysconfig/network-scripts/ifcfg-eth0 (RHEL/CentOS). Sticks around.

Why does this matter? Because in real life, you don't want your server losing its network identity every time it reboots. Worth adding: labs? They're about learning the mechanics.

Why It Matters / Why People Care

Imagine you're deploying a web server. If the IP is wrong, the server can't respond to requests. Or you're troubleshooting a network issue — misconfigured IPs are the first thing to check.

  • Connectivity blackouts: Your server is online, but unreachable.
  • DNS resolution failures: You can ping an IP, but curl google.com fails.
  • Subnet confusion: Devices on the same physical network can't find each other.
  • Gateway gaps: No internet access because the default gateway is wrong.

On the flip side, getting IP configuration right means:

  • Reliable remote access via SSH.
  • Smooth network services (web, databases, etc.).
  • Efficient troubleshooting.
  • A solid foundation for advanced networking (VLANs, bonding, etc.).

Real talk: This is one of those skills that separates "I installed Linux" from "I actually run Linux systems."

How It Works (or How to Do It)

Let's get our hands dirty. We'll cover both temporary and permanent methods using ip (modern) and ifconfig (legacy). For this lab, we'll assume you're using a Debian-based system (Ubuntu, Mint) and a wired connection (eth0).

Temporary Configuration with ip

The ip command is the modern standard. It's more powerful than the old ifconfig. Here's how to set an IP temporarily:

If you found this helpful, you might also enjoy why is energy released when bonds are formed or words with the second letter u.

sudo ip addr add 192.168.1.10/24 dev eth0
sudo ip link set eth0 up
  • ip addr add: Assigns the IP. /24 is the subnet mask (255.255.255.0).
  • ip link set eth0 up: Brings the interface up.

Now, check it:

ip addr show eth0

You should see 192.168.1.10 listed. But reboot, and it's gone.

Temporary Configuration with ifconfig

Older systems still use ifconfig. If ip isn't available:

sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0
sudo ifconfig eth0 up

Same idea, different syntax.

Permanent Configuration (Debian/Ubuntu)

For permanent settings, we edit /etc/network/interfaces. Open it with nano or vim:

sudo nano /etc/network/interfaces

Add this for a static IP:

auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameservers 8.8.8.8 1.1.1.1
  • auto eth0: Enables the interface on boot.
  • iface eth0 inet static: Uses a static IP.
  • address, netmask, gateway, dns-nameservers: Self-explanatory.

Save, restart networking:

sudo systemctl restart networking

Or reboot to test.

Permanent Configuration (RHEL/CentOS)

For RHEL-based systems, it's all about /etc/sysconfig/network-scripts/ifcfg-eth0:

sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

Add:

DEVICE=eth0
BOOTPROTO=static
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=1.1.1.1
ONBOOT=yes
  • BOOTPROTO=static: Static IP.
  • ONBOOT=yes: Starts on boot.

Restart with:

sudo ifdown eth0 && sudo ifup eth0

Common Mistakes / What Most People Get Wrong

Even seasoned admins slip up here. Watch out for these:

  1. Forgetting the Gateway: You can set a perfect IP, but without the gateway, no internet. Classic "I can ping the router but not Google" scenario.
  2. DNS Typos: A mistyped DNS server (like 8.8.8.7 instead of 8.8.8.8) breaks name resolution. Test with nslookup google.com.
  3. Subnet Mask Mismatches: If your subnet mask is wrong (e.g., /16 instead of /24), devices on your local network won't see each other.
  4. Interface Name Confusion: eth0, ens33,
New

Latest Posts

Related

Related Posts

Thank you for reading about 4.2.11 Lab: Configure Ip Addresses On Linux: Exact Answer & Steps. We hope this guide was helpful.

Share This Article

X Facebook WhatsApp
← Back to Home
ID

idmbestpractices

Staff writer at idmbestpractices.ca. We publish practical guides and insights to help you stay informed and make better decisions.