# Bridge Configuration Not Working



## qPs1_ (May 8, 2021)

I have a six port Mini PC that I'm using as my firewall with pf.   Interface 0  is the WAN connection to the internet. After finally figuring out that bridge is what is used to group ports together on FreeBSD and not vlan I setup bridge1 interface to group interfaces 3/4/5 together on their own subnet.  I have my wireless AP on interface 1 with its own subnet.  

I changed the network config on my NAS and moved it to interface 5 however I am not able to reach it.  The bridge interface doesn't show any members. I believe I have everything setup correctly but no connectivity from the bridge1 interface.

kldstat shows that the modules are loaded...  rc.conf looks correct. pf.conf is setup to allow traffic to pass ... not sure what the issue could be.  

config info below..

rc.conf

```
# LAN 2
cloned_interfaces="bridge1"
ifconfig_bridge1="addm igb3 addm igb4 addm igb5 up"
ifconfig_bridge1="inet 10.11.17.129 netmask 255.255.255.192"
ifconfig_igb3="up"
ifconfig_igb4="up"
ifconfig_igb5="up"
```
pf.conf

```
table <int_ntwk> { 10.11.17.0/26 10.11.17.128/26 }
pass in log inet from <int_ntwk> to any keep state
```


```
ifconfig bridge1
bridge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 58:9c:fc:10:ff:87
    inet 10.11.17.129 netmask 0xffffffc0 broadcast 10.11.17.191
    id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
    maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
    root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
    groups: bridge
    nd6 options=9<PERFORMNUD,IFDISABLED>

igb3: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=4e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
    ether 40:62:31:14:84:af
    media: Ethernet autoselect
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

igb4: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=4e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
    ether 40:62:31:14:84:b0
    media: Ethernet autoselect
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

igb5: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=4e527bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
    ether 40:62:31:14:84:b1
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
```

`netstat -rn`

```
Internet:
Destination        Gateway            Flags     Netif Expire
10.11.17.0/26      link#2             U              igb1
10.11.17.1         link#2               UHS         lo0
10.11.17.128/26    link#9             U         bridge1
10.11.17.129       link#9             UHS         lo0
```



thx

-jbw


----------



## datasmurf (May 8, 2021)

```
ifconfig_bridge1="inet 10.11.17.129 netmask 255.255.255.192"
ifconfig_bridge1="addm igb3 addm igb4 addm igb5 up"
```

Add the members after ip/net assignment.

Edit: See Post #5 for correct information.


----------



## SirDice (May 9, 2021)

Things in rc.conf are _variables_, rc.conf is a shell script that gets sourced a number of times by various rc(8) scripts. If you reassign a variable the original information is lost. 


```
#!/bin/sh

var1="foo"
var1="bar"

echo $var1
```


----------



## qPs1_ (May 10, 2021)

datasmurf said:


> ```
> ifconfig_bridge1="inet 10.11.17.129 netmask 255.255.255.192"
> ifconfig_bridge1="addm igb3 addm igb4 addm igb5 up"
> ```
> ...


Thanks, that simple change fixed the issue....   much appreciated....


----------



## SirDice (May 10, 2021)

Actually, it doesn't fix your issue. All this does is create the bridge but now it doesn't get an IP address anymore. 


```
ifconfig_bridge1="addm igb3 addm igb4 addm igb5 inet 10.11.17.129 netmask 255.255.255.192"
```
That fixes the issue. 
Or to make it a little easier to read:

```
ifconfig_bridge1="addm igb3 addm igb4 addm igb5"
ifconfig_bridge1=" inet 10.11.17.129 netmask 255.255.255.192"
```
Note the `+=`:

```
#!/bin/sh

var1="foo"
var1+=" bar"

echo $var1
```
Sorry, doesn't work with sh(1).


----------



## datasmurf (May 10, 2021)

qPs1_  Seems that my advice was not accurate after all, sorry for that. Better to follow SirDice 's 1st example instead. .

SirDice I can't say that your 2nd example `+=` works for me. However, it works with _bash_ but not with `/bin/sh`


----------



## SirDice (May 10, 2021)

Hmm. You're right. It only works for make(1) that way.


----------



## qPs1_ (May 11, 2021)

SirDice said:


> Actually, it doesn't fix your issue. All this does is create the bridge but now it doesn't get an IP address anymore.
> 
> 
> ```
> ...


Yes, I did see that I needed to configure the IP address manually and performing a reboot. The bridge interface was up but no IP configuration.   I'll try this and see if it works.


----------



## qPs1_ (May 14, 2021)

Tried that line and it still didn't work.   ifconfig_bridge1="addm igb3 addm igb4 addm igb5 inet 10.11.17.129 netmask 255.255.255.192"

It only brought up the first bridge interface (I have two) and with no IP address configuration and no members...  In fact it said it couldn't find the third interface..

I took off the IP config info from the bridge statement.  leaving it like this ifconfig_bridge1="addm igb3 addm igb4 addm igb5 up".   It now. found igb3  but still only creates bridge1 with no IP configuration. It doesn't create the bridge0 interface....

Is this some sort of bug...


----------

