ifconfig_bridge with tap not working in rc.conf

Hi All,

I have the following setup in rc.conf to bring up the bridge and taps so that bhyve VMs have Internet access. I am using FreeBSD 12.1-RELEASE.

Code:
cloned_interfaces="bridge1"
cloned_interfaces="bridge1 tap2"
cloned_interfaces="bridge1 tap3"
ifconfig_bridge1="addm bce0 addm tap2 addm tap3 up"

I have the following in /etc/boot/loader.conf too:
Code:
if_bridge_load="YES"
if_tap_load="YES"

But it is not working and each time it boots I have to manually run the following to make it work:

ifconfig bridge create;ifconfig bridge1 addm tap3;ifconfig tap2 create;ifconfig bridge1 addm tap2;

Also it seems that if I use bridge0 it is ignored and system only recognizes bridge1 and up.

Any help is appreciated.
 
In rc.conf, what you set are just variables. If you set several times cloned_interfaces, it can't work. Try:
cloned_interfaces="bridge1 tap2 tap3"
 
What Emrion said will be the root cause, as an optimization/config file clean-up you don't need to specify the drivers below.
They will be auto loaded by ifconfig when the interfaces are created.

Code:
if_bridge_load="YES"
if_tap_load="YES"
 
In rc.conf, what you set are just variables. If you set several times cloned_interfaces, it can't work. Try:
cloned_interfaces="bridge1 tap2 tap3"

Tried but doesn't work. I found the following in dmesg:

Code:
# dmesg | grep tap
tap3: Ethernet address: 58:9c:fc:10:a4:33
tap3: link state changed to UP
tap3: promiscuous mode enabled
tap2: Ethernet address: 58:9c:fc:10:d5:01
tap2: promiscuous mode enabled
# dmesg | grep bridge1
bridge1: Ethernet address: 58:9c:fc:10:ff:9a
bridge1: link state changed to UP

tap3 is up but tap2 is not. It also shows bridge1 is up but ifconfig doesn't show bridge1 info.
 
First, leave cloned_interfaces as I show you.

It isn't clear why you use bridge1 and not bridge0; tap2 & 3 instead of tap0 & 1.
I think you should explain what you want to achieve.

For the tap interfaces you can try to add in rc.conf:
ifconfig_tap2="up" ifconfig_tap3="up"
 
The reason of not using bridge0 is it doesn't work. If I change all bridge1 in /etc/rc.conf to bridge0 nothing happens either. Until I run ifconfig bridge create which gives output bridge1 .

I tried adding after

Code:
ifconfig_tap2="up"
ifconfig_tap3="up"

It doesn't work either.
 
What are you doing? You can't get (cloned) interfaces for tapX unless there is a genuine service requing them - vm, openvpn,etc.
And for the bridges, what are the member interfaces - em0, ix1,etc? Do they exist? Bce0! What is it? You would see them with the ifconfig command if we'll defined.
 
What are you doing? You can't get (cloned) interfaces for tapX unless there is a genuine service requing them - vm, openvpn,etc.
And for the bridges, what are the member interfaces - em0, ix1,etc? Do they exist? Bce0! What is it? You would see them with the ifconfig command if we'll defined.

bce0 and bce1 are the NICs comes with the physical machine.

bridge is the root of the problem. It is not created at boot.
 
This should work:
Code:
cloned_interfaces="bridge1 tap2 tap3"
ifconfig_bridge1="addm bce0 addm tap2 addm tap3 up"
ifconfig_bridge1="inet 192.168.0.1/24 ether 00:00:00:0c:00:0f"
Adding an arbitrary ether address could make a difference and so is an IP address.
You can alternatively drop the lines in a shell script and run after boot up - rc.local may work too. So you can try three options - additional changes to rc.conf, new shell script or rc.local

Do read about bridging to:
Code:
31.5.4. Enabling the Bridge
Add the line:

net.link.ether.bridge.enable=1
to /etc/sysctl.conf to enable the bridge at runtime, and the line:

net.link.ether.bridge.config=if1,if2
to enable bridging on the specified interfaces (replace if1 and if2 with the names of your two network interfaces).
 
Back
Top