2 2
Jens Bauer

EspressoBIN - static IP address

Recommended Posts

I've been running the Ubuntu from GlobalScale until now.

-I finally had a chance for switching to Armbian, so I did; now I'm running 5.50: Ubuntu Xenial (4.17.3).

So far, I've installed it onto my SATA harddisk, it boots, network is available via DHCP, web-server is up, SSHD is up, I can update via apt-get, etc...

But there's still one important piece missing; I need to make the IP-address static (which was one of the main reasons I switched to Armbian).

On GlobalScale's forum, I get the impression that Armbian is much easier to configure static IP address for, but I have the impression that I should not touch anything /etc/network/interfaces*. Instead it seems I'm supposed to write something in /etc/systemd/network/ - I just have no clue what to write where.

I'm assuming I'll be using the "WAN" interface, so my guess is I should change /etc/systemd/network/10-wan.network.

-If my netmask is 255.0.0.0 and the static  ip address is 10.0.1.2 and my gateway is 10.0.0.1, what's supposed to go where ?

Currently, my 10-wan.network is unchanged and looks like this:

[Match]
Name=wan 

[Network]
Bridge=br0

I've tried searching for Network manager and how to configure using it, but I just ended up more confused. :/

(I also tried selecting 'static ip' in Armbian-config, but it does not seem to do anything).

 

Share this post


Link to post
Share on other sites

If you only need the wan interface, then I believe that you could delete the 10-lan0.network & 10-lan1.network files and assign static ip in the 10-br0.network file.

Systemd networkd is used rather than networkmanager or interfaces files

Share this post


Link to post
Share on other sites
15 hours ago, lampra said:

If you only need the wan interface, then I believe that you could delete the 10-lan0.network & 10-lan1.network files and assign static ip in the 10-br0.network file.

Systemd networkd is used rather than networkmanager or interfaces files

 

Thank you for the quick reply. :)

Your answer did give me ideas on what to search for and I ended up with the following:, which seems to work for me - just in case others need a starting-point:


 

$ cat 10-wan.network 
# see:
# <https://www.freedesktop.org/software/systemd/man/systemd.network.html>
[Match]
Name=wan 
[Network]
Bridge=br0
DHCP=no
Address=10.0.1.2/8
Gateway=10.0.0.1

I've kept my DNS in resolv.conf (since systemd falls back to that if no DNS is specified).

Share this post


Link to post
Share on other sites

As i said, try to assign the static ip to the 10-br0.network file, not in the 10-wan.network file (something like this below):
 

Spoiler



10-wan.network
[Match]
Name=wan 

[Network]
Bridge=br0

10-br0.network
[Match]
Name=br0

[Network]
Address=10.0.1.2/8
Gateway=10.0.0.1


 

 

Share this post


Link to post
Share on other sites
1 hour ago, lampra said:

As i said, try to assign the static ip to the 10-br0.network file, not in the 10-wan.network file (something like this below):

Thank you so much again for your help.

I've tried your setup and made a #reboot and also a hard reset for rebooting, but still no luck.

Unfortunately, it seems something else must have gone wrong, because I noticed that when things worked, both the left and right LEDs on the WAN connector were lit, but currently only the left one is lit (seen from the side where you plug in the wire).

Sadly I'm color-blind, so Ican be specific about the color.

 

What should I look for in the terminal when it boots ?

 

Share this post


Link to post
Share on other sites

For me the following configuration works for either the lan ports or the wan port:

Spoiler



root@espressobin:/etc/systemd# uname -a
Linux espressobin 4.17.3-mvebu64 #7 SMP PREEMPT Thu Jun 28 18:21:11 UTC 2018 aarch64 GNU/Linux
root@espressobin:/etc/systemd# systemctl --failed
0 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
root@espressobin:/etc/systemd# networkctl 
IDX LINK             TYPE               OPERATIONAL SETUP     
  1 lo               loopback           carrier     unmanaged 
  2 bond0            ether              off         unmanaged 
  3 dummy0           ether              off         unmanaged 
  4 eth0             ether              degraded    configuring
  5 wan              ether              carrier     failed    
  6 lan0             ether              no-carrier  failed    
  7 lan1             ether              no-carrier  failed    
  8 br0              ether              routable    configured

8 links listed.
root@espressobin:/etc/systemd# tail -n +1 -- network/*.*
==> network/10-br0.netdev <==
[NetDev]
Name=br0
Kind=bridge

==> network/10-br0.network <==
[Match]
Name=br0

[Network]
Address=192.168.10.10
Gateway=192.168.10.1
DNS=8.8.8.8

==> network/10-eth0.network <==
[Match]
Name=eth0

[Network]
DHCP=ipv4 

==> network/10-lan0.network <==
[Match]
Name=lan0

[Network]
Bridge=br0

==> network/10-lan1.network <==
[Match]
Name=lan1

[Network]
Bridge=br0

==> network/10-wan.network <==
[Match]
Name=wan 

[Network]
Bridge=br0
                                    
root@espressobin:/etc/systemd# systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/systemd-resolved.service.d
           └─resolvconf.conf
   Active: active (running) since Wed 2018-07-04 01:40:28 EEST; 6 days ago
     Docs: man:systemd-resolved.service(8)
           http://www.freedesktop.org/wiki/Software/systemd/resolved
           http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
           http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
  Process: 607 ExecStartPost=/bin/sh -c [ ! -e /run/resolvconf/enable-updates ] || echo "nameserver 127.0.0.53" | /sbin/resolvconf -a systemd-resolved (code=exited, status=0/SUCCESS)
 Main PID: 594 (systemd-resolve)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-resolved.service
           └─594 /lib/systemd/systemd-resolved


 

 

Share this post


Link to post
Share on other sites

By the way, for your tests you can have an 99-failover.network file with dhcp settings for the bridge in the /etc/systemd/network/ folder so if everything else fails, you will at least obtain an ip from the dhcp server (so no need to plug in the usb)

Share this post


Link to post
Share on other sites

I entered a few of the commands you listed and got the following output:

(sorry, some of the lines seem to be truncated; especially parts with important information):
 

Spoiler

 

root@bunting:~# systemctl --failed
  UNIT                         LOAD   ACTIVE SUB    DESCRIPTION
b armbian-zram-config.service  loaded failed failed Armbian ZRAM config
b systemd-modules-load.service loaded failed failed Load Kernel Modules

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

lines 1-15/15 (END)

lines 1-15/15 (END)
2 loaded units listed. Pass --all to see loaded but inactive units, too.

To show all installed unit files use 'systemctl list-unit-files'.


root@bunting:~# systemctl status systemd-modules-load
b systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; ven
  Drop-In: /lib/systemd/system/systemd-modules-load.service.d
           bb10-timeout.conf
   Active: failed (Result: exit-code) since Tue 2018-07-10 18:29:09 CEST; 6min a
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 10167 ExecStart=/lib/systemd/systemd-modules-load (code=exited, statu
 Main PID: 10167 (code=exited, status=1/FAILURE)

Jul 10 18:29:09 bunting systemd[1]: Starting Load Kernel Modules...
Jul 10 18:29:09 bunting systemd[1]: systemd-modules-load.service: Main process e
Jul 10 18:29:09 bunting systemd[1]: Failed to start Load Kernel Modules.
Jul 10 18:29:09 bunting systemd[1]: systemd-modules-load.service: Unit entered f
Jul 10 18:29:09 bunting systemd[1]: systemd-modules-load.service: Failed with re


root@bunting:~# systemctl restart systemd-modules-load
Job for systemd-modules-load.service failed because the control process exited with error code. See "systemctl status syste
md-modules-load.service" and "journalctl -xe" for details.


root@bunting:~# systemctl status systemd-modules-load.service
b systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; ven
lines 3262-3284/3284 (END)

lines 3262-3284/3284 (END)
  Drop-In: /lib/systemd/system/systemd-modules-load.service.d
           bb10-timeout.conf
   Active: failed (Result: exit-code) since Tue 2018-07-10 18:35:47 CEST; 30s ag
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 29759 ExecStart=/lib/systemd/systemd-modules-load (code=exited, statu
 Main PID: 29759 (code=exited, status=1/FAILURE)

lines 1-7/7 (END)
Jul 10 18:35:47 bunting systemd[1]: Starting Load Kernel Modules...
Jul 10 18:35:47 bunting systemd[1]: systemd-modules-load.service: Main process e
Jul 10 18:35:47 bunting systemd[1]: Failed to start Load Kernel Modules.
Jul 10 18:35:47 bunting systemd[1]: systemd-modules-load.service: Unit entered f
Jul 10 18:35:47 bunting systemd[1]: systemd-modules-load.service: Failed with re


root@bunting:~# journalctl -xe
--
-- Unit serial-getty@ttyS0.service has finished starting up.
--
-- The start-up result is done.
Jul 10 18:36:07 bunting ntpd[1530]: error resolving pool 3.ubuntu.pool.ntp.org:
Jul 10 18:36:11 bunting agetty[30862]: /dev/ttyS0: not a tty
Jul 10 18:36:13 bunting ntpd[1530]: error resolving pool 1.ubuntu.pool.ntp.org:
Jul 10 18:36:22 bunting systemd[1]: serial-getty@ttyS0.service: Service hold-off
Jul 10 18:36:22 bunting systemd[1]: Stopped Serial Getty on ttyS0.
-- Subject: Unit serial-getty@ttyS0.service has finished shutting down
-- Defined-By: systemd

-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit serial-getty@ttyS0.service has finished shutting down.
Jul 10 18:36:22 bunting systemd[1]: Started Serial Getty on ttyS0.
-- Subject: Unit serial-getty@ttyS0.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit serial-getty@ttyS0.service has finished starting up.
--
-- The start-up result is done.
Jul 10 18:36:27 bunting agetty[31669]: /dev/ttyS0: not a tty


root@bunting:~# journalctl _PID=10167
-- Logs begin at Tue 2018-07-10 18:17:02 CEST, end at Tue 2018-07-10 18:37:58 CE
Jul 10 18:29:09 bunting systemd-modules-load[10167]: could not open moddep file
Jul 10 18:29:09 bunting systemd-modules-load[10167]: Failed to lookup alias 'lp'
Jul 10 18:29:09 bunting systemd-modules-load[10167]: could not open moddep file
Jul 10 18:29:09 bunting systemd-modules-load[10167]: Failed to lookup alias 'ppd
Jul 10 18:29:09 bunting systemd-modules-load[10167]: could not open moddep file
Jul 10 18:29:09 bunting systemd-modules-load[10167]: Failed to lookup alias 'par


root@bunting:~# ls -Al /etc/modules-load.d/
total 4
-rw-r--r-- 1 root root 119 May  7 20:09 cups-filters.conf
lrwxrwxrwx 1 root root  10 Mar  8 19:14 modules.conf -> ../modules


root@bunting:~# cat /etc/modules-load.d/modules.conf

root@bunting:~# networkctl
IDX LINK             TYPE               OPERATIONAL SETUP
  1 lo               loopback           carrier     unmanaged
  2 bond0            ether              off         unmanaged
  3 dummy0           ether              off         unmanaged
  4 eth0             ether              degraded    configuring
  5 wan              ether              n/a         unmanaged
  6 lan0             ether              off         unmanaged
  7 lan1             ether              off         unmanaged

7 links listed.


root@bunting:~# cd /etc/systemd/
root@bunting:/etc/systemd# tail -n +1 -- network/*.*
==> network/10-br0.netdev <==
[NetDev]
Name=br0
Kind=bridge

==> network/10-br0.network <==
[Match]
Name=br0

[Network]
Address=10.0.1.2/8
Gateway=10.0.0.1

==> network/10-eth0.network <==
[Match]
Name=eth0

[Network]
DHCP=ipv4
lines 1-17/17 (END)

lines 1-17/17 (END)

==> network/10-wan.network <==
[Match]
Name=wan

[Network]
Bridge=br0

==> network/body.txt <==
Name=br0

==> network/head.txt <==
[Match]

==> network/tail.txt <==

[Network]
Address=10.0.1.2/8
Gateway=10.0.0.1
root@bunting:/etc/systemd# systemctl status systemd-resolved
b systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor
  Drop-In: /lib/systemd/system/systemd-resolved.service.d
           bbresolvconf.conf
   Active: active (running) since Tue 2018-07-10 18:17:19 CEST; 26min ago
     Docs: man:systemd-resolved.service(8)
 Main PID: 1360 (systemd-resolve)
   Status: "Processing requests..."
   CGroup: /system.slice/systemd-resolved.service
           bb1360 /lib/systemd/systemd-resolved

Jul 10 18:17:19 bunting systemd[1]: Starting Network Name Resolution...
Jul 10 18:17:19 bunting systemd-resolved[1360]: Positive Trust Anchors:
Jul 10 18:17:19 bunting systemd-resolved[1360]: . IN DS    19036 8 2 49aac11d7b6
Jul 10 18:17:19 bunting systemd-resolved[1360]: Negative trust anchors: 10.in-ad
Jul 10 18:17:19 bunting systemd-resolved[1360]: Using system hostname 'bunting'.
Jul 10 18:17:19 bunting systemd[1]: Started Network Name Resolution.

 

 

 

-so zram loads (I don't think this is fatal), but it seems that there's some trouble loading modules.

I noticed that resolv.conf has been changed at some point (it suddenly contained google's DNS instead of OpenDNS, which I or the router had provided earlier via DHCP).

'could not open moddep file' looks like a clue.

 

Share this post


Link to post
Share on other sites

I just recalled that before the network stopped working, I did the following:

add-apt-repository for redis-server

add-apt-repository for nginx

apt-get update

apt-get upgrade

modify nginx configuration

 

(I didn't think about mentioning it ealier, because the network was of course working until I made a reboot)

 

-I think that the 'apt-get upgrade' might have something to do with my network no longer being brought up.

Share this post


Link to post
Share on other sites
(edited)

networkctl is telling you that there is no br0 so this will not work.

 

In the eth0 file is there something wrong? or this is because of copy & paste?

lines 1-17/17 (END) lines 1-17/17 (END) 

* Make sure that the contents of the files and the files in /etc/systemd/network/ are exactly as in my previous post

* Remove all the .txt files from /etc/systemd/network/

(You could also start from a fresh install and only change the contents of the 10-br0.network file)

* Stop, disable and remove NetworkManager (systemctl stop NetworkManager && systemctl stop NetworkManager-wait-online && systemctl disable NetworkManager && systemctl disable NetworkManager-wait-online && apt remove --purge network-manager && apt autoremove)

* use systemd-resolved for name resolution (systemctl enable systemd-resolved && ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf)

 

Ejoy!!

 

Edit: make sure that the /etc/network/interfaces file contents are exactly these:

auto lo
iface lo inet loopback

 

Edited by lampra

Share this post


Link to post
Share on other sites
11 minutes ago, lampra said:

networkctl is telling you that there is no br0 so this will not work.

  

In the eth0 file is there something wrong? or this is because of copy & paste?


lines 1-17/17 (END) lines 1-17/17 (END) 

 

 

I just realized that my bogus .txt-files were causing the above, so I deleted them (even before I reached that you mentioned I should delete them).

-I used head and tail to construct the configuration files, since I can't use nano in my terminal.

 

 

11 minutes ago, lampra said:

* Make sure that the contents of the files and the files in /etc/systemd/network/ are exactly as in my previous post

 * Remove all the .txt files from /etc/systemd/network/

 (You could also start from a fresh install and only change the contents of the 10-br0.network file)

 * Stop, disable and remove NetworkManager (systemctl stop NetworkManager && systemctl stop NetworkManager-wait-online && systemctl disable NetworkManager && systemctl disable NetworkManager-wait-online && apt remove --purge network-manager && apt autoremove)

* use systemd-resolved for name resolution (systemctl enable systemd-resolved && ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf)

 

I tried this, and I'm pretty sure that the files in systemd/network match the ones you gave me.

(I checked using hexdump -C), and ensured that line-endings were 0x0a only.

As far as I understand, I should not delete 10-eth0.network or 10-br0.net*, correct ?

 

I'm willing to try a re-install, since I haven't done much customization yet - but that would unfortunately not help others getting in the same situation...

 

Share this post


Link to post
Share on other sites

I know 'vi' will cause me additional frustrations, so I'm trying to avoid using it. ;)

-But I just re-installed ubuntu 4.17.3, then did the following as the very first thing:

sudo add-apt-repository ppa:chris-lea/redis-server

sudo add-apt-repository ppa:nginx/stable

sudo apt-get update

sudo apt-get install redis nginx

sudo apt-get upgrade

... then I applied your modifications to 10-br0.network

saved and rebooted.

As soon as the board is in uboot, both LEDs are on (which is what they should be), but later during boot, the right-hand LED is turned off (which indicates that things won't work).

I do not get any IP-address.

If I log in via the terminal (now I got some portable PC with Windows and 'RealTerm', since I'm worn out moving my Mac back and forth more than 30 times), then ifconfig -a | grep addr won't show me any IPv4 address; not the static one I wanted and neither one assigned by DHCP. The router does not indicate a dynamically assigned IP address either.

If I copy the original files back and reboot, the board stays off the network; it seems I can't get it online by restoring settings.

-Do I need to "kick" something in anyway; eg. restart systemd, tell it to reload or flush or something like that ?

Share this post


Link to post
Share on other sites

Did you stop network-manager and checked the /etc/network/interfaces file contents?

what is the output of these commands:
 

Spoiler



$ systemctl --failed
$ systemctl | grep -i manager
$ cat /etc/network/interfaces
$ networkctl
$ ip addr
$ ip route
$ systemd-resolve --status
$ dig google.com


 

 

Share this post


Link to post
Share on other sites
On 7/11/2018 at 11:42 AM, lampra said:

Did you stop network-manager and checked the /etc/network/interfaces file contents?

what is the output of these commands:
 

  Reveal hidden contents

 



$ systemctl --failed
$ systemctl | grep -i manager
$ cat /etc/network/interfaces
$ networkctl
$ ip addr
$ ip route
$ systemd-resolve --status
$ dig google.com

 

 

 

 

 

After struggling with this for 3 days (this was absolutely no fun at all), I now finally came to a conclusion:

apt-get update && apt-get upgrade

-causes the network connection to be lost - right after a fresh installation, so my problems were completely unrelated to the modification of the interfaces.

Share this post


Link to post
Share on other sites

I've now gotten myself a new network card in my Mac, so now I've finally got network access again (the two built-in ports were fried).

 

I have two Espressobin boards; one (remote) is currently running Xenial, the other one (local) is running Bionic (18.4).

There seem to be a difference in how network needs to be set up on each of those.

Xenial allows me to configure wan alone, but if I try the same setup on bionic, I never get an IP-address on the WAN interface.

But using lampra's settings works; this sets the IP-address of the bridge to my desired IP-address.

That will require me to only connect one cable and use one IP-address, but I can live with that.

 

Update: Unfortunately, after applying lampra's settings, DNS-lookup does not seem to work (eg. curl http://someserver.com/ does not succeed in looking up the host).

Share this post


Link to post
Share on other sites
16 hours ago, Jens Bauer said:

Update: Unfortunately, after applying lampra's settings, DNS-lookup does not seem to work (eg. curl http://someserver.com/ does not succeed in looking up the host).

I recently came across the same issue with systemd-resolved after upgrading an old laptop to bionic.

I just disabled systemd-resolved and installed unbound.

Maybe this is bionic specific (works fine on debian stretch for me). 

Share this post


Link to post
Share on other sites
On 8/17/2018 at 3:09 AM, lampra said:

I recently came across the same issue with systemd-resolved after upgrading an old laptop to bionic.

I just disabled systemd-resolved and installed unbound.

Maybe this is bionic specific (works fine on debian stretch for me). 

 

Thank you again, Lampra.

 

This worked for me. Here's what I did:

sudo apt install unbound
sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop

sudo nano /etc/systemd/network/10-br0.network

#---8<-----8<-----8<--
[Match]
Name=br0

[Network]
Address=10.0.1.2/8
Gateway=10.0.0.1
#--->8----->8----->8--

sudo reboot
(now I got a static IP)

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2