DNS with NetSH

Discussion in 'Microsoft Windows 2000 CMD Promt' started by Frank W., Aug 20, 2003.

  1. Frank W.

    Frank W. Guest


    >-----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
     
    Frank W., Aug 20, 2003
    #1
    1. Advertisements

  2. Frank W.

    Scott Guest

    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
    >.
    >
     
    Scott, Aug 20, 2003
    #2
    1. Advertisements

  3. Frank W.

    mrchuseau

    Joined:
    Sep 29, 2007
    Messages:
    1
    Likes Received:
    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
     
    mrchuseau, Sep 29, 2007
    #3
  4. Frank W.

    mejic22

    Joined:
    Nov 19, 2010
    Messages:
    1
    Likes Received:
    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
     
    mejic22, Nov 19, 2010
    #4
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dan Andryszak

    Renotely add static WINS and DNS entries via netsh

    Dan Andryszak, Jul 24, 2003, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    1
    Views:
    968
    Leonid Guiless
    Jul 28, 2003
  2. Bill B

    devcon and netsh: setting connection name

    Bill B, Jul 30, 2003, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    2
    Views:
    1,206
    Herb Martin
    Jul 30, 2003
  3. Simon Bleif

    Win2k3: PPoE and netsh

    Simon Bleif, Aug 9, 2003, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    0
    Views:
    600
    Simon Bleif
    Aug 9, 2003
  4. Jeff Fan

    About netsh command

    Jeff Fan, Aug 19, 2003, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    2
    Views:
    3,296
    Herb Martin
    Aug 19, 2003
  5. Nancy

    using netsh

    Nancy, Jan 6, 2004, in forum: Microsoft Windows 2000 CMD Promt
    Replies:
    2
    Views:
    193
    Dusty Harper {MS}
    Jan 7, 2004
Loading...

Share This Page