There is no provision for specifically handling virtual dual interfaces
type veth. So a bit of tinkering is in order mainly by using the
pre-up option. I kept
veth1 here, but you should really consider choosing any other names (eg
veth-lanbr0), because those are the default names chosen if not supplied (eg:
ip link add type veth), and they might clash.
iface veth0 inet manual
pre-up ip link add veth0 type veth peer name veth1 || :
iface veth1 inet manual
pre-up ip link add veth1 type veth peer name veth0 || :
This enables both interface when bringing up any of them. The
|| : is here to not fail because the peer interface was already set up by the "other" interface. Please note that for
ifup's internal state's sake, both should be brought up in the end even if bringing up one will make the other appear. For the intended usage, the
hwaddress is probably optional and can anyway be set to any other correct value. The bridge takes the MAC address of the first enslaved interface.
Now use them in the bridges. I won't put all your setup (because you didn't really give it), just the
veth related parts. You will have to adapt what I couldn't guess and where I left some
... (eg, is
inet static or
iface br0 inet XXXX
pre-up ifup veth0
bridge_ports eth0 veth0
iface lanbr0 inet XXXX
pre-up ifup veth1
bridge_ports veth1 eth1
Note I prepended an
ifup vethX command inside, because else it will complain the interface didn't exist, will bring up the bridge without this interface and consider it done. I didn't have to use
|| : here because bringing up an already logically (meaning
ifupdown's state) up interface isn't an error.
After completing the missing parts, put these in separate (or not) configuration files in
/etc/network/interfaces.d (or even
/etc/network/interfaces) and that should be working.
If it didn't work at first, try bringing logically down all interfaces (by logically I mean using
ifdown) and try again: that would be because of a wrong logical state preventing some interfaces to be (re)configured correctly.
Also note that there might be interactions with other network managers, like... NetworkManager. There are probably options to have them ignore some interfaces, but that's out of the scope of this answer.