0

I have 2 interfaces:

  • wlan0: Connected to normal network with DHCP (has internet)
  • eth0: Connected to LAN only. Used for PXE boot and NFS

The network-manager service is not installed on this machine.

If I leave /etc/network/interfaces totally blank, both interfaces come up OK but each has a default gateway set. I run ip route:

default via 192.168.10.1 dev eth0 src 192.168.10.100 metric 202
default via 192.168.0.1 dev wlan0 src 192.168.0.20 metric 303
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.20 metric 303
192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.100 metric 202

The default route on 192.168.10.1 is in the way of internet connectivity. If I run sudo route del default and the ip route again:

default via 192.168.0.1 dev wlan0 src 192.168.0.20 metric 303
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.20 metric 303
192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.100 metric 202

Everything is good:

adam@sheep:~$ ping google.com
PING google.com (172.217.5.238) 56(84) bytes of data.
64 bytes from iad30s07-in-f238.1e100.net (172.217.5.238): icmp_seq=1 ttl=54 time=38.3 ms
64 bytes from iad30s07-in-f238.1e100.net (172.217.5.238): icmp_seq=2 ttl=54 time=38.7 ms

If I put anything at all in /etc/network/interfaces, wlan0 will not come up and the machine hangs at this boot step for about a minute: a start job is running for Raise network interfaces. Even this fails:

auto wlan0
iface wlan0 inet dhcp


auto eth0
iface eth0 inet dhcp
  1. Am I missing something? Have I configured something incorrectly?
  2. How do I get that default route on eth0 to never be set in the first place?

I get the feeling the end solution looks something like this:

auto wlan0
iface wlan0 inet dhcp


auto eth0
iface eth0 inet dhcp
up route del default

but I'm currently stuck because even a more basic config fails.

  • You need to fix this in the router, not in the host. – Michael Hampton Apr 7 at 5:10
  • Could you provide more detail? I assume you're talking about the PXE server (which is serving DHCP that eth0 is connected to, but it's not clear from your comment. – Adam Brakhane Apr 7 at 5:14
  • Your wired network has some DHCP server which is assigning a gateway address, and should not be. – Michael Hampton Apr 7 at 14:03
  • Got it. I'll look into changing that. – Adam Brakhane Apr 7 at 17:06
  • That's it! I had to convince my dnsmasq dhcp server to stop sending out gateway and dns addresses. – Adam Brakhane Apr 7 at 18:22
0

My problem was with the dnsmasq configuration on the PXE server. It was sending out a gateway address so even when that address was removed from a client, it would eventually be resent as the client got a new DHCP lease. The permanent fix suggested by Michael Hampton is to stop the DHCP server from suggesting a gateway.

I had

# DHCP server for PXE
interface=eno1
dhcp-range=192.168.10.50,192.168.10.150,12h
dhcp-option=66,192.168.10.1 #option 66 sets the address of the TFTP server

but needed to explicitly disable the gateway address from being sent:

interface=eno1
dhcp-range=192.168.10.50,192.168.10.150,12h
dhcp-option=66,192.168.10.1 # option 66 sets the address of the TFTP server
dhcp-option=3
dhcp-option=6

This sets the gateway (option 3) and dns (option 6) to nil

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.