1

I'm looking for a solution on this problem:

I have this small industrial pc called UP Board, running some Linux Debian/Ubuntu adopted version:

4.10.0-9-upboard #11~16.04.1 SMP Wed Oct 25 17:10:46 IST 2017 x86_64 x86_64 x86_64 GNU/Linux (I believe it's Ubuntu 16.04)

With this lil machine I'm offering some services within customer networks. And here comes the challenge...

Some of the customers run a DHCP server in their network, others don't. Since I am in different networks very often, and usually do not know the network settings regarding DHCP in advance, I had this idea: How about sending DHCP request on the network and waiting for response. When now response is received from DHCP server within a time frame, configure the respective network interface with a fixed IP and netmask. Then I'd be able to reach the box from my laptop and connect to set the right IP/NM of the network. So simply do some auto configuration of the interface just as Microsoft does it in Windows environment with these obscure 169.254.x.y addresses.

Since my device does not have any screen, manual configuration is not an option here.

Any ideas to develop such auto config feature are really appreciated!

Regards Olaf

P.S.: I've searched Google with different terms but did not get any valuable results. Hints what to search for are also welcome...

0

Firstly if your clients are connecting with you throw Internet, you should connect trow a VPN for increase security thus you shouldn't have routing issues.

If you only want change net configuration between manual or static if your connectivity fails, you can type a small script with the next steps:

1) ping to an IP

2.1) if ping fail => change your config

Example: sudo ip addr add dev

sudo ip addr add 10.102.66.200/24 dev enp0s25

2.2) if ping not fail => nothing

At the end, you need to create a new cron line https://en.wikipedia.org/wiki/Cron in your ubuntu machine in order to execute this script periodically.

  • Hi, pinging a host is not a valid option since networks change frequently. And so I cannot guarantee that the host I want to ping even exists... – okoester Mar 18 '19 at 8:18
  • Hi @okoester, maybe you should use a bonding mode (Mode 1). You can learn about it in help.ubuntu.com/community/UbuntuBonding – jdmorei Mar 25 '19 at 13:55
0

IMHO you can easily create a bridged interface with a static IP address and configure your Ethernet with DHCP

sudo apt install bridge-utils

Edit /etc/network/intefaces:

auto enp0s3 <---- change this to whatever your interface name is
iface enp0s3 inet dhcp

auto br0
iface br0 inet static
  address 10.10.10.10 <--- set this to whatever address you want
  netmask 255.255.255.0
  bridge_ports enp0s3

This way you can always connect to you box via 10.10.10.10 and the physical interface will get a dynamic address if a DHCP server is present

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.