2

I'm using Windows 7 and I'm currently without DSL because we've just moved. I'm using my iphone tethered as a 3G modem but whenever I turn on the wifi I'm unable to browse the internet.

How do I tell windows 7 to just use the wifi network for browsing but default the internet to the 3G connection?

Cheers

1

You need to create routes for LAN IPs with a metric higher than the default route (which is used when you access the Internet).

0

I've had a similar issue myself, and you that if you leave the "Default Gateway" for your WIFI connection blank, it all works itself out

0

This question is extremely old but as I haven't seen any easy automated solution to this anywhere, I think I should share this .cmd script I made couple of years ago.

Windows makes assumption that LAN is always faster and better than WiFi and WiFi is always faster and prettier than any mobile broadband... even in this age and time we have 3G and 4G – soon 5G.

Any of the other answers doesn't cover all these issues:

  • Changing metric value for the desired Default Gateway manually, whether you use GUI or CLI, gets extremely annoying: every time you connect to mobile network it will be reset back to the default value.
  • Sometimes you don't have access to change the settings of the router.
  • If the LAN / WiFi is working correctly (as it should in Enterprise environments), it will break something for other network users if you don't do this on local machine level.

This little script:

  1. Takes Mobile Broadband by interface name. (Change to match your needs!)
  2. Finds associated Default Gateway (through interfaces Idx) from the outputs of commands

    netsh interface ipv4 show interfaces
    
    netsh interface ipv4 show config <Idx>
    
  3. Sets the metric value of that gateway to 5 in the Route Table.

  4. Prints the modified Route Table at the end to be sure it worked.

Remember to run this .cmd script with administrative privileges.

@echo off
REM ! CHANGE THIS TO  ! \
SET MyImportantInterface=Mobile Broadband
REM ! MATCH YOUR NEED ! /

For /f "tokens=1" %%* in (
   'netsh interface ipv4 show interfaces 
    ^| findstr /R /C:"%MyImportantInterface%"'
   ) Do Set "MyImportantInterface=%%*"

For /f "tokens=3" %%* in (
   'netsh interface ipv4 show config "%MyImportantInterface%"
    ^| findstr /R /C:"Default Gateway"'
   ) Do Set "TheDefaultGateway=%%*"

route CHANGE 0.0.0.0 MASK 0.0.0.0 %TheDefaultGateway% ^
   METRIC 5 IF %MyImportantInterface%

route PRINT | findstr /C:"%TheDefaultGateway%"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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