How To Use Wi-Fi and Ethernet Simultaneously on Your Mac

There are cases where you need to use your Wi-Fi as the primary connection, but connect to certain IP addresses over the ethernet cable. Vice-versa is also a possibility, but I will continue with the example.

This is quite possible and easy. Here are the steps involved.

First of all, connect to the Wi-Fi network and connect the cable to your ethernet.

Go to your System Preferences -> Network, and ensure that Wi-Fi is on top. This will tell the system that Wi-Fi is the default connection for any network traffic.

screen-shot-2016-10-02-at-20-00-25

In this screenshot, the thunderbolt ethernet appears offline, but don’t mind it – in your network settings, it should be online (green).

Now, you need to find out IP address of the ethernet router. In the same network list, select “Thunderbolt ethernet” and click “Advanced…”. Select the TCP/IP tab. Here, you will find the router IP. Note it.

screen-shot-2016-10-02-at-20-28-23

Now, terminal time! Open your terminal. If you don’t how; press Cmd + Space on your keyboard and type “Termial”. A small window will show up.

Assuming that you want to connect to 10.1.3.40 over ethernet, here is the command you need to type:

sudo route add -net 10.1.3.40 192.168.2.1

The first IP address is the remote address, the second one is your router.

Next time you reboot, this setting will disappear. If you want to make it static, you need to enter the command in the following format:

sudo route add -n -net 10.1.3.40 192.168.2.1

If you travel a lot and have different settings for different networks, you don’t want to make such a setting static, obviously. Instead, you can type this command into a text file and save it as whatever.command (the name is not important, but the extension must be “command”). This turns the file into an executable script.

But your Mac won’t allow you to execute it immediately. You need to set its permissions over the terminal:

chmod u+x whatever.command

And there you go! Whenever you double click whatever.command, the routing command will run automatically.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s