Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
MacBook
Internet connection via WiFi via proxy (en0)
LAN connection via ethernet (en6)

i.e.:

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:1f:f3:ba:82:57 
inet6 fe80::21f:f3ff:feba:8257%en0 prefixlen 64 scopeid 0x4 
inet 192.168.182.136 netmask 0xffffff00 broadcast 192.168.182.255
media: <unknown subtype>
status: active

en6: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 00:1f:f3:8c:3d:92 
inet6 fe80::21f:f3ff:fe8c:3d92%en6 prefixlen 64 scopeid 0x5 
inet 192.168.8.251 netmask 0xffffff00 broadcast 192.168.8.255
media: autoselect (100baseTX <full-duplex,flow-control>)
status: active

When I open a Terminal or a browser, I can access either the internet (e.g. Google.com), when WiFi is on. Or I can access the local network (e.g. 192.168.x.x) when the WiFi is off. But not both (probably due to both connections are on 192.168.x.x).

Is it possible to config one app to use a particular connection (e.g. Terminal uses en6, FireFox uses en0)?

UPDATE (information regarding Spiff's answer):

  1. In network preferences, AirPort is on top of USB Ethernet

  2. when wifi is up:

     Routing tables

     Internet:
     Destination        Gateway            Flags        Refs      Use   Netif Expire

     default            192.168.182.1      UGSc           26        0     en0
     default            192.168.8.10       UGScI           2        0     en6
     17.82.253.7        192.168.182.1      UGHWI           1        1     en0
     64.34.80.176       192.168.182.1      UGHWI           1       11     en0
     69.59.196.211      192.168.182.1      UGHWI           1       35     en0
     69.59.196.216      192.168.182.1      UGHWI           1        6     en0
     72.21.91.19        192.168.182.1      UGHW3I          0        2     en0   3295
     72.233.61.123      192.168.182.1      UGHWI           2       10     en0
     74.125.71.18       192.168.182.1      UGHWI           1       90     en0
     74.125.71.19       192.168.182.1      UGHW3I          0        1     en0   3418
     74.125.71.83       192.168.182.1      UGHWI           1       25     en0
     74.125.71.100      192.168.182.1      UGHW3I          0       36     en0   3433
     74.125.71.101      192.168.182.1      UGHW3I          0        6     en0   3433
     74.125.71.104      192.168.182.1      UGHW3I          0        9     en0   3432
     74.125.71.105      192.168.182.1      UGHW3I          0       27     en0   3433
     74.125.71.106      192.168.182.1      UGHWI           1       16     en0
     74.125.71.113      192.168.182.1      UGHWI           1        5     en0
     74.125.71.138      192.168.182.1      UGHWI           1        6     en0
     74.125.71.139      192.168.182.1      UGHWI           1        9     en0
     74.125.71.189      192.168.182.1      UGHW3I          0       12     en0   3432
     74.201.86.29       192.168.182.1      UGHWI           1       93     en0
     127                127.0.0.1          UCS             0        0     lo0
     127.0.0.1          127.0.0.1          UH              4     6062     lo0
     169.254            link#4             UCS             0        0     en0
     174.36.30.38       192.168.182.1      UGHWI           1       19     en0
     192.168.8          link#5             UCS             8        0     en6
     192.168.8.10       0:12:a9:c5:41:0    UHLWI           1        0     en6   1198
     192.168.8.11       0:24:73:7c:87:41   UHLWI           0        0     en6   1187
     192.168.8.251      127.0.0.1          UHS             0        0     lo0
     192.168.8.255      ff:ff:ff:ff:ff:ff  UHLWbI          0        1     en6
     192.168.12.21      192.168.8.10       UGHW3I          0       19     en6   3281
     192.168.13.183     192.168.8.10       UGHWI           1       23     en6
     192.168.65         link#7             UC              3        0  vmnet1
     192.168.65.255     ff:ff:ff:ff:ff:ff  UHLWbI          0        1  vmnet1
     192.168.182        link#4             UCS             4        0     en0
     192.168.182.1      0:c0:df:3:f0:db    UHLWI          15       59     en0   1166
     192.168.182.150    127.0.0.1          UHS             0      108     lo0
     192.168.182.255    ff:ff:ff:ff:ff:ff  UHLWbI          0        1     en0
     192.168.214        link#8             UC              4        0  vmnet8
     192.168.214.1      0:50:56:c0:0:8     UHLWI           0      212     lo0
     192.168.214.255    ff:ff:ff:ff:ff:ff  UHLWbI          1        1  vmnet8
     192.221.72.126     192.168.182.1      UGHW3I          0        4     en0   3478
     192.221.73.126     192.168.182.1      UGHWI           1       19     en0
     203.190.124.12     192.168.182.1      UGHW3I          0        7     en0   3573
     207.171.166.37     192.168.182.1      UGHWI           1        5     en0
     224.0.0.251        192.168.182.1      UGHmWI          1        0     en0
     255.255.255.255    192.168.182.1      UGHW3bI         0       11     en0   3575

when wifi is off:

Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.8.10       UGSc            2        0     en6
17.82.253.7        192.168.8.10       UGHW3I          0        0     en6   3599
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              4     6032     lo0
169.254            link#5             UCS             0        0     en6
192.168.8          link#5             UCS             5        0     en6
192.168.8.10       0:12:a9:c5:41:0    UHLWI           3        0     en6   1198
192.168.8.11       0:24:73:7c:87:41   UHLWI           0        0     en6   1199
192.168.8.106      0:9:6b:55:c6:1e    UHLWI           1       36     en6   1200
192.168.8.251      127.0.0.1          UHS             0        0     lo0
192.168.12.21      192.168.8.10       UGHWI          20       36     en6
192.168.65         link#7             UC              2        0  vmnet1
192.168.214        link#8             UC              4        0  vmnet8
192.168.214.1      0:50:56:c0:0:8     UHLWI           0      212     lo0

3 Yes, I want to access: 192.168.13.*, 192.168.12.*, for example.

4 It's a MacBook Air. en6 may be caused by a) it's USB Lan b) installed after some VMWare virtual lan cards.

5 No. All traffic via LAN cannot connect internet.

6 Not sure what is a "multi-hop". Basically, 1) the LAN goes into company intranet, in which I want to access the 192.168.13.* and 192.168.12.*. However, when WiFi is on, it seems there is no route to 192.168.13.* and 192.168.12.* (probably they go to the WiFi-size of 192.168.13.* and 192.168.12.*). 2) The WiFi goes into the company WiFi which has a proxy to connect to the internet.

7 I think there are on the WiFi-side, not the (real) hosts I am trying to connect.

8 Before I try that, could you please teach me how to revert (delete) them ;-) UPDATE: No, after the 2 route adds, still cannot connect to a 192.168.12.? host.

share|improve this question
    
Probably not feasible. Check here. –  digitxp Sep 8 '10 at 3:13
    
Yes, but I've not found an OS X app that can force another app to bind to a specific interface. –  Ignacio Vazquez-Abrams Sep 8 '10 at 3:18
    
I've updated my Answer below with more follow-up questions after your update. –  Spiff Sep 8 '10 at 7:48
    
@Spiff I updated the questions with response 5 - 8 –  ohho Sep 10 '10 at 6:48
add comment

1 Answer

up vote 3 down vote accepted

I don't think you need to lock apps to interfaces to fix your problem. I think you've got a simple networking configuration error.

Mac OS X automatically talks to local subnets via any active interface, and non-local subnets via the default route, which is automatically set to be the highest-ranked active interface.

In this context, "active" means that link is up. On Ethernet, that would mean a link light on the switch. On 802.11, that would mean that you're associated to an AP.

In the ifconfig output in your Question, you should be able to access the 192.168.182/24 subnet via en0 (which appears to be WiFi), and you should be able to access the 192.168.8/24 subnet via en6 (Ethernet). All other subnets will be reached via whichever active interface is highest-ranked in "System Preferences > Network > ["Gear icon" menu] > Set Service Order..."

The fact that both of your local subnets start with 192.168 doesn't matter; your subnet mask in both cases is /24, so the third octet matters, and the third octet is different between en0 and en6, so these are different subnets.

It sounds like this isn't working right on your system, which leads me to the following questions:

  1. How do you have things ranked in "Set Service Order"? NOTE: This can be DIFFERENT than how they appear in the summary view on the main panel of the Network pref pane.

  2. What does netstat -rnaf inet show when WiFi is up? What does it show when Wi-Fi is down?

  3. Does the "local network" that you want to get to over Ethernet consist of more than one subnet? [If so, then everything might be working as designed, but you need to add static routes to the non-local subnets on your LAN, or have your LAN advertise those routes to your host via RIP or something]

  4. Usually on a MacBook, the built-in Ethernet is en0, and the built-in Wi-Fi card is en1. If this is a MacBook and not a MacBook Air, it's weird that the AirPort card (assuming when you say "Wi-Fi" you mean the built-in AirPort card and not some third-party external USB Wi-Fi dongle or something like that) is at en0 instead of en1. It's also weird that Ethernet (even if it's a dongle, but especially if it's built-in Ethernet) is at en6. This strikes me as either a network config that's been migrated from one machine to another to another a few times, or a system that's seen lots of different USB networking dongles installed and removed, or a system that has had a lot of other network configuration changes done to it.

    That is to say, I wonder if your network configuration files have developed errors over time and need to be cleaned up. It might be worthwhile to delete all your network settings (all the .plist files in /Library/Preferences/SystemConfiguration/), and start over, configuring networking from scratch.

Update: More questions after your update:

5) So, the LAN out your Ethernet port...does that LAN have Internet access or not? It looks like it might, since it looks like you established a route to time.asia.apple.com (Apple's NTP server for Asia) via that interface.

6) Why do you have a multi-hop Ethernet LAN? How does your Wi-Fi network relate to that LAN? Can you explain or diagram your network topology? If this network is under your control, it's possible you can work around this with a minor network redesign.

7) It looks like you've got routes to 192.168.12.21 and 192.168.13.183 via Ethernet even when Wi-Fi is up. Are those hosts actually reachable in that situation?

8) Bring Wi-Fi up and then try these commands to add routes to the .12 and .13 networks, to see if it temporarily resolves your problem:

sudo route add -net 192.168.12/24 192.168.8.10
sudo route add -net 192.168.13/24 192.168.8.10
share|improve this answer
    
sudo route add -net 192.168.13/24 192.168.8.10 does not allow me to connect to any host in 192.168.13.*, instead, sudo route add -net 192.168.13.40 192.168.8.10 will allow me to connect to the 192.168.13.40 host –  ohho Oct 6 '10 at 7:16
    
sudo route add -net 192.168.13.0/24 192.168.8.10 works. thanks! –  ohho Oct 6 '10 at 7:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.