How can I configure a custom build of TorizonOS so that one of the ethernet interfaces keeps a static IP address even if the network cable is disconnected?
Hi, I’m the Toradex AI Assistant.
I might make mistakes or occasionally get you wrong. Our support team will step in if needed.
I’d be glad to help! Could you let me know which OS and version you are using? You can run the tdx-info command to get detailed information about your hardware and OS setup. This will help me provide the most accurate configuration guidance.
For reference, you can find more information about the tdx-info command at: Getting Device Information with Tdx-Info | Toradex Developer Center
Once I know your specific platform details, I can guide you through the proper network configuration steps for maintaining a static IP address on your Ethernet interface.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.
I use Torizon OS 7.5.0, Variant ‘Docker’ on verdi-imx8mp
Configuring Static IP for Ethernet on Torizon OS
For Torizon OS 7.5.0 on Verdin iMX8M Plus, you can configure a static IP address that persists even when the network cable is disconnected using NetworkManager(1). Torizon OS uses NetworkManager as its network management framework(1).
Static Network Configuration Steps
To configure a static IP address for your Ethernet interface, use the following nmcli commands(1):
# nmcli con mod '<Connection_name>' ipv4.addresses "<desired IP/mask>"
# nmcli con mod '<Connection_name>' ipv4.gateway "<desired gateway>"
# nmcli con mod '<Connection_name>' ipv4.dns "<DNS server 1>,<DNS server 2>"
# nmcli con mod '<Connection_name>' ipv4.method "manual"
Verify Current Connections
First, identify your current network connections(1):
# nmcli connection show
Apply Configuration Changes
After making the configuration changes, reload the NetworkManager configuration(1):
# sudo nmcli connection reload
Configuration File Location
You can verify your network configuration by examining the connection file(1):
# cd /etc/NetworkManager/system-connections/
# sudo cat <connection-name>.nmconnection
The configuration file will look similar to this(1):
[connection]
id=<connection-name>
uuid=a690e7e8-a413-331d-830d-d0df5bad3983
type=ethernet
autoconnect-priority=-999
permissions=
timestamp=1581530428
[ethernet]
mac-address=00:14:2D:63:47:64
mac-address-blacklist=
[ipv4]
address1=<board-ip>,10.0.0.1
dns-search=
method=manual
[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto
Ethernet Interface Naming
On Torizon OS, Ethernet interfaces are named ethernetX (where X is a number starting from 0), such as ethernet0, ethernet1(1).
Custom Image Integration
To integrate these network settings into a custom Torizon OS image, you can capture the configuration changes using TorizonCore Builder’s isolate command(1). This allows you to generate a custom Torizon OS image with your network configuration pre-applied.
This configuration will maintain the static IP address assignment even when the network cable is disconnected and reconnected, as NetworkManager will remember and reapply the manual configuration.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.
You did a recap of the official instructions on “how to set a static IP”.
This is clear.
But I need to know how I can configure so that the IP is kept (in ifconfig output) even if the cable is disconnected.
enter the content of @ etc/systemd/netowrk/ 10-static.network
Note on the ‘end0’ it may be eth0 at your end.
By this method, you are assigning the IP “169.154.50.50” by startup.
[Match]
[Network]
Address=169.154.50.50/16
Gateway=169.154.50.1
then enable and restart systemd-networkd using the following command.
systemctl enable systemd-networkd
systemctl restart systemd-networkd
But in this case I don’t use NetworkManager at all.
so, the opposite as the suggestion by Toradex
Hi Vix,
Yes , not using the network manager. instead using directly on systemd-networkd config file.
Since TorizonOS uses NetworkManager (see here), I’m worried about conflicts with systemd if used simultaneously.
@ToradexAI is it safe mixing NetworkManager and systemd-networkd?
Mixing NetworkManager and systemd-networkd on Torizon OS
It is not safe to mix NetworkManager and systemd-networkd simultaneously on Torizon OS(1). Torizon OS uses NetworkManager as its network management framework(1), and running both services concurrently can cause conflicts.
Recommended Approach for Torizon OS
For maintaining a static IP that persists even when the cable is disconnected on Torizon OS, you should stick with NetworkManager and configure it properly to maintain the interface state. The NetworkManager configuration I provided earlier should accomplish this goal.
Alternative: Switching to systemd-networkd Only
If you specifically need systemd-networkd behavior (keeping the IP visible in ifconfig even when cable is disconnected), you would need to completely disable NetworkManager first. However, this approach is not recommended for Torizon OS as it goes against the intended system design.
The documentation clearly states that for Yocto BSP reference images, you can choose between connman and systemd-networkd(2), but Torizon OS specifically uses NetworkManager(1).
Why NetworkManager is Preferred on Torizon OS
NetworkManager is designed to handle network state management more intelligently, including:
- Automatic reconnection when cables are plugged back in
- Better integration with the Torizon OS ecosystem
- Consistent behavior across different network scenarios
Configuration Persistence
With NetworkManager’s static configuration, the IP settings are persistent and will be reapplied when the interface comes back online. While the IP might not show in ifconfig when the cable is physically disconnected, this is actually the correct network behavior - the interface is down when no physical connection exists.
If you absolutely need the IP to remain visible when disconnected, you might need to explore NetworkManager’s advanced configuration options or consider if this requirement is truly necessary for your application.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.
Thanks.
Using NetworkManager, how can I be sure that a given interface (ethernet1) has been already created and configured at the boot?
Is there any command to quey the status?
I need that a docker container waits for the interface before trying to use it.
Hi,
Docker cannot check specifically for the interface status before starting containers. You can create a script that verifies the connection status before starting the container (the scheduler should trigger the script).
You have to configure the connection values through NetworkManager to be persistent previously.
The nmcli tool has ‘device status’ command to provide the information required for connection status.
Best regards,
Henrique Freitas
Embedded System Developer - Developer Experience
Toradex Brasil
Av . Coronel Silva Telles, 1002 - Room 81/82
Campinas - SP | Brazil | CEP: 13.024-001
Phone: +55 19 3327-3738
Henrique De Freitas
Toradex
Henrique De Freitas
Toradex