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

3 Answers 3

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.

@set MyImportantInterface="Mobile Broadband"

@set IfIdx=0
@for /F "tokens=1" %%* in (
    'netsh interface ipv4 show interfaces 
        ^| findstr /R /C:%MyImportantInterface%'
) do @set /A IfIdx=%%*

@if %IfIdx% EQU 0 (
    echo Interface %MyImportantInterface% not found!
    echo Check the configuration on the first line of this script.
    exit /B 1
)

@for /f "tokens=3" %%* in (
    'netsh interface ipv4 show config %IfIdx%
        ^| findstr /R /C:"Default Gateway"'
) do @set TheDefaultGateway=%%*

@route PRINT | findstr /r /c:"^Network" /c:"[ ]0.0.0.0"

@echo Trying to lower the metric of %MyImportantInterface% (Idx %IfIdx%)...
@route CHANGE 0.0.0.0 MASK 0.0.0.0 %TheDefaultGateway% ^
    METRIC 5 IF %IfIdx%
@if %ERRORLEVEL% GEQ 1 exit /B 5

@route PRINT | findstr /c:"%TheDefaultGateway%"

You must log in to answer this question.

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