3

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 by ifconfig. 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
10
  • eth0 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.
    – chili555
    Aug 17, 2018 at 20:14
  • 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 Aug 23, 2018 at 13:48
  • mike@odroid:~$ cat /etc/netplan/*.yaml cat: '/etc/netplan/*.yaml': No such file or directory Aug 23, 2018 at 13:49
  • 2
    Are 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?
    – Thomas Ward
    Aug 23, 2018 at 14:17
  • mike@odroid:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.1 LTS Release: 18.04 Codename: bionic Aug 23, 2018 at 14:25

4 Answers 4

5

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.

2
  • I 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 May 30, 2019 at 4:57
  • Actually 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. May 31, 2019 at 23:41
0

I'm running 20.04 LTS and was having this problem. it occurred when I switched networks on with my laptop and the vm (ubuntu) got a new ip.

running the following command removed the second ip assignment and applied the correct settings:

sudo netplan apply

Keep in mind I already have my /etc/netplan/01-netcfg.yaml setup with a static ip for the nic.

0

I had the same problem on Ubuntu 22.04.2 after upgrading. The /etc/netplan/50-cloud-init.yaml file used to contain static config, but now the dhcp4 was set to TRUE:

dhcp4: true

after changing that to

dhcp4: false

and applying, the superfluous DHCP address was gone.

0

In my case there is dhcpcd script in /etc/init.d triggered from various /etc/rcX.d/* links leads to running dhcpcd process despite of setting static ip in netplan and also in /etc/network/interfaces and disabled NetworkManager. You can check if this is your case by ps -A and looking for DHCP client process. Then you can disable this service for example by removing x access right from /etc/init.d/dhcpcd or add "denyinterfaces name" to your dhcpcd.conf as described here: https://serverfault.com/a/1094181/1024693

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .