I’m using a Beaglebone Black running a webserver on a Debian system. The BBB is working as a DHCP + DNS (using dnsmasq) in a local network (192.168.5.xyz) with no direct internet access. I can easily connect devices that retrieve an IP from the BBB. So far so good.
In case I’m at home for example, I’d like to add internet access to this little network. So I connect this network to a router that provides internet access and has a static IP address (192.168.5.254) within this network. So I added the router’s IP to the /etc/network/interfaces file:
/etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto eth0
#iface eth0 inet dhcp
allow-hotplug eth0
iface eth0 inet static
address 192.168.5.1
netmask 255.255.255.0
gateway 192.168.5.254
But for some reason an extra default routing entry is added whenever I reboot my BBB. When I manually delete/flush the default entry with GW 0.0.0.0 everything works fine.
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 0.0.0.0 0.0.0.0 U 0 0 0 eth0
default 192.168.5.254 0.0.0.0 UG 0 0 0 eth0
link-local 0.0.0.0 255.255.0.0 U 0 0 0 eth0
192.168.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
It seems that the unwanted default gateway is added during boot: journalctl -b:
…
Nov 06 11:29:40 webserver connmand[1827]: eth0 {add} address 192.168.5.1/24 label eth0 family 2
Nov 06 11:29:40 webserver avahi-daemon[1792]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.5.1.
Nov 06 11:29:40 webserver connmand[1827]: eth0 {add} route 192.168.5.0 gw 0.0.0.0 scope 253 <LINK>
Nov 06 11:29:40 webserver avahi-daemon[1792]: New relevant interface eth0.IPv4 for mDNS.
Nov 06 11:29:40 webserver avahi-daemon[1792]: Registering new address record for 192.168.5.1 on eth0.IPv4.
Nov 06 11:29:40 webserver connmand[1827]: eth0 {add} route 0.0.0.0 gw 192.168.5.254 scope 0 <UNIVERSE>
…
I can also the the "wanted" routings I made in /etc/network/interfaces. These are also made by the Connman Deamon. But the /etc/connman/main.conf is apparently not the file that is causing the default route with gateway 0.0.0.0:
[General]
PreferredTechnologies=ethernet,wifi
SingleConnectedTechnology=false
AllowHostnameUpdates=false
PersistentTetheringMode=true
NetworkInterfaceBlacklist=SoftAp0,usb0,usb1
Do you have any hints how to find out where the extra route is added and how to prevent it? I've already looked through several sripts that are called during boot but couldn't find it... Or is the way I'm setting up eth0 completely wrong?