Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

editing registry dhcp/ip-address

Posted on 2003-03-17
7
Medium Priority
?
798 Views
Last Modified: 2010-05-18
I want to switch my nic's properties from dhcp to given ip-address and vice-versa!

I thought of editing the registry:
what I did when switching from dhcp to fixed ip:
---cut---
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{My Nic's ID}\Parameters\Tcpip]
"EnableDHCP"=dword:00000000
"IPAddress"=hex(7):31,00,30,00,2e,00,30,00,2e,00,30,00,2e,00,31,00,30,00,30,00,00,00,00,00
"SubnetMask"=hex(7):32,00,35,00,35,00,2e,00,32,00,35,00,35,00,2e,00,32,00,35,00,35,00,2e,00,30,00,00,00,00,00
"DefaultGateway"=hex(7):00,00
"DhcpServer"="255.255.255.255"
"DhcpIPAddress"=-
"DhcpSubnetMask"=-
"DhcpDefaultGateway"=-
"DhcpNameserver"=-
"DhcpDomain"=-
"DhcpSubnetMaskOpt"=-

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"DhcpNameServer"=-
"DhcpDomain"=-
---cut---

what I did when switching from fixed ip to dhcp:
---cut---
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{My Nic's ID}\Parameters\Tcpip]
"EnableDHCP"=dword:00000001
"IPAddress"=hex(7):30,00,2e,00,30,00,2e,00,30,00,2e,00,30,00,00,00,00,00
"SubnetMask"=hex(7):30,00,2e,00,30,00,2e,00,30,00,2e,00,30,00,00,00,00,00
"DefaultGateway"=hex(7):00,00
"DhcpIPAddress"=-
"DhcpSubnetMask"=-
"DhcpServer"=-
---cut---

my problem - the nic does not recognize the change!
I see the changes in the registry, but the nic's properties haven't change!

how can I do this?

thanks
michi
0
Comment
Question by:witty
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 2

Expert Comment

by:somchaiu
ID: 8157358
Why you cannot change TCP/IP settings in control panel?
0
 
LVL 1

Author Comment

by:witty
ID: 8158162
I can ;-) but not the users, this solution would be for!!!

thx
michi
0
 
LVL 2

Expert Comment

by:somchaiu
ID: 8158395
You should use the DHCP on client, and manually assign IP address on DHCP server console.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
LVL 7

Expert Comment

by:YarnoSG
ID: 8158689
There is a command prompt command to do what you are attempting:  not only does it make the change, but it re-initialises the settings:  
NETSH  
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/server/netsh.asp

I would familiarize myself with it and write some batch files to turn dhcp on and off.

HTH
-Steven Yarnot
http://yarnosg.home.insightbb.com
0
 
LVL 10

Accepted Solution

by:
ryangorman earned 1000 total points
ID: 8170885
I agree with YarnoSG - NETSH is the way to go (W2K/XP). However, you may need local Admin access to run it.

rem Force DHCP
netsh int ip delete wins lan all
netsh int ip delete dns lan all
netsh int ip set address lan dhcp

rem Force a Static IP
netsh int ip delete wins lan all
netsh int ip delete dns lan all
netsh int ip set address lan static 192.168.1.1 255.255.255.0 192.168.1.254 1
netsh int ip add dns lan 195.92.195.94
netsh int ip add wins lan 192.168.1.20
0
 
LVL 1

Author Comment

by:witty
ID: 8170912
exactly what I needed!!!
what is the last paramter (gwetric) for?

thx michi
0
 
LVL 10

Expert Comment

by:ryangorman
ID: 8175980
Gwmetric is Gateway Metric. It concerns router hops. Just accept that 1 is a good number (as in the right hand column below).

C:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x1000003 ...00 d0 59 33 c1 01 ...... Intel 8255x-based Integrated Fast Etherne

===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0   192.168.100.19  192.168.100.134      1
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
    192.168.100.0    255.255.255.0  192.168.100.134  192.168.100.134      1
  192.168.100.134  255.255.255.255        127.0.0.1       127.0.0.1       1
  192.168.100.255  255.255.255.255  192.168.100.134  192.168.100.134      1
        224.0.0.0        224.0.0.0  192.168.100.134  192.168.100.134      1
  255.255.255.255  255.255.255.255  192.168.100.134  192.168.100.134      1
Default Gateway:    192.168.100.19
===========================================================================
Persistent Routes:
  None
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A quick solution showing how to control and open a POS Cash Register Drawer using VBA with MS Access.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question