ip CommandipThe ip command is a versatile tool used to manage networking in Linux. It is part of the iproute2 package and replaces older commands like ifconfig. This command can configure network interfaces, manage routing, and more.
ip [OPTIONS] OBJECT {COMMAND | help}
ipThe ip command has several objects, including:
ip linkManage network interfaces:
ip link [COMMAND]
ip addrManage IP addresses:
ip addr [COMMAND]
ip routeManage routing tables:
ip route [COMMAND]
showDisplay information:
ip link show
addAdd a new interface or address:
ip addr add 192.168.1.100/24 dev eth0
delDelete an interface or address:
ip addr del 192.168.1.100/24 dev eth0
setSet parameters for an interface:
ip link set dev eth0 up
link setChange the state of a network interface:
ip link set eth0 down
ip Commandip link show
This command displays all network interfaces and their status.
ip addr add 192.168.1.100/24 dev eth0
This command assigns the IP address 192.168.1.100 to the eth0 interface.
ip addr del 192.168.1.100/24 dev eth0
This command removes the IP address 192.168.1.100 from the eth0 interface.
ip route show
This command displays the current routing table.
The output of the ip command can vary based on the object and command used. For example:
| Option | Description |
|---|---|
link |
Manage network interfaces. |
addr |
Manage IP addresses. |
route |
Manage routing tables. |
neigh |
Manage ARP entries. |
rule |
Manage routing policy rules. |
tunnel |
Manage IP tunnels. |
show |
Display information about the specified object. |
add |
Add a new interface or address. |
del |
Delete an interface or address. |
set |
Set parameters for an interface. |