Simple question regarding routes order

My route table on my laptop is this:

Code:
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            10.0.0.1           UGS         0       54  wlan0
10.0.0.0/24        link#4             U           4  8562069  wlan0
10.0.0.104         link#4             UHS         0        0    lo0
10.0.0.178         link#1             UHS         0        0    lo0 =>
10.0.0.178/32      link#1             U           0        0    re0
127.0.0.1          link#3             UH          0       90    lo0

I have a WIFI card (wlan0 and re0).

Here is an ifconfig output:

Code:
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 1 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST
,WOL_MCAST,WOL_MAGIC>
        inet 10.0.0.178 netmask 0xffffffff broadcast 10.0.0.178
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
iwn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 1 mtu 2290
        ether 00:1d:e0:20:76:83
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
        status: associated
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet6 ::1 prefixlen 128 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 1 mtu 1500
        ether 00:1d:e0:20:76:83
        inet 10.0.0.104 netmask 0xffffff00 broadcast 10.0.0.255
        media: IEEE 802.11 Wireless Ethernet OFDM/54Mbps mode 11g
        status: associated
        ssid Ethernet channel 6 (2437 MHz 11g) bssid 00:19:5b:75:fb:dd
        country US authmode WPA privacy ON deftxkey UNDEF AES-CCM 2:128-bit
        AES-CCM 3:128-bit txpower 15 bmiss 10 scanvalid 450 bgscan
        bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS
        wme roaming MANUAL

I've changed metrics for iwn0 and wlan0 to be 1 instead of 0 with:

Code:
ifconfig iwn0 metric 1
ifconfig wlan0 metric 1

What I want to achieve is this:
- when I connect an Ethernet cable (re0) and copy files to use Ethernet connection instead of WIFI
- when Ethernet cable is unplugged the LAN traffic to go via WIFI

Now all traffic goes to WIFI, and it does not take into consideration the metrics of network interfaces.

The IP of re0 is in the same subnet as the one on WIFI interface and is an alias with netmask 255.255.255.255.

I know this is simple, but I did not find an answer by searching/reading manuals.
 
Thank You! Problem Solved.

I configured like in your link.

The example for /etc/rc.conf was useful.
Using that example I've figured out that I must set no IPs on both interfaces and then set the IP on lagg.

I had a problem with WIFI. Both network interfaces must have same MAC but WIFI MAC change is not working (I was using WPA). So I've changed instead MAC of Ethernet interface to be the same as WIFI interface.

My (working) rc.conf is now:

Code:
defaultrouter="10.0.0.1"
hostname="laptop"

ifconfig_re0="up"
ifconfig_re0_alias0="ether 00:1d:e0:10:57:93"

wlans_iwn0="wlan0"
ifconfig_wlan0="WPA"

cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport re0 laggport 
wlan0 10.0.0.104 netmask 255.255.255.0"
 
Back
Top