Page 1 of 1

How to cut my Internet connection using DOS commands?

Posted: 17 Aug 2008 23:13
by budhax
1.a How to cut my Internet connection using DOS commands?
After those commands:
netsh firewall delete portopening TCP 80
netsh firewall delete allowedprogram program = "C:\Program Files\Mozilla Firefox\firefox.exe"
I was still connected to Internet!!

1.b How to reverse action 1.a using DOS command(s)?

2. Which Windows service(s) should I stop to cut my Internet connection?
Thanks

Re: How to cut my Internet connection using DOS commands?

Posted: 02 Sep 2008 06:08
by Skeletor
budhax wrote:1.a How to cut my Internet connection using DOS commands?
After those commands:
netsh firewall delete portopening TCP 80
netsh firewall delete allowedprogram program = "C:\Program Files\Mozilla Firefox\firefox.exe"
I was still connected to Internet!!

1.b How to reverse action 1.a using DOS command(s)?

2. Which Windows service(s) should I stop to cut my Internet connection?
Thanks


Try this batch i wrote a while ago to do exactly what you want
Run once to store and change run again to restore

@echo off
SETLOCAL
:: Set the network card static to your current Local IP if you still require local subnet access
:: Set the gateway to a non internet gateway

set connection=Local Area Connection
set static=192.168.0.2
set subnet=255.255.255.0
set gateway=192.168.255.255
set dnsip=192.168.0.1

if exist "%connection%.sav" (Call :restore&goto :eof)

call :main_start
goto :eof

:main_start
Echo Saving %connection% Network Settings...
>NUL: netsh -c interface dump > "%connection%.sav"

Echo :: Setting %connection%...
Echo :: Static :%static%
Echo :: Subnet :%subnet%
Echo :: Gateway :%gateway%
Echo :: DNS :%dnsip%
>NUL: netsh interface ip set address name="%connection%" source=static addr=%static% mask=%subnet% gateway=%gateway% 1
>NUL: netsh interface ip set dns name="%connection%" source=static addr=%dnsip%
goto :eof

:restore
Echo Restoring %connection% Network Settings...
>NUL: netsh -f "%connection%.sav"
del /q "%connection%.sav"
goto :eof