Skip to main content

Setup bridge

/etc/network/interfaces

auto lo
iface lo inet loopback

iface lo inet6 loopback

auto $PHYSICAL_IFACE
iface $PHYSICAL_IFACE inet static
        address $IPV4_ADDRESS
        netmask $IPV4_NETMASK
        gateway $IPV4_GATEWAY
        up route add -net $ROUTE_NET4 netmask $IPV4_NETMASK gw $IPV4_GATEWAY dev $PHYSICAL_IFACE

iface $PHYSICAL_IFACE inet6 static
        address $IPV6_ADDRESS
        gateway $IPV6_GATEWAY

auto $BRIDGE_IFACE
iface $BRIDGE_IFACE inet manual
    bridge_ports $PHYSICAL_IFACE
    bridge_stp off
    bridge_fd 0

iface $BRIDGE_IFACE inet6 manual
    bridge_ports $PHYSICAL_IFACE
    bridge_stp off
    bridge_fd 0

Apply the configuration

sudo ifreload -a
# or
sudo systemctl restart networking

What each variable means

Variable Description
$PHYSICAL_IFACE Your physical network interface name
$BRIDGE_IFACE The name of your bridge (e.g., vmbr0)
$IPV4_ADDRESS Your static IPv4 address
$IPV4_NETMASK Your subnet mask (e.g., 255.255.255.0)
$IPV4_GATEWAY Your IPv4 gateway
$ROUTE_NET4 The routed subnet or block
$IPV6_ADDRESS Your static IPv6 address
$IPV6_GATEWAY Your IPv6 gateway