Click here to Skip to main content
Licence CPOL
First Posted 8 May 2000
Views 168,384
Bookmarked 44 times

Change TCP/IP network settings remotely.

By | 8 May 2000 | Article
Do you want to change a Host name, DHCP or static IP settings?
  • Download source files - 8 Kb
  • Executable - 7 Kb
  • Introduction

    How to change TCP/IP network settings remotely on a bare bone system?

    Situation

    • Embedded NT4.0 machine, with minimal OS configuration.
    • No keyboard (NULL keyboard driver), no screen (NULL video driver).
    • Only a network connection can be used to reach the Embedded machine.

    Problem

    • How do we change the computer and network host name?
    • How do we choose between the usage of DHCP or a static IP address?
    • How do we change the static IP address?

    Solutions

    • Connect with a tool like vnc, pc-anywhere, … change the network settings with the control panel. (But a bare bone system does not have a control panel).
    • Connect with regedt32.exe (or another registry editor) remotely to the Embedded machine and change all the necessary registry entries. (Not a very good solution to use in production and what happens when you want to change something in the field?)
    • Use IPConfig.exe (which can be found in the NT resource kit but it only handles part of the required functionality)
    • Write your own program to manipulate the registry remotely.

    References:

    By using the information provided by the CodeGuru article "Change IP Address and HostName of NT machine" by Massimo Negroni and the MSDN article Q194407, together with the excellent Registry API wrapper classes of Len Holgate (http://www.codeproject.com/system/cregistrykey.asp), I wrote a little Win32 command line program to change the mentioned registry settings. A reboot is required after the changes. (If somebody knows of a way to change an IP address without a reboot on NT4, let me know)

    The Program:

    When should you use it?

    If the following sentences give a complete description of your personality then use use it!

    • I am a command line freak.
    • I need to program for Embedded NT 4.0
    • I like to live dangerously
    • I am a sys admin who wants to change static IP addresses across the network for Target NT machines that only have one (1!) network card.

    Like with all registry manipulations, you should make a backup of the registry before attempting to change it. Believe me, whilst debugging this little program I sure messed up a system registry or two… Use at your own risk. (NB: that means first test it for your specific network configuration on a ‘test’ machine).

    Implementation information

    The most important Registry keys to use and/or modify are:

    • HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\DHCP
    • HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\1
    • HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\(network card name)\\Parameters\\TCPIP
    • HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters

    Build information

    • Download Len Holgate’s Registry API wrapper source
    • Create a Win32 Multithreaded DLL Console project an put Main.cpp, NWConnectionSettings.h and NWConnectionSettings.cpp together with the Registry API wrapper classes inside the same directory (and project).

    Usage information:

    • If no command line parameter is supplied, the settings of the local computer are retrieved.
    • To retrieve and change settings of a remote Network computer, specify the network computer name as parameter.
    • Administrator Privileges are required for the program to function properly.
    • Intended for use on NT 4.0 or NT Embedded 4.0

    Posted for all struggling Embedded NT dudes.

    Best Regards,
    GBO.

    License

    This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    About the Author

    Gert Boddaert

    Software Developer (Senior)
    boditec
    Belgium Belgium

    Member

    Studied applied economics but became seriously infected by the IT virus, so studied some more and eventually ended up as a software design engineer or system engineer, whatever sounds best.
    Worked 'chronologically' at Agfa, KredietBank, Sparnex, Xircom - an Intel Company, Sioux Embedded Systems. then became self-employed. Wrote some stuff concerning software simulation of hardware, telecom management systems, modems, Bluetooth and drivers (WDM and others), RTOS, embedded linux, ...

    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board. (secure sign-in)
     
    Search this forum  
     FAQ
        Noise  Layout  Per page   
      Refresh
    QuestionConnecting with Hostname to host with Static IP Addresses Pinmemberddas775:58 4 Sep '07  
    Questionhow to assign IP address of remort Ethernet port? PinmemberAji V Nair2:55 10 May '07  
    QuestionSet IP address??? PinmemberBasavaraj P.Umadi20:09 14 Feb '05  
    Generalhi PinsussAnonymous23:34 4 Nov '03  
    GeneralMultiple Network Cards Pinmemberjjadkins11:21 5 Aug '03  
    Generalproblem Pinmembernehaddit0:02 19 Mar '03  
    GeneralRe: problem PinsussShimmerCN23:57 2 Jun '03  
    GeneralRe: problem PinmemberDimitris Vassiliades22:36 7 Jul '04  
    Generalnetwork shell Pinmemberbobkoure8:28 2 Jan '02  
    GeneralGetting Netcard problem, error in registry wrapper ... PinmemberWerner Wittig23:31 27 Mar '01  

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Mobile
    Web04 | 2.5.120517.1 | Last Updated 9 May 2000
    Article Copyright 2000 by Gert Boddaert
    Everything else Copyright © CodeProject, 1999-2012
    Terms of Use
    Layout: fixed | fluid