Hi Jason,

It's true that netplan doesn't currently let you pick and choose which parts
of the dhcp information to apply to the system (IPs/routes/dns).  This is
captured as <https://bugs.launchpad.net/netplan/+bug/1759014>, which is a
valid request for future enhancement, given that the backends (networkd,
NetworkManager) do provide such fine-grained control.

However, to try to find a solution for your immediate problem: you say that
you don't want the default route on wlx485d601f9b83, and you "perhaps" want
to suppress the local route (192.168.1.0/24).  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 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?

In any case, based on what I understand of your setup so far, I don't see
any advantage to using DHCP on this interface and I would suggest statically
configuring this interface in netplan rather than splitting your network
configuration between netplan and direct networkd configuration.

On Mon, Jun 11, 2018 at 07:58:07AM +1000, Jason Heeris wrote:
> I have a machine (Ubuntu 18.04, netplan 1.10.1-5build1) with an ethernet
> port (enp1s0f0) and two wifi adapters, PCI (wlp2s0) and USB
> (wlx485d601f9b83). One use of the machine is to connect an ethernet-only
> device to a local wifi network via masquerading on wlx485d601f9b83. The
> other wifi adapter is for general purpose.
> 
> So my /etc/netplan/01-netcfg.yaml looks like:
> 
> network:
>  version: 2
>  renderer: networkd
>  ethernets:
>    enp1s0f0:
>      addresses:
>        - 10.0.0.1/24
>  wifis:
>    wlx485d601f9b83:
>      optional: true
>      dhcp4: yes
>      access-points:
>        [...]
>    wlp2s0:
>      optional: true
>      dhcp4: yes
>      access-points:
>        [...]
> 
> There's also some iptables NAT rules to do the not-actually-bridging, and
> DHCP serving on 10.0.0.1 to configure the other machine.
> 
> It's much easier for me if I can still use DHCP on wlx485d601f9b83 so I
> don't have to statically configure it. Unfortunately this means I now get
> two sets of routes added, including the default:
> 
> $ ip route show
> default via 192.168.1.1 dev wlx485d601f9b83 proto dhcp src 192.168.1.3
> metric 600
> default via 192.168.1.1 dev wlp2s0 proto dhcp src 192.168.1.100 metric 600
> 192.168.1.0/24 dev wlx485d601f9b83 proto kernel scope link src 192.168.1.3
> 192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.100
> 192.168.1.1 dev wlx485d601f9b83 proto dhcp scope link src 192.168.1.3 metric
> 600
> 192.168.1.1 dev wlp2s0 proto dhcp scope link src 192.168.1.100 metric 600
> 
> Since all routes have the same metric, connections just randomly switch
> between the two interfaces. This is counter to what I want (general traffic
> over wlp2s0) and it also seems to mess with certain services (like Avahi).
> Ideally I'd like to prevent wlx485d601f9b83 becoming the default gateway at
> all (ie. ignore that part of the DHCP config) and perhaps suppress the
> 192.168.1.0/24 entry as well.
> 
> But my reading of the manual[1] is that I can't even change the route
> metric, let alone ignore default DHCP routes, without doing full manual
> routing on both interfaces.
> 
> I've read a couple of questions on AskUbuntu about this, one of which is
> unanswered[2] and the other[3] suggests some networkd overrides which didn't
> achieve anything (I used "systemctl edit" rather than copying control files
> around, and I suspect their advice was actually to override netplan's
> renderer output altogether and drop netplan). However this Launchpad bug[4]
> suggests that something has changed recently that might facilitate what I
> need, I just can't figure out what.
> 
> Is what I'm asking possible? Or do I need to bypass Netplan and configure
> networkd manually?
> 
> Please CC me on replies, I can't subscribe to this list because I'm not a
> member of the team on Launchpad.
> 
> Thanks,
> Jason
> 
> [1] https://netplan.io/reference#routing
> [2] 
> https://askubuntu.com/questions/1008825/how-do-i-stop-netplan-from-binding-a-default-gateway-on-every-interface
> [3] 
> https://askubuntu.com/questions/1042582/how-to-set-default-route-with-netplan-ubuntu-18-04-server-2-nic/1043546
> [4] https://bugs.launchpad.net/netplan/+bug/1724666

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
[email protected]                                     [email protected]

Attachment: signature.asc
Description: PGP signature

-- 
Mailing list: https://launchpad.net/~netplan-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~netplan-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to