Bridge interface - add default route

9,893

The default gateway normally gets updated by dhcp.

However, in your /etc/network/interfaces, you state that, for br0 the inet is static. You specify explicitly the IP address, netmask and gateway. So, no dhcp request is done for this interface.

If you want the default gateway updated, specify as:

auto br0
    iface br0 inet dhcp
    bridge_ports eth0
Share:
9,893

Related videos on Youtube

Jeff Schaller
Author by

Jeff Schaller

Unix Systems administrator http://www.catb.org/esr/faqs/smart-questions.html http://unix.stackexchange.com/help/how-to-ask http://sscce.org/ http://stackoverflow.com/help/mcve

Updated on September 18, 2022

Comments

  • Jeff Schaller
    Jeff Schaller over 1 year

    I used to connect my Ubuntu 14.04 laptop on office network via eth0 and the route table gets updated with the office network gateway IP in auto mode.

    Now, I changed my /etc/network/interfaces configuration to add a bridge interface, br0, and made eth0 as a dumb port inside br0. My /etc/network/interfaces has:

    iface br0 inet static
       address X.X.X.X
       netmask 255.255.0.0
       bridge_ports eth0
       bridge_stp on
       bridge_fd 0
       gateway X.X.X.X
    

    My route table is no longer getting updated. Every time I plug in my ethernet cable, I need to do:

    route add default gw X.X.X.X br0

    How to configure the default gateway for a bridge?

    • ph0t0nix
      ph0t0nix over 7 years
      I have the same problem on a machine with Ubuntu 16.04. In fact, the default gateway is created, but it uses the eth0 device underlying the bridge and this interface is marked as down. Manually setting the default gateway as mentioned in the question works.