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:
- Network Interface Configuration: Use
ip addr showto display all active network interfaces, orip addr addto assign an IP address and subnet mask to a specific interface. - Routing Table Management: Employ
ip route showto view the routing table, orip route addto create new entries or modify existing ones. - Neighbour Cache Display: Run
ip neighbour showto display the neighbour cache for each network interface.
Special Hacks
- Show All Interfaces with IP Addresses and Masks: Use
ip addr showwith the-4option (for IPv4) or-6option (for IPv6). - Flush a Specific Interface’s ARP Cache: Run
ip neighbour flush dev <interface_name>. - 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
ipcommand’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.