default gateway not set when using bond0 interface
This is my
auto bond0 iface bond0 inet manual address 10.66.7.11/24 gateway 10.66.7.1 bond-mode 802.3ad bond-slaves eth2 eth3 bond-miimon 100 bond-downdelay 200 bond-updelay 400 bond-lacp-rate 1 up ifconfig bond0 10.66.7.11/24 up
when I bring the bond0 interface up, it works, but the default gateway is not set
# route -n Destination Gateway Genmask Flags Metric Ref Use Iface 10.66.7.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
I have to set the default gateway manually, and then everything works fine:
route add default gw 10.66.7.1 bond0 #route -n Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.66.7.1 0.0.0.0 UG 0 0 0 bond0 10.66.7.0 0.0.0.0 255.255.255.0 U 0 0 0 bond0
why is my default gateway not set automatically, when I have it defined in the
/etc/network/interfaces file ?
The bond0 stanza should not use the keyword
This method may be used to define interfaces for which no
configuration is done by default. Such interfaces can be configured
manually by means of
which will configure bond0‘s bond properties (on Debian probably through the
ifenslave package which adds plugin scripts in
/etc/network/if-*.d) but not IP properties.
So nothing is done: both
gateway options are ignored but manual commands brought through
up scripts are executed, such as:
up ifconfig bond0 10.66.7.11/24 up
which manually runs a command which happens to be adding an address on bond0: that’s why bond0 has an address, the LAN route automatically added by the kernel from this address, and no gateway.
static (which will still do what the
manual method would do but will also configure IPv4 with
inet static) should have been used:
This method may be used to define Ethernet interfaces with statically
allocated IPv4 addresses.
to have ifupdown configure IP addresses and the default gateway on it.
So simply replace
static and remove the non-needed
up entry. The configuration should then be:
auto bond0 iface bond0 inet static address 10.66.7.11/24 gateway 10.66.7.1 bond-mode 802.3ad bond-slaves eth2 eth3 bond-miimon 100 bond-downdelay 200 bond-updelay 400 bond-lacp-rate 1