Advertisement

08.17.2007 at 05:36PM PDT, ID: 22771150
[x]
Attachment Details

Change IP / Gateway programmatically via VB.NET

Asked by kmoloney in Microsoft Visual Basic.Net, Windows Networking, Visual Studio .NET 2005

Tags: ip, change

Hello, network and programming gurus,

GOAL
I want to know the approach I should use for developing an application in VS2005 (Visual Basic) that would allow a Non-Admin user to change their computer's IP address and Gateway.


BACKGROUND
I am not a hardware guy, so I'll only state what I know regarding our network infrastructure.  Workstations are all XP Pro 2, Servers are all Microsoft Server 2003, using Active Directory and Roaming Profiles.  ALMOST ALL users are setup as power-users, i.e., they're not administrators, and can't change their IP address or Gateway manually.

We are using dedicated T1 lines and VPN's to connect our offices.  Our corporation has a class B network (255.255.0.0) with computers being assigned internal static IP address as follows:

First octet:  Always 10
Second octet: 10 for location A, 11 for location B, 12 for location C, 15 for location D
Third octet: 0 for routers, 1 for printers, 2 for servers, 3 for desktops, 4 for laptops
Fourth octet: assigned unique number (0 to 255) for the machine

So a desktop computer in location C would be assigned the IP address 10.12.3.XXX

A laptop user in location A would be 10.10.4.XXY

A server at location B would be 10.11.2.XXZ

A router at location D would be 10.15.0.AAA (AAA is usually 001)

A printer at location C would be 10.12.1.ABC


NOTE:  We have attempted to keep the fourth octet unique, regardless of the location or machine type, e.g., if Nancy Smith's computer has an IP address of 10.10.4.123, there is no other device, regardless of the first, second or third octet, that has a fourth octet of 123.  This allows us, of course, 255 devices, which is satisfactory for the time being.

The routers at each location are 10.10.0.1, 10.11.0.1, 10.12.0.1, and 10.15.0.1

PROBLEM
If Nancy Smith primarily works on a laptop in location A, her IP address is, say, 10.10.4.222, and her gateway is 10.10.0.1.  If she takes her laptop to location B, then she is unable to connect to the network unless her IP address is changed to 10.11.4.222, and her gateway is changed to 10.11.0.1.

Nancy Smith is not an administrator, so she can't change her IP address.  So when someone wants to work from another location, our Network Tech, who works out of location A, needs to take the machine (before she goes there), login as administrator under a (secret) local account, and change the IP address and gateway.

I want to develop a VB.NET application that will allow Nancy Smith to reset her IP / Gateway from 10.10.4.222 to 10.11.4.222, and change her gateway from 10.10.0.1 to 10.11.0.1.

Even if we gave access to users to change their IP addresses, they would have no clue what they were doing, because telling them to change their IP address and Gateway from 10.10 to 10.11 is like speaking Greek to them.  Even showing those who have Administrator rights how to do this, they forget in about 12 seconds.  So I'm imagining some kind of small window that has "Location A", "Location B" etc, that when clicked will change the IP address appropriately.  However, I only want to change the second octet, and preserve what's in the third and fourth octets (first octet, again, is always 10).

I hope my verbosity has made the issue clear.  I understand that there are netsh commands that may allow someone to do this, but I don't know if their available to non-admins; also we need to preserve the first, third, and fourth octet, only changing the second.

If a reboot is required, that is not a problem.

KPM






Start Free Trial
[+][-]08.17.2007 at 06:05PM PDT, ID: 19721294

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, Windows Networking, Visual Studio .NET 2005
Tags: ip, change
Sign Up Now!
Solution Provided By: RobWill
Participating Experts: 1
Solution Grade: A
 
 
[+][-]08.19.2007 at 03:36PM PDT, ID: 19727193

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2007 at 10:22AM PDT, ID: 19731969

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2007 at 02:29PM PDT, ID: 19733865

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2007 at 02:39PM PDT, ID: 19733952

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.21.2007 at 11:58AM PDT, ID: 19938169

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628