networking - multiple network interfaces, browser issue
2014-07
I have two network interfaces on my laptop: wireless, and wired. The wireless network is connected to the internet (automatic, dynamic ip assignment). The ethernet card is connected to an embedded system using static ip assignment (no internet there).
As long as I don't connect the ethernet cable, I can connect to the internet without any problems. After connecting the cable, I can communicate with my embedded system and all my network related apps (skype, dropbox, etc) work fine. However, my browser is no longer able to access the internet. Not even after I disconnect the ethernet cable.
I am using Windows 8.1 with Google Chrome.
Have you removed the default gateway from your inside dedicated card? Set the internet gateway card as your preferred network device in the Networking Adapters properties
Are you comfortable setting Metric costs in an adapters properties
Replicated the problem with the included MS Internet Explorer determining if your problem is isolated to Chrome or the entire instnace of 8.1?
When you connect your wired card, your default gateway (i.e., the gateway through which all WAN communication is routed) changes to a gateway on the wired network. But since, as you stated, this cable only goes to an embedded system without direct access to the Internet, all Internet-using apps (browsers, torrent, putty, what not) are routed through a gateway without an exit onto the Internet.
All you have to do is to reconnect the wifi (which will restore the correct default gateway), or you can do it by hand.
When you do not have the cable connected, check you route by means of
route print
the output, among many other things, will tell you the gateway you are using (let us say it is 192.168.1.1). Then, after connecting the cable, issue the command
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1
and now you should have both the local connection and the Internet connection.
On a MBP (OS X 10.6.2) I've got the wired ethernet and wireless airport configurations set up to use the same static IP to my router (e.g. as described at http://forums.macrumors.com/archive/index.php/t-708685.html). I've also got the Service Order set up so that the wired connection is above Airport (e.g. as described at http://superuser.com/questions/83943/mac-os-x-automatically-turn-off-airport-if-ethernet-cable-is-plugged-in/83952#83952).
This seems to "work": an open ssh connection to a remote location stays up as I plug in and unplug the ethernet cable. However, since the Airport card stays live (and connected to the router) regardless of whether the wired connection is present, how can I tell that the wired interface is actually the "active" connection when it is available? Since the IP address is the same for both, is this a guarantee that the wireless interface cannot be used? Is there some other way to tell if this interface is in use?
PS. I'm going to post a (partial) answer as soon as I post this, as the act of writing this up and checking all my facts lead me to some insights. (The more interesting and unanswered part is in bold above.)
A couple of things. Mac will always use the network connections in order that's listed in your "Network Connections" profile. For example, if Ethernet is on top of Wireless, Ethernet will take over.
I'm not sure on how SSH works that much, but from my experience. If one connection fails or disconnects, SSH will then use the other connection.
If you really want to see if the connections are active, you should use a bandwidth monitor utility. A great one is iStat (http://www.islayer.com/apps/istatmenus/).
The definitive reference for questions such as 'Which interface will be used to reach host w.x.y.z?' for any given time or situation is to refer to the routing table.
[mini-nevie:~] nevinwilliams% route get 10.10.10.10
route to: 10.10.10.10
destination: default
mask: default
gateway: 192.168.2.1
interface: en0
flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
0 0 0 0 0 0 1500 0
I've both en0 and en1 enabled, and en0 is first in Service Order. Unplugging my ethernet, making no other changes, the same command gives:
mini-nevie:~] nevinwilliams% route get 10.10.10.10
route to: 10.10.10.10
destination: default
mask: default
gateway: 192.168.2.1
interface: en1
flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
0 0 0 0 0 0 1500 0
Here's a dump of ifconfig -a
in each situation (I'll highlight the differences afterward):
Ethernet cable is plugged in:
lo0: flags=8049 mtu 16384 inet6 ::1 prefixlen 128 inet6 xxxx::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 gif0: flags=8010 mtu 1280 stf0: flags=0 mtu 1280 en0: flags=8863 mtu 1500 inet6 xxxx%en0 prefixlen 64 scopeid 0x4 inet 192.168.0.110 netmask 0xffffff00 broadcast 192.168.0.255 ether xx:xx:xx:xx:xx:xx media: autoselect (100baseTX ) status: active supported media: none autoselect 10baseT/UTP 10baseT/UTP 10baseT/UTP 10baseT/UTP 100baseTX 100baseTX 100baseTX 100baseTX 1000baseT 1000baseT 1000baseT fw0: flags=8863 mtu 4078 lladdr xx:xx:xx:xx:xx:xx media: autoselect status: inactive supported media: autoselect en1: flags=8863 mtu 1500 inet6 xxxx%en1 prefixlen 64 scopeid 0x6 inet 192.168.0.110 netmask 0xffffff00 broadcast 192.168.0.255 ether xx:xx:xx:xx:xx:xx media: autoselect status: active supported media: autoselect
Ethernet cable is unplugged:
lo0: flags=8049 mtu 16384 inet6 ::1 prefixlen 128 inet6 xxxx::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 gif0: flags=8010 mtu 1280 stf0: flags=0 mtu 1280 en0: flags=8863 mtu 1500 ether xx:xx:xx:xx:xx:xx media: autoselect status: inactive supported media: none autoselect 10baseT/UTP 10baseT/UTP 10baseT/UTP 10baseT/UTP 100baseTX 100baseTX 100baseTX 100baseTX 1000baseT 1000baseT 1000baseT fw0: flags=8863 mtu 4078 lladdr xx:xx:xx:xx:xx:xx media: autoselect status: inactive supported media: autoselect en1: flags=8863 mtu 1500 inet6 xxxx%en1 prefixlen 64 scopeid 0x6 inet 192.168.0.110 netmask 0xffffff00 broadcast 192.168.0.255 ether xx:xx:xx:xx:xx:xx media: autoselect status: active supported media: autoselect
diff plugged unplugged
shows that the wired connection does become active when it is available:
8,9d7
< inet6 xxxx%en0 prefixlen 64 scopeid 0x4
< inet 192.168.0.110 netmask 0xffffff00 broadcast 192.168.0.255
11c9
< media: autoselect (100baseTX <full-duplex,flow-control>) status: active
---
> media: autoselect status: inactive
I use this:
if=$(route get 0.0.0.0 2>/dev/null | awk '/interface: / {print $2}')
if [ -n "$if" ]; then
echo "Default route is through interface $if"
else
echo "No default route found"
fi
I used the advice to make IP adresses the same for Ethernet and WiFi, Set the Service Order as suggested, and just used Network Utility>Info on en0 and en1.
I initiated a TimeMachine backup and under Network Utility > Info > en0 Ethernet I could see that thousands of packets were moving through the ethernet connection, while Network Utility > Info > en1 WiFi nothing was moving.
Thanks for getting me pointed in the right direction. When TimeMachine backup is complete I'll revert back to separate IP addresses and see if Mac automatically still moves everything through Ethernet.
The original question was "How can I tell which network interface my computer is using?" Network utility worked for me.
Macbook Pro 17" Mid-2010, Mountain Lion