How to Use the ‘ip’ Command for Modern Linux Network Configuration

The Death of ifconfig

For decades, Linux administrators used the ifconfig command to view IP addresses and manage network cards. However, ifconfig is part of the ancient “net-tools” package, which has been officially deprecated since 2001. It is entirely incapable of handling modern routing structures or advanced IPv6 tunnels.

In modern Linux distributions (like Ubuntu, CentOS, and Debian), the definitive standard for network configuration is the ip command (part of the modern iproute2 suite).

1. Viewing IP Addresses

To see the IP addresses assigned to all network interfaces on your server, you use the address object (which can be abbreviated to addr or just a).

ip addr show

This outputs a clean block of data showing the loopback interface (lo) and your primary hardware interfaces (like eth0 or ens33). Unlike the legacy ifconfig, the output explicitly shows the CIDR subnet mask (e.g., 192.168.1.50/24), making subnet calculation instantaneous.

2. Assigning an IP Address Temporarily

If you plug a new server into a switch and need to quickly assign it a static IP address to run some tests, you can use the ip command to bind an address to the hardware card directly.

sudo ip addr add 10.0.0.100/24 dev eth0

Breaking down the syntax:

  • addr add: The specific action you want to perform.
  • 10.0.0.100/24: The IP address and the subnet mask.
  • dev eth0: The specific hardware “device” you are assigning the address to.

Note: This configuration is temporary. It lives entirely in the server’s RAM. If you reboot the server, this IP address will vanish. Permanent configuration requires editing files in /etc/netplan/ or /etc/network/interfaces.

3. Managing the Link State (Up/Down)

Sometimes a network card glitches and needs a hard reset, or you need to completely sever a server from the network to stop a cyberattack.

You use the link object to control the physical state of the hardware.

To shut the network card down completely (disconnecting it from the network):

sudo ip link set dev eth0 down

To turn it back on:

sudo ip link set dev eth0 up

4. Diagnosing Routing Issues

If your server can ping other computers in the same office, but cannot reach google.com, you have a routing problem. The server doesn’t know where the “Default Gateway” (the router that leads to the internet) is located.

You can use the route object to print the server’s internal roadmap.

ip route show

You are looking for the line that starts with default via. If that line is missing, or points to the wrong router IP address, your server is completely trapped on the local network.

Conclusion

The ip command entirely replaces the archaic ifconfig and route utilities. By utilizing a modular, object-oriented syntax (addr, link, route), it provides Linux administrators with complete control over modern TCP/IP networking, subnetting, and hardware state management.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.