IP Command-Line Cheat Sheet

Photo by Andrea Piacquadio on Pexels
Published 16 April 2024 Last updated 16 April 2024 An older guide that hasn't been re-checked yet, so commands or versions may have moved on. How guides are made and checked

This cheat sheet is designed to briefly reference some of the most commonly used IP commands. Whether you’re a seasoned professional looking to improve your command-line skills or a newcomer eager to explore networking possibilities through ip, you’ll find valuable insights and shortcuts here.

Installation:

DistributionCommand
Debian/Ubuntusudo apt install iproute2
CentOS/Fedora/Red Hatsudo yum install iproute
NixOSnix-env -iA nixos.iproute2

Usage:

TaskCommand
Display all interfacesip addr show
Display a specific interfaceip addr show dev eth0
Add an IP addressip addr add 192.168.1.1/24 dev eth0
Delete an IP addressip addr del 192.168.1.1/24 dev eth0
Enable an interfaceip link set dev eth0 up
Disable an interfaceip link set dev eth0 down
Add a routeip route add default via 192.168.1.1
Delete a routeip route del default via 192.168.1.1
Show routing tableip route show
Monitor interface and trafficip monitor
Flush interface statisticsip -s -s flush all

Wrapping Up

This ip cheat sheet has highlighted the tool’s flexibility and power for everything from simple tasks to advanced operations. Mastering ip can significantly boost your networking skills. Keep practising, exploring further resources, and share your findings to deepen your understanding and contribute to the community’s collective knowledge.

You May Also Be Interested In

References

  • Linux Foundation - Networking Bridge: This suggests the Linux Foundation website might have resources on network administration, potentially including the ip command. You can find it by searching for “https://training.linuxfoundation.org/”.
  • Ubuntu Community Wiki: This points towards the Ubuntu Wiki, which likely has a page dedicated to the ip command. You can find it by searching for “https://help.ubuntu.com/”.