Home › Forums › Software discussion › OS – ubuntu › Static IP Address Assignment
Tagged: Static IP Addresses, Ubuntu
Greetings,
After a few hours of poking around I finally got this board up and running with Ubuntu 16.04. Have been largely unsuccessful in getting a static IP address assigned to the WAN interface through the usual /etc/network/interfaces config file (which works on virtually every other Ubuntu machine). Any help/suggestions would be greatly appreciated.
Thanks,
Mike Brown
mrb@brassmills.com
The first thing you’ll want to do is probably to add “net.ifnames=0” to your kernel command line to disable network interface renaming.
The next thing you’ll need to do is make sure you bring up eth0 (no address is needed, it just needs to be up) before bringing up wan. You can do this by adding “pre-up ifconfig eth0 up” to your /etc/network/interfaces stanza for wan.
Glasgall, thank you for the pointers.
I’ve normally made kernel config changes in /etc/default/grub.
Noticed in the Expressobin Ubuntu distro this config files seems to be MIA.
Where else would this config command be entered?
Best,
Mike B.
The EspressoBin, like most ARM boards, uses the Das U-Boot bootloader. You’ll need to make the changes in u-boot.
Reboot the board, hit a key to interrupt the automatic boot, and use “printenv” to list the environment variables. You can use “setenv” to change variable values for this boot and “saveenv” to write the new values to persistent storage.
The Marvell kernel/device tree blob does not expose the on-chip NOR flash, unfortunately, so you cannot do this from Linux right now.
Thanks – your pointers were very helpful.
Things are now working as expected.
Thanks!
Mike Brown
Hi,
I am still a newbie with Linux and Ubuntu and I have tried what I thought was the solution here to get my espresso board on my network. Would you be so kind to state what specifically you do in the u-boot params and ubuntu files to get networking up? I appreciate the help very much.
Thank you,
Matt
Turns out there was no need to mod uboot per se.
Issue was having eth0 minimally configured in /etc/network/interfaces file per the article https://jbevren.wordpress.com/2017/03/12/bringing-the-espressobin-up/ :
auto eth0
iface eth0 inet manual
auto lo
iface lo inet loopback
auto wan
iface wan inet dhcp
pre-up ifconfig wan up
auto lan1
iface lan1 inet dhcp
pre-up ifconfig lan1 up
Thank you so much for providing this information. I had some of it correct however with the updated information you provided I am seeing the WAN port stop linking with no lights when booting and the following messages are displayed on boot:
[ OK ] Found device /sys/subsystem/net/devices/wan.
[ OK ] Found device /sys/subsystem/net/devices/lan1.
[ OK ] Found device /sys/subsystem/net/devices/eth0.
[FAILED] Failed to start Raise network interfaces.
See ‘systemctl status networking.service’ for details.
[ OK ] Reached target Network.
Starting Network Name Resolution…
Starting /etc/rc.local Compatibility…
I am using the right-most ethernet jack for connecting to my network. The middle and left most jacks still have lights when I move my ehternet cable but the right most seems to be off.
Any other suggestions?
Thank you very much for your support.
Matt
Try replacing wan with eth0 in the pre-up statement.
Blew by SD card out last night. Have to rebuild the OS image.
Mike
Mike,
Thanks for the tip. I have tried various combinations but still no luck. I am thinking the ethernet is very touchy with this board. Are you connecting directly into your switch? I am connecting to a wall jack which is wired to my switch and I read somewhere on this forum where another user was having the same issue with not getting the DHCP address and did not get it resolved until connecting directly to a switch. I don’t have a spare at the moment to try that solution.
When you get your system online if you could provide your interface details I would appreciate the information.
Thanks again,
Matt
Hello Matt!
We are on the same path it seems, here is the install that finally worked for me after many hours.
put the lan cable in the LEFT port (lan1)
use nano or vim to edit /etc/network/interfaces
auto eth0
iface eth0 inet manual
auto lo
iface lo inet loopback
auto lan1
iface lan1 inet static
address 192.168.1.124
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.1.1
dns-nameservers 192.168.1.124 8.8.8.8
pre-up /sbin/ifconfig lan1 up
Like the poster above said the pre-up takes care of getting eth0 up first, the rest is knowing lan1 is the left port! Love the documentation huh?
Edit; I haven’t tried but I assume if you substitute lan1 for wan in the above you can put the cable in the RIGHT lan port and it should work.
Good Luck!
Yes, the process of placing an active network on this board is more of a pandora’s box. What I actually found in the end is that I must connect the espressobin to my switch directly. My normal connection to my switch is through the wall plate but apparently the connection is very sensitive and once I connected to a switch it came right up with my interfaces settings.
Thank you for sharing your network so we can help others, here is what I found works in my environment to get all three ports active:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
#source-directory /etc/network/interfaces.d
auto eth0
iface eth0 inet manual
auto lo
iface lo inet loopback
auto wan
iface wan inet dhcp
pre-up /sbin/ifconfig eth0 up
auto lan0
iface lan0 inet dhcp
pre-up /sbin/ifconfig eth0 up
auto lan1
iface lan1 inet dhcp
pre-up /sbin/ifconfig eth0 up
~
Hopefully this information will help other to prevent the hours which turned into days working through the network setup.
Thanks,
Matt
The way I made it work with a static IP on a ubuntu 16.04 and debian strech is to put in a systemd service, as shown below.
cat /etc/systemd/system/topaz-networking.service
[Unit]
Description=Raise Topaz network interfaces
Documentation=man:interfaces(5)
DefaultDependencies=no
Wants=network.target
After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service systemd-modules-load.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target[Install]
WantedBy=multi-user.target
WantedBy=network-online.target[Service]
Type=oneshot
EnvironmentFile=-/etc/default/networking
ExecStartPre=-/bin/sh -c ‘[ “$CONFIGURE_INTERFACES” != “no” ] && udevadm settle’
ExecStartPre=/sbin/ip link set eth0 up
ExecStartPre=/bin/sh -c ‘sleep 1 && udevadm settle’
ExecStart=/sbin/ip addr add 192.168.10.22/24 dev wan
ExecStart=/sbin/ip link set wan up
ExecStart=/bin/sh -c ‘sleep 1 && udevadm settle’
ExecStart=/sbin/ip route add default via 192.168.10.254
ExecStop=/sbin/ip link set wan down
ExecStop=/sbin/ip link set eth0 down
RemainAfterExit=true
TimeoutStartSec=1min
Forgot to mention (in #817), mine has both networking and networkd all disabled.
When I got my boards yesterday and after discarding my buildroot image, I attempted to set up network on my ubuntu image.
No luck in getting static ip working adding files to /etc/network/interfaces.d/
So I went to sleep and when I got up, I started trying out the examples on this thread.
I couldn’t get any of them working unmodified.
I couldn’t get static IP working.
I did get dynamic IP working for wan:
auto eth0
iface eth0 inet manual
auto lo
iface lo inet loopback
auto wan
iface wan inet dhcp
pre-up /sbin/ifconfig eth0 up
… If anyone succeeds in getting static ip working for all 3 interfaces, please post here (even if the thread gets old).
Note: I’m using the rootfs.tar.bz2 from ubuntu-16.04.3.zip with a 2GB board.
Technical specification tables can not be displayed on mobile. Please view on desktop