Here you'll find several tips, tweaks and tutorials on matters I find interesting (and possibly you will too) regarding the web and other techy stuff. Look around and you'll surely find something that you find useful.

Friday, August 14, 2009

How to use 2 (or more) LAN settings on the same LAN card.

I recently got myself an MTNL Triband connection along with which I also had a local broadband connection.
Now I had just one LAN card and consequently just the one "Local Area Connection" in my network connections.
Each of the 2 had separate IPs, masks and gateways and I had to find a quicker way to switch between the 2 LAN-TCP/IP settings. Manually editing the settings each time is obviously too troublesome.
This little trick is pretty useful also if you're constantly swapping between several connections (maybe home and office) on your laptop.


Google to the rescue it was. Here's a neat trick that uses "netsh", a command-line command to change the tcp/ip settings.
Here's how you do it,

Create a text file and copy the following lines of code into the file.

netsh interface ip set address name="Local Area Connection" source=static addr=IP_ADDRESS mask=SUBNET_MASK
netsh interface ip set address name="Local Area Connection" gateway=DEFAULT_FATEWAY gwmetric=0
netsh interface ip set dns name="Local Area Connection" source=static addr=PREFERRED_DNS
netsh interface ip add dns name="Local Area Connection" addr=ALTERNATE_DNS index=2
pause


Replace the yellow text with the respective details of either one of your connections.
Make sure the name of your LAN connection is same as the one specified in the text file (as in this case it is 'Local Area Connection').

(Make sure that file extensions are not hidden and then) Change the extension from .txt to .bat so that it is saved as a batch file.

Do the same thing once more and this time enter the details of your second connection.

You can name the files whatever you want. For e.g., I named one as MTNL connection.bat and the other as localnet.bat

When you want to swap to another connection, just run the relevant .bat file and you're good to go. If you want to revert to the previous settings, run the other .bat file.

In case you come across any difficulties post away and I'll try my best to help you asap!

2 comments:

Karan Gurani said...

Hey Keith Its pretty Simple to add 2 IP add for single LAN card
I have tried 2 IP n 2 gateways too fro the same
But i have same provider (BSNL)
just when u add a IP in network connection
-properties
-in nternet protocol (TCP/IP)
-Advance
Add aditional gateway and IP
thats pretty simple
it worked for me
try it, it may work too
as both triband and BSNl uses same technology

Keith Mascarenhas said...

Thanks but you're mistaken here.
I know of that method too!
But the difference here is that, I need to change the entire IP settings for each of my 2 connections. i.e. I've got to use different gateways, subnet masks, DNS servers and IPs.
Only changing the IPs via TCP/IP wouldn't change all of the rest.
That's why I'm using this batch file to carry out all of those changes at once.

Post a Comment

Related Posts with Thumbnails