Date: Fri, 26 Sep 2014 15:42:50 +0200 From: =?ISO-8859-1?Q?Olivier_Cochard=2DLabb=E9?= <olivier@cochard.me> To: freebsd-doc@freebsd.org Subject: Ethernet Wifi failover Message-ID: <CA%2Bq%2BTcppQNL_ga%2BPZHL%2B9A7NCsWHPiJnkQSCeNm8EGwSnDdzww@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hi,
here is an old post from my blog that can useful on the documentation.
I want a simple behavior with my laptop:
1. If Ethernet cable connected use this connectivity, otherwise use the
wireless;
2. I want to kept the same IP addresses, event if I'm using DHCP client.
The solution is quiet simple:
1. set-up an aggregate interface in failover mode with Ethernet as
primary and wireless as backup;
2. Put the Ethernet NIC MAC address on the wireless NIC.
Here are how to do it:
# *ifconfig -l*
iwn0 bge0 lo0
=> My Ethernet NIC is "bge0" and wireless is "iwn0" here
# *set MAC=`ifconfig bge0 | grep ether | cut -d ' ' -f 2`*
# *sysrc ifconfig_bge0=up*
ifconfig_bge0: -> up
# *sysrc wlans_iwn0=wlan0*
wlans_iwn0: -> wlan0
# *sysrc ifconfig_iwn0="ether $MAC"*
ifconfig_iwn0: -> ether 00:1c:23:25:ab:45
# *sysrc ifconfig_wlan0="WPA up"*
ifconfig_wlan0: WPA DHCP -> WPA up
# *sysrc cloned_interfaces=lagg0*
cloned_interfaces: -> lagg0
# *sysrc ifconfig_lagg0="laggproto failover laggport bge0 laggport wlan0
DHCP"*
ifconfig_lagg0: -> laggproto failover laggport bge0 laggport wlan0 DHCP
# *sysrc ifconfig_lagg0_ipv6="inet6 accept_rtadv"*
ifconfig_lagg0_ipv6: -> inet6 accept_rtadv
# *service netif restart*
And now with Ethernet cable unplugged:
# *ifconfig lagg0*
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:1c:23:25:ab:45
inet6 fe80::41d:23ff:fe25:ab78%lagg0 prefixlen 64 scopeid 0x4
inet6 2a01:e35:9b9d:a1a0:41d:23ff:fe25:ab45 prefixlen 64 autoconf
inet 192.168.100.7 netmask 0xffffff00 broadcast 192.168.100.255
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect
status: active
laggproto failover lagghash l2,l3,l4
laggport: wlan0 flags=4<ACTIVE>
laggport: bge0 flags=1<MASTER>
Then If I plug the Ethernet cable:
# ifconfig lagg0
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:1c:23:25:ab:45
inet6 fe80::41d:23ff:fe25:ab45%lagg0 prefixlen 64 scopeid 0x4
inet6 2a01:e35:9b9d:a1a0:41d:23ff:fe25:ab45 prefixlen 64 autoconf
inet 192.168.100.7 netmask 0xffffff00 broadcast 192.168.100.255
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
media: Ethernet autoselect
status: active
laggproto failover lagghash l2,l3,l4
laggport: wlan0 flags=0<>
laggport: bge0 flags=5<MASTER,ACTIVE>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2Bq%2BTcppQNL_ga%2BPZHL%2B9A7NCsWHPiJnkQSCeNm8EGwSnDdzww>
