DNS with NetSH


F

Frank W.

-----Original Message-----
I know there is a way to change from DHCP to static and
back, but can I not add a secondary DNS server using NetSh?

Thanks!

Scott
.
Hi Scott,

use this syntax:
Primary
"netsh interface ip set dns Lan-Verbindung static
10.178.66.6"
secondary
"netsh interface ip add dns Lan-Verbindung 10.178.66.14"

Greets, Frank
 
Ad

Advertisements

S

Scott

I tried it and it gave me the following error:

static is not an acceptable value for addr.

Here is the bat file that I have created:

@ECHO OFF
CLS
:LOOP
ECHO =========PULIZ IP Address Changer==========
ECHO.
ECHO 1. Home
ECHO 2. Office
ECHO Q. Quit
ECHO.
:: SET /P prompts for input and sets the variable
:: to whatever the user types
SET Choice=
SET /P Choice=Type the number and press Enter:
:: The syntax in the next line extracts the substring
:: starting at 0 (the beginning) and 1 character long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
ECHO.
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='1' GOTO ItemA
IF /I '%Choice%'=='2' GOTO ItemB
IF /I '%Choice%'=='Q' GOTO End
ECHO "%Choice%" is not valid. Please try again.
ECHO.
GOTO Loop
:ItemA
netsh interface ip set address "Local Area Connection" dhcp
netsh interface ip set dns "Local Area Connection"
source=dhcp
GOTO End
:ItemB
netsh interface ip set address "Local Area Connection"
static 192.168.1.24 255.255.255.0 192.168.1.253 1
netsh interface ip set dns "Local Area Connection" static
64.42.64.5
netsh interface ip add dns "Local Area Connection" static
64.42.65.1
GOTO End
PAUSE
CLS
GOTO Loop
:End
ECHO Ip Address Changed
PAUSE
exit

Take a look and see if it is something I did.

THanks a lot!

Scott
 
Joined
Sep 29, 2007
Messages
1
Reaction score
0
es sencillo para setear una dns pones netsh interface ip set dns "Local Area Connection" static
64.42.64.5
correcto?
pues para añadir una dns solo tienes que poner netsh interface ip add dns name="Local Area Connection" addr=64.42.64.5

no estoy seguro de si es necesario el name= y el addr=, pero no tenes que poner static
te paso un ejemplo sencillisimo que hice yo

netsh interface ip set address name="RED" source=dhcp
netsh interface ip set address name="RED" source=static 201.231.156.227 255.255.0.0 201.231.156.1 1
netsh interface ip set dns name="RED" source=static 200.49.156.3
netsh interface ip add dns name="RED" addr=200.49.156.7
netsh interface ip add dns name="RED" addr=200.49.156.5
netsh interface ip add dns name="RED" addr=172.20.2.12

Pero en realidad no es necesario hacer todo esto, si se desea renovar una sesion, solo basta con poner las 2 primeras lineas
netsh interface ip set address name="RED" source=dhcp
netsh interface ip set address name="RED" source=static 201.231.156.227 255.255.0.0 201.231.156.1 1
 
Ad

Advertisements

Joined
Nov 19, 2010
Messages
1
Reaction score
0
Sufijo DNS específico para la conexión

saludos, esta muy interesante el batch, me gustaria saber si se puede poner mediante netsh Sufijo DNS específico para la conexión, ejemplo: colombia.movil.co. muchas gracias por la pronta respuesta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

netsh 2
IPsec and NETSH 1
netsh -r 3
Using netsh 1
Renotely add static WINS and DNS entries via netsh 1
About netsh command 2
Netsh Port Forward 0
netsh command - reset winsock? 1

Top