# bridge not attaching child



## junialter (Nov 1, 2021)

Hi,
I setup a freshly installed FreeBSD 13.0 as KVM guest.
The system has one network interface, i.e. vtnet0

I want vtnet0 to be attached to a bridge0f and have my IP addresses set to the bridge instead of vtnet0.
This is the configuration I came up with.


```
cloned_interfaces="bridge0"
ifconfig_bridge0="addm vtnet0 up"
ifconfig_vtnet0="up"
ifconfig_bridge0="inet 10.10.129.8 netmask 255.255.255.0"
ifconfig_bridge0_ipv6="inet6 2001:1234:4321:7300::f prefixlen 64 auto_linklocal"
defaultrouter="10.10.129.1"
ipv6_defaultrouter="2001:1234:4321:7300::1"
```

Yet every time the system  boots it does not have vtnet0 attached to bridge0, thus the interface not coming up properly.
If I run `ifconfig bridge0 addm vtnet0 up` manually after boot, everything is connected after all.
Am I missing something?


----------



## SirDice (Nov 1, 2021)

You're defining `ifconfig_bridge0` twice.


```
ifconfig_bridge0="addm vtnet0 up"

ifconfig_bridge0="inet 10.10.129.8 netmask 255.255.255.0"
```

Note that rc.conf is essentially a shell script containing variables.


```
#!/bin/sh

FOO="bar"
FOO="not bar"

echo $FOO
```


----------



## bakul (Nov 1, 2021)

Instead of the old style "addm" etc. I have these lines in my /etc/rc.conf:
`autobridge_interfaces="bridge0"
autobridge_bridge0="tap* igb0"
ifconfig_igb0="up"
ifconfig_bridge0="inet xxx.yyy.zzz.www netmask 255.255.255.0"
cloned_interfaces="bridge0"`
Replace igb0 with vtnet0.


----------



## junialter (Nov 27, 2021)

Well after giving up on this topic with this particular host I just struggled with the same problem on a different host, also having this problem.
The weird thing is that this config worked for months without having issues but suddenly problems arose.
Three network interfaces all attached to a particular bridge, but only one of those bridges fails to get its parent connected.

I switched to this autobridge method which seems to work.
I gotta admit though that this stuff is really annoying. How can it be so hard just to handle bridging with FreeBSD?
Why isn't this autobridge directive documented if the addm style is the "old" one?


----------

