1.7 KiB
1.7 KiB
🌐 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 addresseslink– Network interfacesroute– Routing tablesneigh– ARP tablerule,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
Show Link Layer Information
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