Multiple automatic ethernet connection

My RPI is connected to multiple ethernet cables ,but when it boots up it establish only one connection .
Now I need to manually create second connection .Is there a way to make this automatic?.
Kindly help.

Can you please provide more details about your configuration? I guess one of those wired connections will be used for establishing Internet connectivity and the rest will be used internally.

Thank you for the quick reply.
One ethernet interface has connection to internet and
another one has connection to LAN (BACNet network).I was expecting both to come up automatically .
Kindly let me know what config change will help for automatic discovery and setup.

There should be some manual configuration involved. At the very least you need to tell the OS which connection should be used as a default route towards the Internet (or more precisely which should not be used). I will get back to you on this in a couple of hours with more detailed steps on how to go further.

Is there a way to automate the configuration ,we need this because both ethernet connection
are not fixed and may or may not exist or port may be interchanged .So ideally it should discover the connections and use internet connection ethernet to connect to external world automatically and also should establish other LAN connection.Kindly comment.

If there is no automatic setup ,we can try manual setup so that we can have 2 live connections.
Please help on this.We will look into automatic later.

We are using NetworkManager in our OS for managing network connections. You may read more about this here: https://docs.resin.io/reference/OS/network/2.x/

Now there are two types of configuration that can be applied. First is a static configuration done by defining a connection profile file like the ones starting with [connection] you may see in the documentation. Those files can be either created manually or by creating those with the NetworkManager tools: nmcli and nmtui.

The other option is to create those connection profiles with application code using the NetworkManager D-Bus API - using a language like Python, etc. I would not advise starting with the programmatic approach though. More information on the programmatic approach here: https://docs.resin.io/reference/OS/network/2.x/#changing-the-network-at-runtime

The easiest utility to use is nmtui. You may launch it from a host OS terminal from our dashboard. I advise reading some tutorials about it or watching some introductory videos on YT, since there is a bit of a learning curve. Networking in general is not easy, but bit by bit you should be able to configure it.

The automatic connection you see is probably named “Wired Connection 1”. This is a connection profile NetworkManager automatically creates for you. However if you create a new connection profile for the interface this connection is created for, the automatic profile will not be created.

Using nmtui create two connection profiles for the Ethernet interfaces you would like to use. Use default settings for all of them - things like DHCP and DNS should be automatic to get you started.

For the connection profile you create for the interface not connected to the Internet, you need to specify never-default. This will mark it as interface that the OS should not try to establish Internet connectivity with.

Please let me know if you have any questions on the way.

I cannot run nmtui.
my host os is balenaOS 2.83.21+rev1.

I tried to use some package manager like apt-get apt yum, but not installed.

how to do it?

Hi, you are right, nmtui is not available on the host OS. You can use the same instructions Zahari shared running nmtui within a container. Here is how to do it

# In the host OS, start a new container mounting the dbus directory and NET_ADMIN capabilities.
# This will open a prompt within the container
balena run --rm -ti --cap-add=NET_ADMIN -v /var/run/dbus:/var/run/dbus alpine sh

# Install network manager within the container
apk update && apk add networkmanager

# Run nmtui
nmtui

Please let us know if this works for you.
Thank you!

1 Like