# "default" gateway interface confusion on laptop



## Azmadaeus (Feb 2, 2010)

So, I have FreeBSD 8-Stable running on a Thinkpad; my rc.conf contains:


```
ifconfig_ath0="WPA DHCP"
wlans_ath0="wlan0 wlan1"
ifconfig_wlan0="DHCP WPA"
create_args_wlan1="wlanmode monitor"
ifconfig_em0="DHCP"
```

when I reboot, my laptop sets the default route inteface to wlan0. When I update it with:


```
ifconfig em0 up
```

and then


```
dhclient em0
```

the routing tables do not update. When I do:



```
route change default -host 192.168.1.1 -interface em0
```

the routing tables change, but the existing traffic grinds to a halt. I need to


```
ifconfig wlan0 0.0.0.0 down
```

to get the interface to really be active, but then, existing traffic is shut down.

All I am trying to accomplish here is to switch between wireless and wired, so I use wireless by default, and switch to wired when it's available for higher bandwidth.


----------



## phoenix (Feb 2, 2010)

If you want connections to continue when the active interface changes, you need to configure them into a single logical connection using lagg(4):

```
wlans_ath0="wlan0"
ifconfig_wlan0="WPA up"
ifconfig_em0="up"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport em0 laggport wlan0 DHCP"
```
That will configure the wireless interface to use WPA, and configure the wired interface as "up", and join them together into a *lagg0* interface.

The wired interface is marked as the master, the wireless as the slave.  This means that if the wired link is connected, traffic goes across it, even if the wireless link is also connected.  And if the wired link is disconnected, all traffic falls back to the wireless connection.

This also shares 1 IP and 1 routing table and 1 dhclient process, instead of having separate ones for each interface.


----------

