help on DNS config

  • Thread starter Thread starter YNWA
  • Start date Start date
Y

YNWA

Hi there. Help needed. I have a PC with 1 NIC card but
can connect to internet via 2 different routes. One via
internal LAN and the other via an ISP. My user is OK that
he has to physical switch the RJ45 cable everytime he
need to change the connection. My problem is everytime we
have to change the Gateway & DNS configuration. Is there
a command (Batch file) that I can run to change the
Gateway & DNS settings? My user is using static internal
IP addr. Thanks...
 
YNWA said:
Hi there. Help needed. I have a PC with 1 NIC card but
can connect to internet via 2 different routes. One via
internal LAN and the other via an ISP. My user is OK that
he has to physical switch the RJ45 cable everytime he
need to change the connection.

Why does he need to do that when he has internet connectivity through the
LAN?
 
in message : Hi there. Help needed. I have a PC with 1 NIC card but
: can connect to internet via 2 different routes. One via
: internal LAN and the other via an ISP. My user is OK that
: he has to physical switch the RJ45 cable everytime he
: need to change the connection. My problem is everytime we
: have to change the Gateway & DNS configuration. Is there
: a command (Batch file) that I can run to change the
: Gateway & DNS settings? My user is using static internal
: IP addr. Thanks...

How does the user connect to the ISP?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Online Support for IT Professionals -
http://support.microsoft.com/servicedesks/technet/default.asp?fr=0&sd=tech
How-to: Windows 2000 DNS:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;308201
FAQ W2K/2K3 DNS:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;291382
 
If the computer is getting the addresses from DHCP, then just put the
following in a batch file:
ipconfig /release
ipconfig /renew

If the addresses are being manually set, then put this in a batch file:
netsh interface ip set address name="Local Area Connection" static
the_IP_address the_Subnet_Mask the_default_Gateway
netsh interface ip set dns name="Local Area Connection" static
the_DNS_address primary

please note that in the name="blahblahblah" part, the "blahblahblah" must be
the description of the NIC. You can find this by doing "ipconfig /all" and
looking for the line that says:
Ethernet adapter "blah blah blah"

Also, the following should work if the addresses are coming from a DHCP
server:
netsh interface ip set address name="Local Area Connection" source=dhcp
netsh interface ip set dns name="Local Area Connection" source=dhcp

--
Sincerely,

Dèjì Akómöláfé, MCSE MCSA MCP+I
Microsoft MVP - Directory Services
www.readymaids.com - COMPLETE SPAM Protection
www.akomolafe.com
Do you now realize that Today is the Tomorrow you were worried about
Yesterday? -anon
 
Hi Roland, Thanks for replying. The user connects via an
ADSL router.
What I intend to do is, I set the IP addr on the internal
LAN Gateway & the ADSL Gateway to be the same (the 2
devices are not connected). Also I will add all the DNS
servers (IP addr) in the DNS search order. Will this
work? I am not in the office and can only test it next
Fri. I guess there will be performance issue...

You'll Never Walk Alone.
 
Local Lan speed too slow. The ADSL line is exclusively
for his own usage as he requires to download large tech
data.
 
Too bad he uses static.
The user connects via an ADSL router.
What I intend to do is, I set the IP addr on the internal
LAN Gateway & the ADSL Gateway to be the same (the 2
devices are not connected). Also I will add all the DNS
servers (IP addr) in the DNS search order. Will this
work? I am not in the office and can only test it next
Fri. I guess there will be performance issue...
 
Will the following works?
What I intend to do is, I set the IP addr on the internal
LAN Gateway & the ADSL Gateway to be the same (the 2
devices are not connected). Also I will add all the DNS
servers (IP addr) in the DNS search order. Will this
work? I am not in the office and can only test it next
Fri. I guess there will be performance issue...
 
Thank you very much, Dèjì Akómöláfé.
I reckon your recommendation will be more effective.
Will try when I return to office next Monday.
Have a great weekend ahead.
Cheers!
You'll Never Walk Alone (YNWA)

Will the following works?
What I intend to do is, I set the IP addr on the internal
LAN Gateway & the ADSL Gateway to be the same (the 2
devices are not connected). Also I will add all the DNS
servers (IP addr) in the DNS search order. Will this
work? I am not in the office and can only test it next
Fri. I guess there will be performance issue...
 
in message : Hi Roland, Thanks for replying. The user connects via an
: ADSL router.

That's unclear. The aDSL router has a switch and the user is moving the
patch cable from his modular jack in the wall to the switch on the router
and keeping the patch cable connected to his NIC on the other end? As Jeff
said, if addressing was assigned dynamically, moving the cable would be all
that is required.


: What I intend to do is, I set the IP addr on the internal
: LAN Gateway

The internal LAN gateway? Is this the gateway he uses currently when
connected via the company's network? You're able to change this?

: & the ADSL Gateway to be the same (the 2
: devices are not connected).

Or you're setting this address to match the company's DFG? Hopefully (the 2
devices are not connected) means not at the same time or to each other.

: Also I will add all the DNS
: servers (IP addr) in the DNS search order. Will this
: work?

You could do that but it would slow things down when one couldn't see the
other. Also, he won't be able to get to the internal network when connected
directly to the ISP.

: I am not in the office and can only test it next
: Fri. I guess there will be performance issue...

Ya', and possibly more if the internal network has AD which means there is
an internal DNS server.

If the ISP is offering addressing dynamically, then set the NIC to obtain
everything dynamically when connected that way. I haven't tried Deji's
suggestion but you could use netsh as suggested or WMI to make these
changes.

I would make sure the interface name is still "Local Area Connection" as I
tend to change mine. You could find out with:

netsh interface ip show config

It would return something similar to:
Configuration for interface "LAN1"
DHCP enabled: Yes
InterfaceMetric: 0
Statically Configured DNS Servers: 192.168.0.9
WINS servers configured through DHCP: None
Register with which suffix: Primary only

You're interested in the "LAN1" [interface name] in this case.

If you're not familiar with netsh, Deji's example wraps and the next
statement is right underneath.
set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1
is an example of setting a static address to an interface uniquely starting
with local, ip 10.0.0.9, mask 255.0.0.0, gw 10.0.0.1 and metric [hop] 1.

If it were dynamic, you could just use this: netsh interface ip set address
local source=dhcp
Then you could use the first one to set it back to a static address for the
corporate network.

To make you life even easier, you could just add a NIC, attach two patch
cables and just disable one interface while enabling another.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Online Support for IT Professionals -
http://support.microsoft.com/servicedesks/technet/default.asp?fr=0&sd=tech
How-to: Windows 2000 DNS:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;308201
FAQ W2K/2K3 DNS:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;291382
 
In
Deji Akomolafe said:
If the computer is getting the addresses from DHCP, then just put the
following in a batch file:
ipconfig /release
ipconfig /renew

If the addresses are being manually set, then put this in a batch
file: netsh interface ip set address name="Local Area Connection"
static the_IP_address the_Subnet_Mask the_default_Gateway
netsh interface ip set dns name="Local Area Connection" static
the_DNS_address primary

please note that in the name="blahblahblah" part, the "blahblahblah"
must be the description of the NIC. You can find this by doing
"ipconfig /all" and looking for the line that says:
Ethernet adapter "blah blah blah"

Also, the following should work if the addresses are coming from a
DHCP server:
netsh interface ip set address name="Local Area Connection"
source=dhcp netsh interface ip set dns name="Local Area Connection"
source=dhcp


Deji, I was just ready to dig up your previous post with your netsh
example...
:-)

--
Regards,
Ace

Please direct all replies to the newsgroup so all can benefit.
This posting is provided "AS-IS" with no warranties and confers no
rights.

Ace Fekay, MCSE 2000, MCSE+I, MCSA, MCT, MVP
Microsoft Windows MVP - Active Directory

HAM AND EGGS: A day's work for a chicken; A lifetime commitment for a
pig. --
=================================
 
Back
Top