2

Searched for this answer on the site, but it looked to be only applicable for mac OSX. If there is one that I missed, please link, and I'll vote to close.

In a nutshell I have a laptop running windows vista, which is currently connected to the internet via the wireless network that exists in the house, using the wireless adapter that came preinstalled. However when I plug in the network cable to connect to the local switch that allows me to connect to my local file server, the laptop doesn't seem to know which way to go to get to the internet. How can I tell it to always take a particular adapter to get to the internet?

EDIT: If instructions aren't the same, knowing how to do this via windows 7 will be handy since I'll be upgrading to it in a few weeks.

3
  • 1
    Your question seems to be quite confusing. Are you saying that whenever you connect to another computer on the networks (for file sharing perhaps) that the internet doesn't work after, or are you saying that you would like to use a different computer to connect to your laptop to use the internet on the laptop? I'll be able to provide an answer after clearing this. Thanks Commented Aug 28, 2011 at 23:57
  • Revised question with more detail as to what is going on. Commented Aug 29, 2011 at 0:46
  • Can you please include the hardware that you are using and how you are connecting it all, maybe a labelled diagram could help Commented Aug 29, 2011 at 0:59

3 Answers 3

1

Make sure your wired LAN connection doesn't have a default gateway on its IP settings. If your local file server is doing DHCP resolution, then you need to edit the options to not include a gateway.

You can tell by going to the command prompt and typing ipconfig /all. Or look under the Network Adapter connections, then clicking Properties then Details.

If there is no default gateway then it won't use it to send out internet packets.

Next, go into the Network Sharing Center and clikc the Change adapter settings.

Go to the Menu bar and click Advanced and Advanced settings. Make sure your wireless connection i at the top of the list of Adapters and Bindings.

Lastly, look at your routing table. You can do that by opening a command prompt and typing netstat -r.

On the output, you should see an IP4 routing table. Look at the network destination 0.0.0.0 and mask 0.0.0.0. The IP address under interface should match the IP address of your wireless connection. If it isn't then double check the wired lan connection doesn't have a gateway attached to it.

If it does and you are sure your file server isn't handing out a gateway through DHCP, then type ipconfig /release then ipconfig /renew at the command prompt. This will force your computer to retrieve new settings from the DHCP.

2
  • Well went through the list, and got to ipconfig /renew. There it would hang unless the LAN is unplugged. No DHCP or DNS server settings are on the file server. Commented Aug 29, 2011 at 2:49
  • Yeah, ipconfig /renew tries to contact a DHCP server on all network connections, which is why it seems to hang on the wired connection. It will time out though. The quicker way would be to go into Network sharing center and just disable then re-enable the wireless connection. Or just flick the switch. The next thing you'll need to do is check the network interface metrics, like Wayne's answer. I initially ruled it out since I had a hunch you were using APIPA on the wired connection (169.x.x.x IP address on the wired connection.)
    – surfasb
    Commented Aug 29, 2011 at 21:04
2

Change Interface Metric

Here is how to use the command line to change the metric of the interface. The lower the metric the more precedence is given for packets to be destined via that hardware (I believe for packets beyond the local network)

NOTE: Must be run from an elevated shell.

netsh interface ipv4 set interface "<<INTERFACE NAME>>" metric=value

Example:

Using the wireless network for all packets beyond local network:

netsh interface ipv4 set interface  "Wireless Network Connection" metric=10

See An explanation of the Automatic Metric feature for Internet Protocol routes for understanding how the metric flag works.

You can also right click the adapter, go properties, select IPV4, click Properties button, click Advanced button, untick Automatic metric, and enter your number.

1
  • I initially ruled this out because APIPA uses a 255.255.0.0 mask and thus the interface metric isn't a factor. I figured it was the Binding order that was the biggest deal since it is likely Windows is waiting for the DNS requests to time out on the wired connection first, before trying the wireless connection if the wired connection is first on the binding order.
    – surfasb
    Commented Aug 29, 2011 at 21:08
-1

Manually Set the Routing Table - (Source)

  1. Open a Command Prompt
  2. Type: route print
  3. Under IPv4 Route Table: Network destination of 0.0.0.0 means anything that's not on the LAN (e.g. Internet traffic) will be sent to this network card's default gateway. Because you have 2 LAN cards active, you'll have two routes listed for 0.0.0.0.
  4. Type: route delete 0.0.0.0
    • You need to remove both routes (because you can't remove them one at a time).
    • This command will knock both of the top entries out of your list.
    • After deleting the route, you can't access the internet at all.
  5. Now you need to add back only the network path you want to use. Pick the card you want to use. You should be able to ID it by IP address.
  6. Type: route add 0.0.0.0 MASK 0.0.0.0 200.200.200.251
    • Replace 200.200.200.251 with the IP of the network connection of your choice.
  7. This will direct all internet traffic though the connection you choose.
  8. To confirm: Do another route print and you should now just see the one entry for 0.0.0.0.

Pic of Window' IPv4 Routing Table

4
  • Changing the interface metric would make more sense here. When you actually do use the wired connection for internet, this method will break.
    – surfasb
    Commented Aug 29, 2011 at 20:47
  • A reboot will also break this.
    – surfasb
    Commented Aug 29, 2011 at 21:12
  • I know that. It's not harder to redo it.
    – SgtOJ
    Commented Aug 29, 2011 at 21:36
  • ... A simple batch file should fix that problem if the user had the correct privileges and is interface with the Internet connection had a static address.
    – SgtOJ
    Commented Aug 29, 2011 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .