Adding an IP address with ip address is useful for temporary testing, secondary service binding, failover validation, or bringing a new interface online before making the change persistent in the normal network configuration.
One interface can hold more than one IPv4 or IPv6 address at the same time, so ip address add is the normal way to attach an extra runtime address without removing the existing one.
The ip address add command updates the running kernel network state immediately. The new address becomes active at once, and a detailed interface view usually shows an added IPv4 address as secondary when another IPv4 address is already present on that device.
This is an operational change, not just a read-only check. Adding the wrong prefix length or attaching the address to the wrong interface can create address conflicts or make troubleshooting harder. The change also does not survive a reboot or interface reset unless the host's persistent network configuration defines the same address separately.
Steps to add an IP address with ip address:
- Confirm the target interface name and the current address state before making the change.
$ ip -brief address show dev lab0 lab0 UNKNOWN 192.0.2.10/24 fe80::d87c:62ff:feec:7f9f/64
- Add the new address and prefix to the interface.
$ sudo ip address add 192.0.2.20/24 dev lab0
No output usually means the command succeeded.
- Verify that the new address is now attached to the interface.
$ ip address show dev lab0 12: lab0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000 link/ether da:7c:62:ec:7f:9f brd ff:ff:ff:ff:ff:ff inet 192.0.2.10/24 scope global lab0 valid_lft forever preferred_lft forever inet 192.0.2.20/24 scope global secondary lab0 valid_lft forever preferred_lft forever inet6 fe80::d87c:62ff:feec:7f9f/64 scope link valid_lft forever preferred_lft forever - Persist the same address in the host's normal network configuration if it should survive a restart or interface bounce.
ip address add changes runtime state only, so the address disappears after reboot or interface reconfiguration unless the system's normal network manager or config files also define it.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
