Switch gateways on the fly

skeedo

Senior member
Nov 29, 2004
269
0
76
Would it be possible to make an icon that would change my gateway when clicked?
 

bgroff

Member
Jun 18, 2003
198
0
0
Yes... Make a .cmd script that changes your default gateway with the "route" command. i.e.
route delete 0.0.0.0
route add 0.0.0.0 mask 0.0.0.0 <gateway ip>
 

skeedo

Senior member
Nov 29, 2004
269
0
76
What about route change wouldn't that be easier? I'm having some trouble with the syntax
 

skeedo

Senior member
Nov 29, 2004
269
0
76
Better yet is there an easier way I can keep a computer on my network but not online, and be able to switch to online easily.
 

Changlinn

Member
Aug 24, 2000
155
0
0
hmm just disable the default gateway, I have a set of batch files on my laptop to switch networks as it connects to quite a few different ones, see syntax below. Helps to rename your network connections something that is short and one word.

netsh int ip set address *name of connection* *static/dynamic* *if static fill the rest out* *ip* *subnet mask* *default gateway* 1

EG:
netsh int ip set address LAN static 10.0.0.4 255.255.255.0 10.0.0.10 1
netsh int ip set dns LAN static 10.0.0.8

so if yours is static you could do
netsh int ip set address LAN static 192.168.0.10 255.255.255.0 1.1.1.1 1
OR if if is dynamic you can still set the dns to an incorrect dns and it won't resolve anything...
That would stop internet connectivity, in a simple batch file.
 

skeedo

Senior member
Nov 29, 2004
269
0
76
Cool I got Net switcher, but when I switch to a profile with a gateway that doesn't exist, I can't access the other computer on my LAN. I would like to retain LAN connectivity but not be online.

I thought about changing DNS servers instead of gateway but if I change DNS the computer could still be accessed via IP correct?
 

err

Platinum Member
Oct 11, 1999
2,121
0
76
DNS server settings is only used for DNS resolution. It won;t have any effect on your local LAN connectivity. If you are properly wired to your LAN, yes you can always get to your other box by ip address. If you really wanted to access it by name, make a manual entry in your hosts file as it take precendence before your dns servers.