# Ifconfig differences despite same config



## Janusz (May 13, 2019)

Hi All. I'm setting up a new router and troubleshooting port redirection. I picked up on an odd difference in ifconfig and couldn't find any sensible explanation online.

Here's the interface config in /etc/rc.conf:


```
ifconfig_bge0="inet 10.5.5.3 netmask 255.255.255.0"
ifconfig_bge1="inet 10.5.5.2 netmask 255.255.255.0"
defaultrouter="10.5.5.1"
netwait_enable="YES"
netwait_ip="10.5.5.1"
netwait_if="bge1" 
netwait_if="bge0" // Q: I've added the second netwait_if today - found no data on whether multiple interfaces can be specified?
```

Here's the ifconfig output:


```
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
    ether 1c:98:ec:0f:4d:74
    hwaddr 1c:98:ec:0f:4d:74
    inet 10.5.5.3 netmask 0xffffffff broadcast 10.5.5.3 
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
    ether 1c:98:ec:0f:4d:75
    hwaddr 1c:98:ec:0f:4d:75
    inet 10.5.5.2 netmask 0xffffff00 broadcast 10.5.5.255 
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
```

  inet 10.5.5.3 netmask *0xffffffff broadcast 10.5.5.3 *
   inet 10.5.5.2 netmask *0xffffff00 broadcast 10.5.5.255 *

Why the difference? I don't want to manually specify these settings as I suspect there's something else I need to fix...


----------



## SirDice (May 13, 2019)

Both interfaces are on the same network, that's a bad idea to start with. Routing only works if interfaces are on _different_ networks.


----------



## Janusz (May 13, 2019)

OK, but (1) the routing is not performed by the BSD box, (2) to the router they're just two interfaces - separate hosts for all it cares, (3) it seemed to be working fine with another router (which is not to say that it worked in an optimal way... I've only picked up on these differences now, they might've been there for ages). Also, I'm still in the dark as to where the difference comes from?


----------



## SirDice (May 13, 2019)

Janusz said:


> the routing is not performed by the BSD box


Routing is _always_ involved. How does it know what's local and what's not? How does it figure out where to send packets to that aren't local? This is what routing does.

Lets assume you configure it like bge0: 192.168.10.1/24 and bge1: 192.168.10.2/24. Now the system receives a packet destined for 192.168.10.12, how does it know on which interface the 192.168.10.0/24 network is connected? It has two interfaces to choose from. Does it pick the first one? Which is the first one? With bge0 and bge1 this looks easy to determine but what if it's bge0 and em0? This kind of ambiguity needs to be avoided and FreeBSD simply doesn't allow you to configure it that way.


----------



## Janusz (May 13, 2019)

I see your point. I'll need to rectify addressing. Thank you.


----------



## malavon (May 13, 2019)

You can also configure a teaming configuration, two interfaces connecting to the same network and splitting the load.


----------

