netplan-developers team mailing list archive
-
netplan-developers team
-
Mailing list archive
-
Message #00088
Re: How can I ignore the default gateway for some DHCP configured devices?
On Wed, Jun 13, 2018 at 10:00 PM, Jason Heeris <jason.heeris@xxxxxxxxx>
wrote:
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.
Well, I'm getting warmer at least. I need an extra routing table, so
doing this manually:
$ sudo ip route del 192.168.1.0/24 dev wlx485d601f9b83
$ sudo ip rule add from 10.0.0.0/24 table ewrelay
$ sudo ip route add default via 192.168.1.1 dev wlx485d601f9b83 table
ewrelay
Giving:
$ ip route show
default via 192.168.1.1 dev wlp2s0 proto dhcp src 192.168.1.100 metric
600
10.0.0.0/24 dev enp1s0f0 proto kernel scope link src 10.0.0.1
192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.100
192.168.1.1 dev wlp2s0 proto dhcp scope link src 192.168.1.100 metric
600
$ ip route show table ewrelay
default via 192.168.1.1 dev wlx485d601f9b83
$ ip rule show
0: from all lookup local
32765: from 10.0.0.0/24 lookup ewrelay
32766: from all lookup main
32767: from all lookup default
...got things working. Kind of. For five minutes*. I can almost
recreate this with Netplan using:
ethernets:
enp1s0f0:
optional: false
addresses:
- 10.0.0.1/24
wifis:
wlx485d601f9b83:
optional: true
addresses: [192.168.1.110/32]
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
table: 12
routing-policy:
- from: 10.0.0.0/24
table: 12
access-points:
[...]
EXCEPT that I can't figure out how to keep the "192.168.1.0/24 dev
wlx485d601f9b83" off the default routing table. If it's there, nothing
gets routed out of wlp2s0. If I set the subnet specifier to /32,
*nothing* gets routed out of wlx485d601f9b83 (even though the routing
table looks identical to the sort-of-working one, 'ip route get to
8.8.8.8 from 10.0.0.1' returns different results).
Furthermore, despite setting a static address on enp1s0f0 and setting
the wifi interfaces to "optional: true", my boot now takes several
minutes (sometimes) while "A start job is running for Wait for Network
to be Configured". When this happens, I'll also see that the
isc-dhcp-server has failed to start because it's "Not configured to
listen on any interfaces!" (it is definitely configured to listen on
enp1s0f0). I had thought the whole point of a static config on enp1s0f0
was to avoid this sort of thing, but again, there's a lot about this I
find confusing.
*Saying whether or not something works is made difficult by the fact
that it's not even remotely deterministic. Sometimes I can reboot four
or five times with the exact same config and things suddenly work,
sometimes I won't change anything and it'll all break. This is probably
due to a configuration problem too? But there are so many more moving
parts than I can keep track of, it's mostly just guesswork on my part.
- Jason
References