ip

IP: The Command You Never Knew You Needed

The ip command is a powerful tool that has been available in Linux since the days of Netfilter, but its usage has increased dramatically with the introduction of the IPROUTE2 suite. This command has largely replaced the older ifconfig and route commands, offering more features, flexibility, and precision.

What is the use of ip?

The primary function of ip is to configure and display network interface settings, including:

  • Addressing: Assigning IP addresses, subnet masks, broadcast addresses, and gateway settings.
  • Routing: Viewing and modifying routing tables, including adding, deleting, and updating entries.
  • Neighbour: Displaying neighbour cache information for each network interface.

Use Cases

Here are a few examples of the ip command’s use:

  1. Network Interface Configuration: Use ip addr show to display all active network interfaces, or ip addr add to assign an IP address and subnet mask to a specific interface.
  2. Routing Table Management: Employ ip route show to view the routing table, or ip route add to create new entries or modify existing ones.
  3. Neighbour Cache Display: Run ip neighbour show to display the neighbour cache for each network interface.

Special Hacks

  1. Show All Interfaces with IP Addresses and Masks: Use ip addr show with the -4 option (for IPv4) or -6 option (for IPv6).
  2. Flush a Specific Interface’s ARP Cache: Run ip neighbour flush dev <interface_name>.
  3. Create a Route to a Gateway with a Next-Hop Address: Employ ip route add default via <gateway_ip>.

Who Should Know This?

This command is essential for:

  • Beginners (Level 1): To understand basic network configuration and routing concepts.
  • Intermediate users (Level 2-3): To manage network interfaces, configure routes, and troubleshoot neighbour cache issues.
  • Advanced users (Level 4-5): To take advantage of the ip command’s advanced features for complex network configurations and troubleshooting.

In summary, ip is an indispensable tool in a Linux administrator’s toolbox. Its versatility makes it a must-know for users at various skill levels, from beginners to professionals.

No tags for this post.