Forrest logo
back to the ip tool

ip:tldr:7516a

ip: Add/Delete an IP address to an interface.
$ ip addr add/del ${ip}/${mask} dev ${interface}
try on your machine

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 of x.x.x.x, where each x 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 of x.x.x.x, where each x 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

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ip tool