TransWikia.com

Debian Buster Can not set static IP

Unix & Linux Asked by cstrutton on December 15, 2021

I have an NPI iMX6ULL ARM based single-board computer running Debian Buster. It has 2 network ports listed by ifconfig as eth0 and eth1

It seems to be ignoring my network configuration in /etc/network/interfaces

auto lo eth0 eth1

iface lo inet loopback

iface eth0 inet dhcp

iface eth1 inet static
  address 192.168.1.254
  netmask 255.255.255.0

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

After booting the above configuration with eth0 connected to a dhcp server, ifconfig reports:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.4.10.131  netmask 255.255.192.0  broadcast 10.4.63.255
        inet6 fe80::d489:7cff:feec:e09e  prefixlen 64  scopeid 0x20<link>
        ether d6:89:7c:ec:e0:9e  txqueuelen 1000  (Ethernet)
        RX packets 478  bytes 42931 (41.9 KiB)
        RX errors 0  dropped 29  overruns 0  frame 0
        TX packets 30  bytes 2883 (2.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether d6:89:7c:ec:e0:9d  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Similarly, after booting the above configuration with eth1 connected to a dhcp server, ifconfig reports:

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether d6:89:7c:ec:e0:9e  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 10.4.11.126  netmask 255.255.192.0  broadcast 10.4.63.255
        inet6 fe80::d489:7cff:feec:e09d  prefixlen 64  scopeid 0x20<link>
        ether d6:89:7c:ec:e0:9d  txqueuelen 1000  (Ethernet)
        RX packets 1234  bytes 118390 (115.6 KiB)
        RX errors 0  dropped 58  overruns 0  frame 0
        TX packets 38  bytes 3547 (3.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

If I do an sudo ifdown eth1 it reports:

ifdown: interface eth1 not configured

and sudo ifup eth1 it comes up:

debian@npi:~$ sudo ifup eth1
debian@npi:~$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.4.10.131  netmask 255.255.192.0  broadcast 10.4.63.255
        inet6 fe80::d489:7cff:feec:e09e  prefixlen 64  scopeid 0x20<link>
        ether d6:89:7c:ec:e0:9e  txqueuelen 1000  (Ethernet)
        RX packets 16846  bytes 1401257 (1.3 MiB)
        RX errors 0  dropped 856  overruns 0  frame 0
        TX packets 65  bytes 4551 (4.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        inet 192.168.1.254  netmask 255.255.255.0  broadcast 192.168.1.255
        ether d6:89:7c:ec:e0:9d  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

What is controlling my network configuration on boot up. How do I find out?

I did find a couple of Google hits that talked about issues with my MAC address but this happens to both interfaces. I tried changing my MAC address as well, but nothing changed.

One Answer

Thank you to Seamus for pointing me in the right direction. The key was that the image I was working with was based on the BeagleBone images.

The issue was connman taking control of the network ports before networkd. On one unit, I was able to remove connman with apt. After that, my configuration in /etc/systemd/network/interfaces was properly applied.

My research indicated that connman is the way of the future so I figured out how to configure that too. This page gave lots of great info. connmanctl can be used to set a static IP directly.

root@npi:~# connmanctl
connmanctl> config ethernet_00142d259a48_cable --ipv4 manual 192.168.10.2 255.255.255.0 192.168.10.1
connmanctl> config ethernet_00142d259a48_cable --nameservers 8.8.8.8
connmanctl> exit

The hex string in the middle of the device name is the MAC address of the device. manual specifies static IP and the numbers are the ipaddress, network mask and gateway (gateway is optional).

This page also explains it well. Most documentation unfortunately is aimed at configuring wifi. Most sites only mention static addressing in passing.

Hope this helps the next guy.

Answered by cstrutton on December 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP