Score:1

Add persistent bridge and tap in ubuntu 20.04 server

cd flag

I'm trying to create a bridge whose interface is a tap, both with static IPs, and have them persist across reboots.

In Ubuntu 14.04.6 LTS, this could be accomplished by editing /etc/network/interfaces as such:

auto br0
iface br0 inet static
    address 0.0.0.0
    bridge_ports tap0

auto tap0
iface tap0 inet static
    address 0.0.0.0
    pre-up /usr/sbin/tunctl -t tap0

and running

brctl addbr br0
tunctl -t tap0
brctl addif br0 tap0

on the command line.

Then, when you run bridge link you get the following output:

4: tap0 state UP : <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 master br0 state
forwarding priority 32 cost 100 

But since Ubuntu 20.04 has deprecated the use of /etc/network/interfaces in favor of netplan, I don't know how to set it up.

I've tried setting /etc/netplan/00-installer-config.yml to the following:

...
bridges:
  br0:
    addresses: [0.0.0.0/24]
    gateway4: 10.0.2.15
    nameservers:
      addresses: [8.8.8.8]

and running netplan apply followed by

ip tuntap add mode tap tap0
ip link tap0 master br0

I've tried running

ip link add name br0 type bridge
ip link set dev br0 up
ip tuntap add mode tpa tap0
ip link set tap0 master br0

I've even tried adding tap0 as an ethernet interface in /etc/netplan/00-installer-config.yaml, but no matter what I do, when I run bridge link

I get

4: tap0: <BROADCAST,MULTICAST> mtu 1500 master br0 state disabled priority 32 cost 100 

How can I get this configured correctly? I've tried everything I've seen online, and no matter what I do I can't get the tap to go from state disabled to state forwarding. I'm open to any ideas someone might have. I don't have experience with this type of thing so I'm really at a loss for what the issue even is. Please help

Edit:

I believe the tap is to setup OpenVPN with TAP bridging. OpenVPN uses a tap called tap0 when setup in TAP mode. I'm new to this codebase, and to working with servers/networking in general, and am only working on setting up the server, so to be completely honest don't know exactly if there's something else going on.

Leshawn Rice avatar
cd flag
I still have no idea how to do this, any help would be appreciated
anx avatar
fr flag
anx
Have you confirmed the displayed "state" value interferes with what you want to accomplish? I would argue a tap currently not forwarding is more correctly described as "disabled" than as "forwarding".
Leshawn Rice avatar
cd flag
@anx yes, in the servers on Ubuntu 14.04 that are up and configured correctly, the output of `bridge link` is `4: tap0 state UP : <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 master br0 state forwarding priority 32 cost 100 `
Leshawn Rice avatar
cd flag
@anx edited. thank you for your help
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.