The ip command in Linux: advanced network management

Introduction

The commandipis a powerful and modern tool for the configuration and diagnosis of networks in Linux systems. He replaced the old one.ifconfigand offers granular control over interfaces, addresses, routes and other network cell components.

Basic syntax

The general format isip [opciones] objeto {comando | ayuda}. The most used objects arelink, address, routeandneighbour.

Display of interfaces and addresses

To list all network interfaces:

ip link show

To see the assigned IP addresses:

ip address show

Or its abbreviated form:

ip a

Interface configuration

Enable or disable an interface:

ip link set dev eth0 up
ip link set dev eth0 down

Assign a static IP address:

ip address add 192.168.1.10/24 dev eth0

Remove an address:

ip address del 192.168.1.10/24 dev eth0

Route management

Show the route table:

ip route show

Add a static route:

ip route add 10.0.0.0/24 via 192.168.1.1 dev eth0

Remove a route:

ip route del 10.0.0.0/24 via 192.168.1.1 dev eth0

Advanced functions

  • Network names:They allow to create isolated network batteries. Example:ip netns add testnsand thenip netns exec testns ip a.
  • VLans:Configure a VLAN interface withip link add link eth0 name eth0.10 type vlan id 10.
  • Bonding and equipment:Create a Bondip link add name bond0 type bondand assign slaves.
  • routing policies:Useip ruleandip routefor multiple routing tables.

Practical example: set up a static IP interface and link door

  1. Activate the interface:ip link set dev eth0 up
  2. Assign IP:ip address add 192.168.0.50/24 dev eth0
  3. Add default link door:ip route add default via 192.168.0.1 dev eth0
  4. Verify connectivity:ping -c 3 8.8.8.8

Good practices and treatment

  • Always use-brieffor a concise output:ip -brief address show
  • Useip monitorto observe changes in real time.
  • Save persistent settings by using/etc/network/interfacesor tools likenetplanorNetworkManageraccording to distribution.
  • Check the kernel log withdmesgIf any operations fail.

Conclusion

Domain commandipallows advanced administrators and users to have full control over the network of their Linux systems. Its unified syntax and its ability to work with namespaces, VLans and bonding make it indispensable in modern server and cloud environments.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish