Ubuntu 18.04 minimal server has two IP addresses!
7,182
I have struggled with this exact same problem and every search comes up with several others experiencing the same issue with no resolution.
FINALLY, here is what solved it for me:
ip addr flush dev <your_adapter_id>
for me it was
ip addr flush dev enp0s4
This kills the secondary IP.
Related videos on Youtube
Author by
Mike Tarbox
Updated on September 18, 2022Comments
-
Mike Tarbox over 1 year
I'm seeing two different IP addresses on my Odroid XU4. I only noticed after I set up a Unifi controller on the box, but then tried to ssh into both of the addresses with success. I only want 192.168.2.3, and no IPv6.
mike@odroid:~$ ip addr show 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:1e:06:30:1e:f5 brd ff:ff:ff:ff:ff:ff inet 192.168.2.3/24 brd 192.168.2.255 scope global dynamic noprefixroute eth0 valid_lft 3069558340sec preferred_lft 3069558340sec inet 192.168.2.9/24 brd 192.168.2.255 scope global secondary eth0 valid_lft forever preferred_lft forever mike@odroid:~$ ifconfig eth0: flags=4163 mtu 1500 inet 192.168.2.3 netmask 255.255.255.0 broadcast 192.168.2.255 ether 00:1e:06:30:1e:f5 txqueuelen 1000 (Ethernet) RX packets 12821 bytes 2393432 (2.3 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 13336 bytes 9323830 (9.3 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 10593 bytes 4855090 (4.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 10593 bytes 4855090 (4.8 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
As we can see here eth0 has two IP address and is only shown by
ip
command and not byifconfig
. I am unable to understand where this is coming from or how to disable the 2nd IP permanently. I would like to get rid of the 2nd IP address permanently.mike@odroid:~$ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d mike@odroid:~$ cat /etc/netplan/*.yaml cat: '/etc/netplan/*.yaml': No such file or directory
-
chili555 over 5 yearseth0 seems unusual for an interface in 18.04. Please edit your question to add the result of the terminal commands:
cat /etc/network/interfaces
and also:cat /etc/netplan/*.yaml
Welcome to Ask Ubuntu. -
Mike Tarbox over 5 yearsmike@odroid:~$ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d
-
Mike Tarbox over 5 yearsmike@odroid:~$ cat /etc/netplan/*.yaml cat: '/etc/netplan/*.yaml': No such file or directory
-
Thomas Ward over 5 yearsAre you 100% certain this is Ubuntu 18.04? What's the output of
lsb_release -a
(to confirm the version of Ubuntu you're using)? Have you checked/etc/network/interfaces.d/
for any configuration items there that might be the network config? -
Mike Tarbox over 5 yearsmike@odroid:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic
-
Mike Tarbox over 5 yearsAnd /etc/network/interfaces.d doesn't exist. mike@odroid:/etc/network$ ls if-down.d if-post-down.d if-pre-up.d if-up.d interfaces
-
chili555 over 5 yearsI'm not sure how this even connects! Do you have to issue a terminal command or what? If so, what is it?
-
Mike Tarbox over 5 yearsIt's connected. I am ssh'd into it as I type. After every reboot I do have to go in and disable ipv6 and add the DNS servers. I use webmin as my cli is almost nonexistent.
-
Mike Tarbox over 5 yearsI should also note that this was a fresh install and not an upgrade from 16.04. Is it possible that the builders of the distro have messed up? This is for an Odroid XU4, downloaded directly from hardkernel.
-
Sergiy Kolodyazhnyy almost 5 yearsThis seems to be a form of a bug where old IP address is not being released (potentially a DHCP bug, though I've not done much digging on the subject). Please VTC askubuntu.com/q/1082605/295286 and askubuntu.com/q/1030957/295286 as duplicates of this post
-
-
Sergiy Kolodyazhnyy almost 5 yearsI suspect this issue may be due to previous failed dhcp lease not being released by the system, hence why flushing config works. Since this post is unlikely to be revisited by OP to confirm +1ed this post for effort to resolve and for providing what appears to be appropriate solution
-
Mike Tarbox almost 5 yearsActually I did log in to see the response. I ended up switching over to 16.04. I was using the odroid to run pi-hole, or at least attempting to. I ended up using the odroid to run my unifi controller instead.