Avoid setting a default route for a DHCP managed interface

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have an Ubuntu 16.04 (Xenial) box with two wifi interfaces. One (wlxAABBCC) is managed by Network Manager, the other (wlan0) is manually managed via /etc/network/interfaces.d. I want the default route for the machine itself though to use wlxAABBCC, not wlan0.
The plan is to bridge an ethernet-only device to a wireless router via wlan0 and use wlxAABBCC for everything else. So wlan0 passes on DHCP information and I can set up a custom ip route table that only passes on traffic from eth0's address. wlan0 still needs an address on the router though, so I need DHCP to do... something.
I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
But then I get two default routes:
$ ip route show
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlxAABBCC proto static metric 600
I don't want that. All traffic is just going to go through wlan0 now.
I tried setting the metric of wlxAABBCC to 0 with nmcli connection modify id "SSID" ipv4.route-metric 0
, but it still gets relegated to 1 by Network Manager when wlan0 comes up.
Then I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
up ip route del default dev wlan0
But then in the brief time between wlan0 coming up and wlxAABBCC coming up, a bunch of services seem to "choose" wlan0 as their preferred interface and don't recover when this default route is dropped (including SSH and Avahi, so I can't connect).
I found this Server Fault question which suggests using a manual stanza and a custom DHCP configuration. So I tried:
auto wlan0
iface wlan0 inet manual
up /sbin/dhclient -4 -v -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/network/dhclient_wlan0.conf $IFACE
down /sbin/dhclient -4 -v -r -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/dhcp/dhclient_wlan0.conf $IFACE
wpa-conf /etc/network/wlan0_wpa.conf
...where /etc/network/dhclient_wlan0.conf is based on the default DHCP conf, but sans routers and any ...static-routes options:
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
ntp-servers;
timeout 300;
It still sets two default routes.
I added this to the custom DHCP configuration file:
interface wlan0
supersede routers ""
IT STILL SETS TWO DEFAULT ROUTES.
Why does DHCP still add a default route with this custom config? What do I need to do so that wlan0 can get an address via DHCP but isn't the default interface?
networking dhcp
add a comment |Â
up vote
0
down vote
favorite
I have an Ubuntu 16.04 (Xenial) box with two wifi interfaces. One (wlxAABBCC) is managed by Network Manager, the other (wlan0) is manually managed via /etc/network/interfaces.d. I want the default route for the machine itself though to use wlxAABBCC, not wlan0.
The plan is to bridge an ethernet-only device to a wireless router via wlan0 and use wlxAABBCC for everything else. So wlan0 passes on DHCP information and I can set up a custom ip route table that only passes on traffic from eth0's address. wlan0 still needs an address on the router though, so I need DHCP to do... something.
I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
But then I get two default routes:
$ ip route show
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlxAABBCC proto static metric 600
I don't want that. All traffic is just going to go through wlan0 now.
I tried setting the metric of wlxAABBCC to 0 with nmcli connection modify id "SSID" ipv4.route-metric 0
, but it still gets relegated to 1 by Network Manager when wlan0 comes up.
Then I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
up ip route del default dev wlan0
But then in the brief time between wlan0 coming up and wlxAABBCC coming up, a bunch of services seem to "choose" wlan0 as their preferred interface and don't recover when this default route is dropped (including SSH and Avahi, so I can't connect).
I found this Server Fault question which suggests using a manual stanza and a custom DHCP configuration. So I tried:
auto wlan0
iface wlan0 inet manual
up /sbin/dhclient -4 -v -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/network/dhclient_wlan0.conf $IFACE
down /sbin/dhclient -4 -v -r -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/dhcp/dhclient_wlan0.conf $IFACE
wpa-conf /etc/network/wlan0_wpa.conf
...where /etc/network/dhclient_wlan0.conf is based on the default DHCP conf, but sans routers and any ...static-routes options:
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
ntp-servers;
timeout 300;
It still sets two default routes.
I added this to the custom DHCP configuration file:
interface wlan0
supersede routers ""
IT STILL SETS TWO DEFAULT ROUTES.
Why does DHCP still add a default route with this custom config? What do I need to do so that wlan0 can get an address via DHCP but isn't the default interface?
networking dhcp
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have an Ubuntu 16.04 (Xenial) box with two wifi interfaces. One (wlxAABBCC) is managed by Network Manager, the other (wlan0) is manually managed via /etc/network/interfaces.d. I want the default route for the machine itself though to use wlxAABBCC, not wlan0.
The plan is to bridge an ethernet-only device to a wireless router via wlan0 and use wlxAABBCC for everything else. So wlan0 passes on DHCP information and I can set up a custom ip route table that only passes on traffic from eth0's address. wlan0 still needs an address on the router though, so I need DHCP to do... something.
I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
But then I get two default routes:
$ ip route show
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlxAABBCC proto static metric 600
I don't want that. All traffic is just going to go through wlan0 now.
I tried setting the metric of wlxAABBCC to 0 with nmcli connection modify id "SSID" ipv4.route-metric 0
, but it still gets relegated to 1 by Network Manager when wlan0 comes up.
Then I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
up ip route del default dev wlan0
But then in the brief time between wlan0 coming up and wlxAABBCC coming up, a bunch of services seem to "choose" wlan0 as their preferred interface and don't recover when this default route is dropped (including SSH and Avahi, so I can't connect).
I found this Server Fault question which suggests using a manual stanza and a custom DHCP configuration. So I tried:
auto wlan0
iface wlan0 inet manual
up /sbin/dhclient -4 -v -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/network/dhclient_wlan0.conf $IFACE
down /sbin/dhclient -4 -v -r -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/dhcp/dhclient_wlan0.conf $IFACE
wpa-conf /etc/network/wlan0_wpa.conf
...where /etc/network/dhclient_wlan0.conf is based on the default DHCP conf, but sans routers and any ...static-routes options:
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
ntp-servers;
timeout 300;
It still sets two default routes.
I added this to the custom DHCP configuration file:
interface wlan0
supersede routers ""
IT STILL SETS TWO DEFAULT ROUTES.
Why does DHCP still add a default route with this custom config? What do I need to do so that wlan0 can get an address via DHCP but isn't the default interface?
networking dhcp
I have an Ubuntu 16.04 (Xenial) box with two wifi interfaces. One (wlxAABBCC) is managed by Network Manager, the other (wlan0) is manually managed via /etc/network/interfaces.d. I want the default route for the machine itself though to use wlxAABBCC, not wlan0.
The plan is to bridge an ethernet-only device to a wireless router via wlan0 and use wlxAABBCC for everything else. So wlan0 passes on DHCP information and I can set up a custom ip route table that only passes on traffic from eth0's address. wlan0 still needs an address on the router though, so I need DHCP to do... something.
I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
But then I get two default routes:
$ ip route show
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlxAABBCC proto static metric 600
I don't want that. All traffic is just going to go through wlan0 now.
I tried setting the metric of wlxAABBCC to 0 with nmcli connection modify id "SSID" ipv4.route-metric 0
, but it still gets relegated to 1 by Network Manager when wlan0 comes up.
Then I tried this in /etc/network/interfaces.d/wlan0:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/network/wlan0_wpa.conf
up ip route del default dev wlan0
But then in the brief time between wlan0 coming up and wlxAABBCC coming up, a bunch of services seem to "choose" wlan0 as their preferred interface and don't recover when this default route is dropped (including SSH and Avahi, so I can't connect).
I found this Server Fault question which suggests using a manual stanza and a custom DHCP configuration. So I tried:
auto wlan0
iface wlan0 inet manual
up /sbin/dhclient -4 -v -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/network/dhclient_wlan0.conf $IFACE
down /sbin/dhclient -4 -v -r -pf /run/dhclient.$IFACE.pid
-lf /var/lib/dhcp/dhclient.$IFACE.leases -I
-df /var/lib/dhcp/dhclient6.$IFACE.leases
-cf /etc/dhcp/dhclient_wlan0.conf $IFACE
wpa-conf /etc/network/wlan0_wpa.conf
...where /etc/network/dhclient_wlan0.conf is based on the default DHCP conf, but sans routers and any ...static-routes options:
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
ntp-servers;
timeout 300;
It still sets two default routes.
I added this to the custom DHCP configuration file:
interface wlan0
supersede routers ""
IT STILL SETS TWO DEFAULT ROUTES.
Why does DHCP still add a default route with this custom config? What do I need to do so that wlan0 can get an address via DHCP but isn't the default interface?
networking dhcp
asked Apr 29 at 13:22
detly
1,35341423
1,35341423
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f440727%2favoid-setting-a-default-route-for-a-dhcp-managed-interface%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password