How to Access Internet When You are on a LAN and a Wireless Network

I have been using LAN and Wireless network at the same time for quite period of time, but I realized that I have never shared this on my blog.

A full discussion on this topic might take me an essay to write. Thus, I will just keep this simple with only a few theories discussed.

You might experience problem in connecting to the Internet when you are on a LAN and a wireless network at the same time.

The problem is that for every connection there is a route for it(I will not discuss the routing table here). For example when you are on a LAN network, and you try to access another computer on the same network, your computer is smart enough to know how to reach it(it can be by the LAN or by the wireless).

Every computer will have an IP address, either assigned automatically or configured manually. As well as an optional gateway. Now the gateway is a device (it can be your router, or another computer) that is connected to the external network (the Internet), as well as providing access for the other computers to use such resource in the same network.

(Check out the article on Internet Connection Sharing [ICS] I wrote before, where you can turn your computer into a virtual router, to share your Internet resources through the wireless or LAN network).

When you connect a computer to another network, for example, the wireless, while you are already on a LAN network that has no Internet access, you might not be able to access the Internet provided by your wireless. This is because the computer will automatically select a best default gateway/interface for you, this is usually determined by the network speed (auto metric value), or if metric values are set in the network adapters manually.

Here is where you can set your metric:

Metric Configuration
(Click on the picture to view an enlarged version)

What is metric?

A metric value is a value that determines which adapter/interface should a data packet prefer to use. For an instance, if there exit two networks, regardless of their nature (wireless or LAN), the data connection will always be preferred to use a connection that has a LOWER metric value.

So, if your LAN has a lower metric value, your Internet connection will firstly go through there. Likewise, if your wireless adapter/interface has a lower value, your internet connection will goes through there.

Therefore, you can set a small metric value for a connection that has the Internet, and a greater value for a connection without the Internet. Note, this is only applicable to a case where two or more networks have its own distinct gateway defined.

 

Here is an example:

Use ipconfig, to see a list of network interfaces/adapters

In the wireless network, I have a gateway of 192.168.137.1 defined, and 192.168.0.1 is defined for my LAN network. So, before I set the metric values for both adapters/interfaces manually(that is both networks are using the Auto Metric Value), the LAN network will always gets a smaller metric value as it has greater speed than the wireless. When my wireless provides the internet through the gateway: 192.168.137.1, my data packets will not go there, because, it choose to use a faster route (the LAN [192.168.0.1], which has a smaller metric value than the wireless). So, I need to adjust the metric value of the wireless adapter/interface and makes it smaller than the LAN metric value, and allow the data packets to go through the gateway: 192.168.137.1.


Leave a Reply

Your email address will not be published. Required fields are marked *