If I do an "ifconfig <iface> <IP>" it changes the IP address for my device. If I do an "ip addr change dev <iface> <IP/mask>" it adds a secondary IP to device (same happens with an "ip addr add dev <iface> <IP/mask>"). So, how do I actually change the IP address associated with then interface using the ip command?
Code:
[root@money ~]# ip addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:ca:49:04 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.100/24 brd 192.168.122.255 scope global eth1
inet6 fe80::5054:ff:feca:4904/64 scope link
valid_lft forever preferred_lft forever
[root@money ~]# ifconfig eth1 192.168.122.105
[root@money ~]# ip addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:ca:49:04 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.105/24 brd 192.168.122.255 scope global eth1
inet6 fe80::5054:ff:feca:4904/64 scope link
valid_lft forever preferred_lft forever
[root@money ~]# ip addr change dev eth1 192.168.122.102/24
[root@money ~]# ip addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 52:54:00:ca:49:04 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.105/24 brd 192.168.122.255 scope global eth1
inet 192.168.122.102/24 scope global secondary eth1
inet6 fe80::5054:ff:feca:4904/64 scope link
valid_lft forever preferred_lft forever