PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 2.33 average.

DNS with NetSH

 
 
Frank W.
Guest
Posts: n/a
 
      20th Aug 2003

>-----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
 
Reply With Quote
 
 
 
 
Scott
Guest
Posts: n/a
 
      20th Aug 2003
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
>-----Original Message-----
>
>>-----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
>.
>

 
Reply With Quote
 
 
 
 
New Member
Join Date: Sep 2007
Posts: 1
 
      29th Sep 2007
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
 
Reply With Quote
 
New Member
Join Date: Nov 2010
Posts: 1
 
      19th Nov 2010
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
NETSH and DNS client config JCrum Microsoft Windows 2000 DNS 1 23rd Nov 2004 10:46 PM
Setting Alternate DNS server with NETSH command ??? pcmangler2000@hotmail.com Microsoft Windows 2000 Networking 3 10th Feb 2004 01:09 PM
Netsh help needed for 2 DNS config Jordan Windows XP General 0 22nd Dec 2003 04:31 PM
how to set second dns use netsh Richard.S.Zhu Microsoft Windows 2000 Networking 0 26th Oct 2003 04:35 AM
Renotely add static WINS and DNS entries via netsh Dan Andryszak Microsoft Windows 2000 CMD Promt 1 28th Jul 2003 04:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:23 AM.