Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
On Mon, Aug 23, 2021 at 2:41 PM Bruce A. Johnson wrote: > I suspect that ModemManager needs to be changed to inform systemd-networkd. Nothing needs to change in ModemManager. networkd would need to be changed to integrate with ModemManager over D-Bus. The communication would go in 2 directions - networkd telling ModemManager to change states and networkd listening for state changes from ModemManager. FWIW, the NetworkManager code to integrate with ModemManager is in https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/tree/main/src/core/devices/wwan. It uses libmm-glib, but that's really just a convenience wrapper around the D-Bus interfaces. Dan
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
Hi! On Mon, 23 Aug 2021 at 23:41, Bruce A. Johnson wrote: > > I wasn't clear what I meant about processing of the .network > file. With Ethernet or Wi-Fi (using iwd), when the link comes up, > systemd-networkd does the Right Thing and starts network services on > the interface, running a DHCP client or setting up static address(es), > routes, etc., as specified in the .network file. When ModemManager > establishes the connection with the 3G carrier, systemd-networkd seems > to be unaware of the event, and I have to poke it with "systemd > restart systemd-networkd" or "networkctl reload" before it tries to > use the information in the .network file for the interface. It seems > to me like that ought to happen automatically. I suspect that > ModemManager needs to be changed to inform systemd-networkd. > > So far, it's not looking like there's an effort to integrate > ModemManager (or something similar) with systemd-networkd, which is > kind of a shame. If I come up with anything useful toward making that > happen, I'll offer a pull request, but at the moment I'm looking at > cobbling something together with Python. > We have a 500+ line shell script to do the job by just calling iproute2 commands (well, it is not very modular and does a couple of other things, too.) Besides that it is not very generic, license-wise I am not able to share it unfortunately. Of course probably 300 - 400 lines are just for error handling. I was not really involved when the script got written, but I would not mind throwing it out and skipping the maintenance burden. > It seems to me like that ought to happen automatically. I agree. > I suspect that ModemManager needs to be changed to inform > systemd-networkd. Why would that be the case? If you plug in an Ethernet cable there is no user space process that would inform systemd-networkd. I cannot guess anything else than systemd-networkd listening for suitable kernel events. Why would that not work for wwan interfaces? Obviously it doesn't, otherwise you wouldn't post here and my colleagues wouldn't have written a script. One difference seems to be the IPv4 address. When an Ethernet interface gets connected, as you write, in a typical case you need to run DHCP to get an IP address. Obviously systemd-network implements that. Without knowing the details right now I'd guess mobile broadband uses different protocols. Is it even Ethernet and DHCP on top of that? Our script asks the IP address from modem manager. So maybe systemd-networkd would need to do the same unless someone wants to reimplement that part. (Not sure whether modem manager would even be the program of choice, I guess connman can handle WWAN connections, too.) Is it even the same for all modems/networks? In the past PPP was a thing, nowadays QMI seems to be mentioned more frequently. Altogether this seems not to be implemented by systemd-networkd and implementing it might be much more work than a couple of days. Some more or less hacky script can be written in a couple of days. > and I have to poke it with "systemd restart systemd-networkd" or > "networkctl reload" before it tries to use the information in the > .network file for the interface. Did you get a working connection including the correct IPv4 address by doing that? If you did, some of my reasoning above would be wrong. I have not looked very deep (not even run strace or tcpdump, not to mention having a look at the source...); if someone can explain me why my speculation is wrong that would be welcome! Regards, Uwe Uwe Geuder Neuro Event Labs Oy Tampere, Finland uwe.gxu...@neuroeventlabs.com (bot check: fix 1 obvious typo)
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
I wasn't clear what I meant about processing of the .network file. With Ethernet or Wi-Fi (using iwd), when the link comes up, systemd-networkd does the Right Thing and starts network services on the interface, running a DHCP client or setting up static address(es), routes, etc., as specified in the .network file. When ModemManager establishes the connection with the 3G carrier, systemd-networkd seems to be unaware of the event, and I have to poke it with "systemd restart systemd-networkd" or "networkctl reload" before it tries to use the information in the .network file for the interface. It seems to me like that ought to happen automatically. I suspect that ModemManager needs to be changed to inform systemd-networkd. So far, it's not looking like there's an effort to integrate ModemManager (or something similar) with systemd-networkd, which is kind of a shame. If I come up with anything useful toward making that happen, I'll offer a pull request, but at the moment I'm looking at cobbling something together with Python. Bruce A. Johnson | Firmware Engineer Blue Ridge Networks, Inc. 14120 Parke Long Court Suite 103 | Chantilly, VA 20151 Main: 1.800.722.1168 | Direct: 703-633-7332 http://www.blueridgenetworks.com OpenPGP key ID: 296D1CD6F2B84CAB https://keys.openpgp.org/ On 23/08/2021 16:11, Manuel Wagesreither wrote: I took a closer look at what's going on with systemd-networkd, and I found whether I use ModemManager or mbim-cli to connect to the mobile network, the .network file will be processed, but _only after I restart systemd-networkd_. I'm not 100% sure this applies to all the applications in the systemd ecosystem (like systemd-networkd), but systemd is reloading .unit, .service, .mount and all the other files there are only after a `systemctl daemon-reload`. That's the intended behaviour. Just wanted to mention this. Can't comment on anything else, though, as I have no clue either. But I'm interested in this topic and am silently monitoring this thread. OpenPGP_signature Description: OpenPGP digital signature
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
Hi Bruce, Am Fr, 20. Aug 2021, um 22:01, schrieb Bruce A. Johnson: > Mantas' and Ulrich's responses gave me insights to dig more. Neither the > mbim-cli nor ModemManager sets the IP address on the interface, and some > kind of agent needs to do that. > > When I start the connection using ModemManager, I am able to retrieve > addresses that mmcli displays like the below. If I manually assign the > IPv4 address to the interface and set up the route, I'm able to send > traffic to and from other nodes. I haven't yet looked into how > ModemManager communicates this info to NetworkManager or how things like > a change of address are handled. As I see it, these addresses aren't > really static, because the IPv6 addresses are different from one mobile > session to the next. > > > > > IPv4 configuration | method: static > > | address: 6.147.139.XXX > > | prefix: 30 > > | gateway: 6.147.139.YYY > > | dns: 10.177.0.34, 10.177.0.210 > > | mtu: 1500 > > > > IPv6 configuration | method: static > > | address: 2607:fb90:648f:2648:a5b3:8146:95aa:2955 > > | prefix: 64 > > | gateway: 2607:fb90:648f:2648:68d8:1c67:a27:b968 > > | dns: fd00:976a::9, fd00:976a::10 > > | mtu: 1500 > > > I took a closer look at what's going on with systemd-networkd, and I > found whether I use ModemManager or mbim-cli to connect to the mobile > network, the .network file will be processed, but _only after I restart > systemd-networkd_. I'm not 100% sure this applies to all the applications in the systemd ecosystem (like systemd-networkd), but systemd is reloading .unit, .service, .mount and all the other files there are only after a `systemctl daemon-reload`. That's the intended behaviour. Just wanted to mention this. Can't comment on anything else, though, as I have no clue either. But I'm interested in this topic and am silently monitoring this thread. Regards, Manuel
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
Mantas' and Ulrich's responses gave me insights to dig more. Neither the mbim-cli nor ModemManager sets the IP address on the interface, and some kind of agent needs to do that. When I start the connection using ModemManager, I am able to retrieve addresses that mmcli displays like the below. If I manually assign the IPv4 address to the interface and set up the route, I'm able to send traffic to and from other nodes. I haven't yet looked into how ModemManager communicates this info to NetworkManager or how things like a change of address are handled. As I see it, these addresses aren't really static, because the IPv6 addresses are different from one mobile session to the next. IPv4 configuration | method: static | address: 6.147.139.XXX | prefix: 30 | gateway: 6.147.139.YYY | dns: 10.177.0.34, 10.177.0.210 | mtu: 1500 IPv6 configuration | method: static | address: 2607:fb90:648f:2648:a5b3:8146:95aa:2955 | prefix: 64 | gateway: 2607:fb90:648f:2648:68d8:1c67:a27:b968 | dns: fd00:976a::9, fd00:976a::10 | mtu: 1500 I took a closer look at what's going on with systemd-networkd, and I found whether I use ModemManager or mbim-cli to connect to the mobile network, the .network file will be processed, but _only after I restart systemd-networkd_. When it is processed, the only address the interface gets is an IPv6 address, and it doesn't match the one in the ModemManager message above. I'm guessing that T-Mobile isn't providing DHCP for IPv4, and probably with good reason. [root@url-000db95362a6:~]# ip addr show wwan0 6: wwan0: mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000 link/ether 52:95:20:b7:93:0f brd ff:ff:ff:ff:ff:ff inet6 2607:fb90:648f:2648:5095:20ff:feb7:930f/64 scope global mngtmpaddr noprefixroute valid_lft forever preferred_lft forever inet6 fe80::5095:20ff:feb7:930f/64 scope link valid_lft forever preferred_lft forever [root@url-000db95362a6:~]# ip -6 route ::1 dev lo proto kernel metric 256 pref medium 2607:fb90:648f:2648::/64 dev wwan0 proto ra metric 1024 pref medium fe80::/64 dev wwan0 proto kernel metric 256 pref medium ff00::/8 dev wwan0 metric 256 pref medium default via fe80::68d8:1c67:a27:b968 dev wwan0 proto ra metric 1024 expires 65524sec mtu 1500 pref medium At this point, I have a usable IP(v6) connection managed by systemd-networkd, but I can't see any indication that I'm getting DNS information. This could be that the only DNS tools I know of on my box are nslookup from Busybox and the gethostbyname() call in Python. Both are returning ESRCH. My .network file for the interface looks like this: [Match] Name=wwan0 [Network] Description=WAN connection on wwan0 DHCP=yes IPv6AcceptRA=true [DHCP] UseDNS=yes UseNTP=no SendHostname=no RouteMetric=0 [IPv6AcceptRA] UseDNS=true Is there something more that I need to add to get DNS addresses via the IPv6 router solicitation/advertisement mechanism, or does it appear that T-Mobile isn't providing DNS addresses except via the klunky method exposed by ModemManager? Bruce A. Johnson | Firmware Engineer Blue Ridge Networks, Inc. 14120 Parke Long Court Suite 103 | Chantilly, VA 20151 Main: 1.800.722.1168 | Direct: 703-633-7332 http://www.blueridgenetworks.com OpenPGP key ID: 296D1CD6F2B84CABhttps://keys.openpgp.org/ On 20/08/2021 03:15, Ulrich Windl wrote: Isn't the trick that the WIFI driver or kernel doe most of the magic required to make WIFI work, while a modem driver typically does not know much about the modem, i.e. a cellular modem requires some "special treatment". Dumb question: Does it work without systemd (i.e..: Do yoiu hgave some code that does all that handling)? On 20/08/2021 05:51, Mantas Mikulėnas wrote: Wouldn't e.g. `mbimcli` configure IP on its own? OpenPGP_signature Description: OpenPGP digital signature
Re: [systemd-devel] Mobile broadband modems support in systemd-networkd
On Thu, Aug 19, 2021 at 10:46 PM Bruce A. Johnson < bjohn...@blueridgenetworks.com> wrote: > I am trying to integrate an MBIM cellular modem (Sierra Wireless MC7455) > into my project, and while there seem to be plenty of people doing the > same thing, all of the references seem to point to using ModemManager to > set up the connection and NetworkManager to manage the IP config > (address, gateway, and DNS). I'd like to avoid having to add > NetworkManager to my build, since I've been getting along nicely with > systemd-networkd for my Ethernet and Wi-Fi interfaces (using iwd to > manage the Wi-Fi connection). Is there any work afoot to get > systemd-networkd to set up the IP address info in concert with > ModemManager, or do I have to force NetworkManager to play nicely with > systemd-networkd? > Wouldn't e.g. `mbimcli` configure IP on its own? -- Mantas Mikulėnas
[systemd-devel] Antw: [EXT] [systemd‑devel] Mobile broadband modems support in systemd‑networkd
>>> "Bruce A. Johnson" schrieb am 19.08.2021 um 21:37 in Nachricht <8926b5b1-6d52-cf73-8936-bb097d874...@blueridgenetworks.com>: > I am trying to integrate an MBIM cellular modem (Sierra Wireless MC7455) > into my project, and while there seem to be plenty of people doing the > same thing, all of the references seem to point to using ModemManager to > set up the connection and NetworkManager to manage the IP config > (address, gateway, and DNS). I'd like to avoid having to add > NetworkManager to my build, since I've been getting along nicely with > systemd-networkd for my Ethernet and Wi-Fi interfaces (using iwd to > manage the Wi-Fi connection). Is there any work afoot to get > systemd-networkd to set up the IP address info in concert with > ModemManager, or do I have to force NetworkManager to play nicely with > systemd-networkd? Isn't the trick that the WIFI driver or kernel doe most of the magic required to make WIFI work, while a modem driver typically does not know much about the modem, i.e. a cellular modem requires some "special treatment". Dumb question: Does it work without systemd (i.e..: Do yoiu hgave some code that does all that handling)? Regards, Ulrich > > -- > Bruce A. Johnson | Firmware Engineer > Blue Ridge Networks, Inc. > 14120 Parke Long Court Suite 103 | Chantilly, VA 20151 > Main: 1.800.722.1168 | Direct: 703-633-7332 > http://www.blueridgenetworks.com > OpenPGP key ID: 296D1CD6F2B84CAB https://keys.openpgp.org/
[systemd-devel] Mobile broadband modems support in systemd-networkd
I am trying to integrate an MBIM cellular modem (Sierra Wireless MC7455) into my project, and while there seem to be plenty of people doing the same thing, all of the references seem to point to using ModemManager to set up the connection and NetworkManager to manage the IP config (address, gateway, and DNS). I'd like to avoid having to add NetworkManager to my build, since I've been getting along nicely with systemd-networkd for my Ethernet and Wi-Fi interfaces (using iwd to manage the Wi-Fi connection). Is there any work afoot to get systemd-networkd to set up the IP address info in concert with ModemManager, or do I have to force NetworkManager to play nicely with systemd-networkd? -- Bruce A. Johnson | Firmware Engineer Blue Ridge Networks, Inc. 14120 Parke Long Court Suite 103 | Chantilly, VA 20151 Main: 1.800.722.1168 | Direct: 703-633-7332 http://www.blueridgenetworks.com OpenPGP key ID: 296D1CD6F2B84CAB https://keys.openpgp.org/ OpenPGP_signature Description: OpenPGP digital signature