how can one manually assign a permanent / static IP address with "ip addr add"?
Your problem is not ip addr
but some process (network manager?) which deletes the IP address. Unfortunately I am not aware of a possibility to determine which process made this access.
In case the disturbing process calls ip
it should be possible with process accounting (man acct) but not if the configuration is made directly via the NETLINK socket.
You may kill or stop suspicious processes to find out which one does that.
Related videos on Youtube
Comments
-
Eric over 1 year
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 foreth1
is set to10.0.0.0/32
which is excellent (I think):... 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> 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...theping
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 foreth1
is has disappeared:... 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 theip(8)
command.-
fpmurphy about 8 yearsThere is no fully portable way of assigning a permanent IP address to an interface on UNIX-like operating systems other than writing a startup script
-
BillThor about 8 years
ip
is a command to modify the current stack. It does not have a persistence mechanism. The persistence mechanisms, such as/etc/network/interfaces
are distribution (network configuration tool) specific. -
BillThor about 8 yearsIf you aren't using
/etc/network/interfaces
to configure your interfaces, it is likely Network Manager is managing the interface. It may be resetting the address on you./etc/network/interfaces
may be a better choice.
-