# Renamed bridge with static address



## hiryu (Feb 16, 2021)

I setup bridging last night to get vnet working and ran into a *general* issue. Here's my bridging config:


```
ifconfig_bridge0_name="igb0bridge"
ifconfig_igb0="up"
ifconfig_igb0_ipv6="up"
ifconfig_igb0bridge="inet 192.168.1.2 netmask 255.255.255.0 addm igb0 up"
ifconfig_igb0bridge_ipv6="inet6 XXXX:YYYY:ZZZZ:::AAAA prefixlen 64 accept_rtadv auto_linklocal"
```

This all works, but has its problems. If, for example, you run `/etc/rc.d/netif restart`, igb0bridge fails to come back up because igb0 is already is already a member of igb0bridge causing the underlying call to `ifconfig` and as a result, igb0bridge will not have an IPv4 address. The IPv6 address is still there, because in my config above, `ifconfig_igb0bridge_ipv6="inet6 XXXX:YYYY:ZZZZ:::AAAA prefixlen 64 accept_rtadv auto_linklocal"`, isn't attempting to add any interfaces.

But this only seems to occur if I rename the bridge (which I'm doing to use the convenient /usr/share/examples/jails/jib script to accommodate vnet management with jails).

Running `/etc/rc.d/netif restart`, I see some errors:

```
ifconfig: interface bridge0 already exists
ifconfig: BRDGADD igb0: File exists
Starting Network: lo0 igb0 igb0bridge.
```

It seems there's confusion as to the name of the bridge when the bridge is renamed so things break when it tries to recreate a bridge that's already there as well as add an interface that's already a member.

If I don't rename bridge0, running `/etc/rc.d/netif restart`, the relevant portion of the output changes in important ways:

```
Destroyed clone interfaces: bridge0.
Created clone interfaces: bridge0.
ifconfig: BRDGADD igb0: File exists
Starting Network: lo0 igb0 bridge0.
```

When the bridge hasn't been renamed, the bridge is correctly destroyed and the recreated bridged interface has both its IPv4 and IPv6 addresses. The problem seems to only impact bridges that have been renamed. However, there still does seem to be an erroneous attempt to re-add igb0 to the bridge when there is no renaming.

I don't need to reset the network settings on this box very often at all, so it's not a blocker by any means, but this also should not happen. I was able to reproduce this exactly on a different box without any jails or vnet while still renaming the bridge.

Is there a better way to use the jib script? A better way to configure a renamed bridge? Or should this be a bug report?


----------

