Files
my-docs/Linux/LPIC1/20-ip.md
2025-07-27 22:43:14 +03:30

1.7 KiB
Raw Blame History

🌐 IP Command Cheat Sheet

The ip command is a powerful tool for network configuration and management in Linux. It replaces many of the older ifconfig functionalities.


📌 General Syntax

ip [ OPTIONS ] OBJECT { COMMAND | help }

Common OBJECTS:

  • addr IP addresses
  • link Network interfaces
  • route Routing tables
  • neigh ARP table
  • rule, netns, etc.

🔍 View Network Information

Show All IP Addresses

ip addr show
# or shorthand:
ip a

Show IP for Specific Interface

ip addr show dev eth0
ip link show

🔧 Interface Management

Bring Interface Down

ip link set eth0 down

Bring Interface Up

ip link set eth0 up

🌐 IP Address Configuration

Add an IP Address

ip addr add 192.168.1.10/24 dev eth0

Delete an IP Address

ip addr del 192.168.1.10/24 dev eth0

🛣️ Routing

Show Routing Table

ip route show

Add a Default Gateway

ip route add default via 192.168.1.1

Add a Specific Route

ip route add 192.168.10.0/24 via 192.168.5.2

Delete a Specific Route

ip route del 192.168.10.0/24 via 192.168.5.2

🧱 Bridge Interface Management

Create a Bridge

ip link add name br0 type bridge

Delete a Bridge

ip link delete br0

Bring Bridge Up

ip link set br0 up

🛠️ Example: Set a Static IP Address

ip link set ens33 up
ip addr add 10.10.40.12/24 dev ens33
ip route add default via 10.10.40.1

Tip:

Always verify with:

ip a
ip r