grml / grml-terminalserver

terminalserver for Grml
4 stars 1 forks source link

grml-terminalserver-config fails when multiple networks are present #4

Open Spida opened 5 years ago

Spida commented 5 years ago

I tried to run grml-terminalserver from 2017.05 in a virtualbox-5.2. The first network interface presented to grml was configured to NAT the hosts network. The second network was a usb network adapter (in my case a Lenovo USB3 with RTL8153, driver rmmod'ed on host) forwarded in the VM. My intention was to use the first (NAT) network to get internet, the second (usb) network for pxe-boot clients.

What I would have expected: I would have expected to be asked which interface to use for the pxe-clients, configure the interface (if not already up) choose a dhcp client IP range and the boot (image) options.

What happened instead: I was asked, as expected, which interface to use. I was then asked to configure both interfaces with IP, netmask, broadcast, default gateway, DNS server. Setting that configuration failed, I was unable to proceed to the configuration of the DHCP server.

Initial analysis: (a) netcardconfig starts with running "ifdown $DV" (line 171), which fails since the device is neither configured in /etc/network/interface nor up. (b) I do not understand how the endless loop in grml-terminalserver-config (lines 161 to 167) is supposed to be terminated. If I comment out the loop, it works for me (c) the default configuration suggested by grml-terminalserver-config does not work for me. in the default, it suggest a default gateway for my second interface, which results in getting "RTNETLINK answers: File exists" since it is not useful to have two default gateways, so I need to skip the second default gateway (may be part of the problem) (d) the default client ip range (to be put into the dnsmasq configuration) is suggested without regard for the configuration of the network interface. imo, the default should be chosen from INSIDE the network range of the configured interface

mika commented 2 years ago

So I managed to look into this those days, you raised some good points, thanks @Spida!

Regarding your analysis:

a) this is sadly necessary due to the way ifupdown works, but if someone is aware of a nice way to detect that the device really is unconfigured and ifdown $device is unneeded, I'd be more than happy to rework this! b) the loop terminates as soon as a valid IP configuration is detected (this is related to (c) here as you already anticipated) c) indeed, that's something that bugged me also, took care of this in https://github.com/grml/grml-network/commit/5681e2bcbd6864dfba753aa4a9f240d30ac085b6, released as grml-network v0.14.0 d) the default client IP range should be suggested from within the provided network configuration, though there was a stupid bug regarding the actual IP range, with https://github.com/grml/grml-terminalserver/commit/bc3bf205e69f9528e72d1b2470631c2b9f8ff110 (released as grml-terminalserver v0.104.0) this should be better now, though if you have any further suggestions how to improve that please let us know