Re: Set the TCP/IP Alternate Configuration settings per program
- From: "Arkady Frenkel" <arkadyf@xxxxxxxxxxxxxxxx>
- Date: Mon, 12 Feb 2007 17:28:36 +0200
That exactly AddIPAddress() for current session and for persistance you need
to write that to registry.
OTOH you can check WMI option if exist
Arkady
"Rolf Michael" <RolfMichael@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:674B6471-988B-443A-857B-17D82CE88AB7@xxxxxxxxxxxxxxxx
The IP address created by AddIPAddress is not persistent.
AddIPAddress() and the Alternate configuration is not the same.
See the Article following.
Alternate configuration enables a computer to use an alternate, manually
configured IP address configuration in the absence of a Dynamic Host
Configuration Protocol (DHCP) server. You can use an alternate
configuration
when a computer is used on more than one network, at least one of the
networks does not have a DHCP server, and automatic configuration is not
wanted.
For example, if you have a laptop computer that you use both at the office
and at home, it is useful to configure TCP/IP for an alternate
configuration.
At the office, the laptop uses a DHCP-allocated TCP/IP configuration. At
home, where there is no DHCP server present, the laptop automatically uses
the alternate configuration, which provides easy access to home network
devices and the Internet and allow seamless operation on both networks,
without the manual reconfiguration of TCP/IP settings.
Without an alternate configuration, TCP/IP uses Automatic Private IP
Addressing (APIPA).
I have to set an Alternate Configuration from my own Program, not with the
GUI:
To configure TCP/IP for an alternate configuration
1. Open Network Connections.
2. Right-click the network connection that you want to configure, and then
click Properties.
3. On the General tab (for a local area connection) or the Networking tab
(for all other connections), click Internet Protocol (TCP/IP), and then
click
Properties.
4. On the General tab, click Obtain an IP address automatically.
5. On the Alternate Configuration tab, click User configured, and then
type
appropriate values for the following:
? IP address
? Subnet mask
? Default gateway
? Preferred and alternate DNS server
? Preferred and alternate WINS server
"Arkady Frenkel" wrote:
Look at IPHLPAPI's AddIPAddress()
Arkady
"Rolf Michael" <RolfMichael@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:EC8801CC-6DDF-4830-AFDD-014D18B0B2D0@xxxxxxxxxxxxxxxx
To set the "alternate configuration" programatically:
Does anyone know of an API?
Or is there a Microsoft-documentation of the registry entry
HKLM\System\CCS\Services\Dhcp\Configurations\Alternate_{AdapterName}\Options
REG_BINARY. (The extraction of the fields in the REG_BINARY-structure
locks
quite straight-forward - but an API or a documentation gives a much
better
feeling ...)
.
- Follow-Ups:
- Re: Set the TCP/IP Alternate Configuration settings per program
- From: mkyprianou
- Re: Set the TCP/IP Alternate Configuration settings per program
- References:
- Re: Set the TCP/IP Alternate Configuration settings per program
- From: Arkady Frenkel
- Re: Set the TCP/IP Alternate Configuration settings per program
- From: Rolf Michael
- Re: Set the TCP/IP Alternate Configuration settings per program
- Prev by Date: Re: IpFltDrv
- Next by Date: Re: IpFltDrv
- Previous by thread: Re: Set the TCP/IP Alternate Configuration settings per program
- Next by thread: Re: Set the TCP/IP Alternate Configuration settings per program
- Index(es):
Relevant Pages
|