0

I have a very simple /etc/network/interfaces file:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.5.5
    netmask 255.255.255.0
    network 192.168.5.0
    gateway 192.168.5.100

iface usb0 inet static
    address 192.168.7.2
    netmask 255.255.255.252
    network 192.168.7.0
    gateway 192.168.7.1

Where I assign a static IP address of 5.5 to eth0. However, upon boot, ifconfig shows a DHCP address of 5.21 has been assigned. I can ping both addresses (5.5 and 5.21) however I do not want the DHCP address to be granted.

eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 192.168.5.21  netmask 255.255.255.0  broadcast 192.168.5.255
        inet6 fe80::fe69:47ff:fe3a:f3f2  prefixlen 64  scopeid 0x20<link>
        ether fc:69:47:3a:f3:f2  txqueuelen 1000  (Ethernet)
        RX packets 10177  bytes 2731689 (2.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10242  bytes 1042043 (1017.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 55

I am looking for where the dynamic address is being defined so I can prevent it from being assigned.

UPDATE: I notice that when I attempt to restart the networking server it throws an error:

Apr 23 18:04:06 radius systemd[1]: Starting Raise network interfaces...
Apr 23 18:04:06 radius ifup[2887]: RTNETLINK answers: File exists
Apr 23 18:04:06 radius ifup[2887]: ifup: failed to bring up eth0
Apr 23 18:04:06 radius systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Apr 23 18:04:06 radius systemd[1]: networking.service: Failed with result 'exit-code'.
Apr 23 18:04:06 radius systemd[1]: Failed to start Raise network interfaces.

ip addr show yields multiple addresses for eth0:

2: eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether fc:69:47:3a:f3:f2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.20/24 brd 192.168.5.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.5.5/24 brd 192.168.5.255 scope global secondary eth0
       valid_lft forever preferred_lft forever
    inet 192.168.5.6/24 brd 192.168.5.255 scope global secondary eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::fe69:47ff:fe3a:f3f2/64 scope link
       valid_lft forever preferred_lft forever
Not a machine
  • 115
  • 1
  • 6

1 Answers1

0

It turns out that connman is installed so it overwrites resolv.conf and ignores the contents of /etc/network/interfaces.

The answer is to either uninstall connman:

sudo apt remove connman --purge

and use /etc/network/interfaces. Or, use connmanctl to set the static IP address:

connmanctl config ethernet_fc69473af3f2_cable --ipv4 manual 192.168.5.5 255.255.255.0 192.168.5.100
Not a machine
  • 115
  • 1
  • 6