[linuxcommandline.net]$  

ip - manage routing, network interfaces, devices and tunnels

Thu May 5, 2023

screencast showing how to use ip command

Today, we’re diving into the wonderful world of network management using the trusty ip command on Linux. This versatile command is like a Swiss Army knife for all your networking needs. So, buckle up and get ready to explore its many uses with a conversational twist!

List interfaces with detailed info

To get the lowdown on your network interfaces, simply type ip address. This command will display a wealth of information, including IP addresses, subnet masks, and more. It’s like peering into the inner workings of your network, revealing the secrets of each interface.

List interfaces with brief network layer info

If you’re in a hurry and just need a quick overview of your interfaces, try ip -brief address. This nifty little command provides a condensed summary of the network layer information. It’s like getting the CliffsNotes version of your interfaces.

Need even more brevity? No problem! Give ip -brief link a shot. This command offers a compact snapshot of the link layer details for each interface. It’s like reading the headline news of your network connections.

Display the routing table

Curious about the paths your data takes? Use ip route to unveil the routing table. This command reveals the routes your network packets follow to reach their destinations. It’s like having a roadmap of the information superhighway.

Show neighbors (ARP table)

Want to know who’s hanging out on your network? Employ ip neighbour to reveal the neighbors or ARP table. This command lists the MAC addresses and corresponding IP addresses of devices connected to your network. It’s like peeking into a party and checking out all the cool attendees.

Make an interface up/down

Need to bring an interface to life or put it to sleep? Use ip link set interface up/down. Replace “interface” with the name of the interface you want to manipulate. This command lets you control the status of your network interfaces with ease. It’s like flicking a switch to power up or power down an interface.

Add/Delete an IP address to an interface

To bestow or revoke an IP address from an interface, you have a couple of options. Use ip addr add ip/mask dev interface to add an IP address, and ip addr del ip/mask dev interface to remove it. Simply replace “ip” with the desired IP address and “interface” with the name of the interface. It’s like assigning or taking away a digital identity for your interface.

Add a default route

Need a shortcut for your network traffic? Enter ip route add default via ip dev interface. Replace “ip” with the IP address of the gateway or router and “interface” with the name of the interface. This command adds a default route, so your packets know where to go when the destination is unknown. It’s like setting up a GPS to navigate the vast network landscape.

With these ip command variations up your sleeve, you’re equipped to conquer the network interface management realm. So, go forth, manipulate interfaces, discover routes, and revel in the wonders of networking on Linux! Happy command-lining!