Sample Header Ad - 728x90

how can one manually assign a permanent / static IP address with "ip addr add"?

4 votes
2 answers
14858 views
After an IP address is assigned to this network interface, with any of the the following commands: ip addr add 10.0.0.0 dev eth1 valid_lft forever preferred_lft forever ip addr replace 10.0.0.0 dev eth1 valid_lft forever preferred_lft forever ip addr add 10.0.0.0 dev eth1 ip addr replace 10.0.0.0 dev eth1 I can verify with ip addr that the IP address for eth1 is set to 10.0.0.0/32 which is excellent (I think): ... 3: eth1: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000 link/ether 08:00:27:4d:1e:43 brd ff:ff:ff:ff:ff:ff inet 10.0.0.0/32 scope global eth1 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe4d:1e43/64 scope link tentative dadfailed valid_lft forever preferred_lft forever ... I begin to ping myself...the ping command hangs on the 31st ping: username@computer:~$ ping 10.0.0.0 PING 10.0.0.0 (10.0.0.0) 56(84) bytes of data. 64 bytes from 10.0.0.0: icmp_seq=1 ttl=64 time=0.043 ms 64 bytes from 10.0.0.0: icmp_seq=2 ttl=64 time=0.034 ms ... 64 bytes from 10.0.0.0: icmp_seq=30 ttl=64 time=0.038 ms 64 bytes from 10.0.0.0: icmp_seq=31 ttl=64 time=0.041 ms Once the ping hangs, I can verify with ip addr that the IP address for eth1 is has disappeared: ... 3: eth1: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000 link/ether 08:00:27:4d:1e:43 brd ff:ff:ff:ff:ff:ff inet6 fe80::a00:27ff:fe4d:1e43/64 scope link tentative dadfailed valid_lft forever preferred_lft forever ... **How can one assign a static IP address to a network interface using ip(8), and not let it disappear?** (disappearing after system restart is OK) I am running Ubuntu 14.04. From researching on the Internet about my problem, it seems that modifying the file /etc/network/interfaces is the solution, but this is undesirable, because this solution is not as portable as the ip(8) command.
Asked by Eric (143 rep)
Jan 29, 2016, 11:31 PM
Last activity: Mar 31, 2025, 02:50 PM