← Back to team overview

netplan-developers team mailing list archive

Re: How can I ignore the default gateway for some DHCP configured devices?

 

On Tue, Jun 12, 2018 at 3:07 AM, Steve Langasek <steve.langasek@xxxxxxxxxx> wrote

But if that's the case, why do you say that using DHCP for this interface is easier? What DHCP-provided
information *do* you want to use on this interface?

I'll disclaim up front that routing and interface configuration confuses me no end, so I might have made some assumptions when I set this up under ifconfig that don't really make sense. I had it in my head that I needed DHCP for (a) DNS addresses, so I could pass them on via DHCPD serving to my eth-connected device, and (b) to avoid extra config on the router. The router is a nice enough Asus device running Merlin, but still a bit clunky to work with.

Now that I dig into it, I think (a) is not true, because my DHCPD config (on the machine running Netplan, not the router) has nothing to do with whatever DHCP information is provided via wlx485d601f9b83 from the router, it's just statically set to the router's address (or I could set it to some external service). And (b) doesn't apply, I can just configure a static IP on this machine and router will happily allow it with no extra config.

But when I set a static address using:

     addresses: [192.168.1.110/24]
     gateway4: 192.168.1.1
     routes:
       - to: 0.0.0.0/0
         via: 192.168.1.1
     dhcp4: no

...even providing the gateway4 and routing settings that recreate the above routing table, my eth-connected device doesn't seem to get any DNS information from the DHCPS server (again, I mean the one on this machine, not the router). Also confusing is that while I didn't even touch the config for enp1s0f0, I now have this line in my routing table:

10.0.0.0/24 dev enp1s0f0 proto kernel scope link src 10.0.0.1

This remains even after totally reverting my Netplan config to what I had yesterday and rebooting. I am absolutely baffled by this. This is a relatively clean install, so there are no custom scripts messing with the routing tables that I've added.

Doing this made me realise also - I have to recreate those routing table entries I wanted to get rid of anyway. Otherwise the eth-wifi bridge can't work, because nothing will get routed out of the wlx485d601f9b83 interface. (The other part to the bridge is a "-A POSTROUTING -s 10.0.0.0/24 -o wlx485d601f9b83 -j MASQUERADE" entry in iptables' NAT table.) So I seem to be stuck with having everything think it can go out via wlx485d601f9b83, or nothing. This is getting beyond the scope of Netplan perhaps, but if you have advice I'll happily take pointers.

I do see you have a DHCP-provided unicast route on this interface, which is
unusual:

192.168.1.1 dev wlx485d601f9b83 proto dhcp scope link src 192.168.1.3 metric 600

I'm not sure why you have this since it's redundant with the route for the subnet as a whole which has a lower metric. Perhaps you were experimenting
with the DHCP server config?

I had assumed this was Netplan's doing! I didn't put it there manually, and it's still there if I disable the DHCP server. No idea what it does or why it's there.

In between every config change I am running "sudo netplan apply" or even rebooting. Does Netplan's Networkd renderer clear all of its output files before re-rendering them? Or is there some state somewhere that's persisting, causing these unexpected routes?

Thanks for your help so far.

- Jason



Follow ups

References