You are not logged in.

#1 2015-07-06 10:02:45

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 288

systemd-networkd static IP which can survive device removal

Hello everyone,

I'm using USB LTE modem (Hi-Link) to have an Internet connection. I wish to use static IP configuration as it's more reliable to me. I followed this article:
https://wiki.archlinux.org/index.php/Sy … _static_IP

I started systemd-networkd

systemctl enable systemd-networkd.service

and created /etc/systemd/network/wired.network:

[Match]
Name=eth1

[Address]
Address=192.168.1.2/24

[Route]
Gateway=192.168.1.1

I didn't use systemd-resolved.service as I preferred to stay with static resolv.conf .

The question follows: how I can make this reconnect automatically when USB modem is disconnected and connected again?

Offline

#2 2015-07-06 16:15:19

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,350

Re: systemd-networkd static IP which can survive device removal

Are you disconnecting the modem from the USB port?  That would be a udev rule.
Are you disconnecting the modem from the Internet? That would be something like ifplugd or (I think) systemd-networkd should handle it directly.  If not, give netctl a try.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2015-07-10 23:53:31

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 288

Re: systemd-networkd static IP which can survive device removal

I can see now that my question should be different. It's probably software's fault, I bet it could be kernel or systemd but I'm not sure (I tried to downgrade them but this didn't solve the problem). Maybe this could be configuration problem. Anyway: Archlinux from ISO works properly. I see in log this:

lip 10 18:46:37 linux systemd[1]: sys-subsystem-net-devices-eth1.device: Job sys-subsystem-net-devices-eth1.device/start timed out.
lip 10 18:46:37 linux systemd[1]: Timed out waiting for device sys-subsystem-net-devices-eth1.device.
lip 10 18:46:37 linux systemd[1]: Dependency failed for Network connectivity (eth1).
lip 10 18:46:37 linux systemd[1]: network@eth1.service: Job network@eth1.service/start failed with result 'dependency'.
lip 10 18:46:37 linux systemd[1]: sys-subsystem-net-devices-eth1.device: Job sys-subsystem-net-devices-eth1.device/start failed with result 'timeout'.
lip 10 18:46:37 linux systemd[1]: Reached target Network.
lip 10 18:46:37 linux systemd[1]: Starting Network.

But I should not be using network@eth1.service, I should use systemd-networkd.service instead. I thought I disabled previous one. But I didn't:

[root@linux mk]# systemctl status network@eth1.service
● network@eth1.service - Network connectivity (eth1)
   Loaded: loaded (/etc/systemd/system/network@.service; enabled; vendor preset: disabled)
   Active: inactive (dead)

lip 10 18:46:37 linux systemd[1]: Dependency failed for Network connectivity (eth1).
lip 10 18:46:37 linux systemd[1]: network@eth1.service: Job network@eth1.service/start failed with result 'dependency'.

So I'm disabling it now:
[root@linux mk]# systemctl disable network@eth1.service
Removed symlink /etc/systemd/system/multi-user.target.wants/network@eth1.service.


I'll see if this helps. I'm leaving the thread here if someone would search for solution.

Offline

Board footer

Powered by FluxBB