ip:tldr:7516a
This command is used to add or delete an IP address and its corresponding subnet mask to or from a network interface in Linux.
-
ip addr add
: This specifies that you want to add an IP address. -
ip addr del
: This specifies that you want to delete an IP address. -
${ip}
: This is the IP address that you want to add or delete. It should be in the format ofx.x.x.x
, where eachx
can be a number between 0 and 255. -
${mask}
: This is the subnet mask associated with the IP address. It determines the network portion of the IP address. It is also specified in the format ofx.x.x.x
, where eachx
can be a number between 0 and 255. -
${interface}
: This is the network interface to which you want to add or delete the IP address. It can be the name of any valid network interface on your system, such as eth0 or wlan0.
Here are a few examples:
-
To add the IP address 192.168.1.100 with a subnet mask of 255.255.255.0 to the network interface eth0, the command would be:
ip addr add 192.168.1.100/24 dev eth0
-
To delete the IP address 192.168.1.100 with a subnet mask of 255.255.255.0 from the network interface eth0, the command would be:
ip addr del 192.168.1.100/24 dev eth0