Partager via


Ipconfig

IPConfig is a command-line tool that displays the current configuration of the installed IP stack on a networked computer.

When used with the /all switch, it displays a detailed configuration report for all interfaces, including any configured WAN miniports (typically used for remote access or VPN connections). Output can be redirected to a file and pasted into other documents. A sample report is shown here:

C:>\ipconfig /all

Windows 2000 IP Configuration

Host Name . . . . . . . . . . . . : TESTPC1

Primary DNS Suffix . . . . . . . : reskit.com

Node Type . . . . . . . . . . . . : Hybrid

IP Routing Enabled. . . . . . . . : No

WINS Proxy Enabled. . . . . . . . : No

DNS Suffix Search List. . . . . . : ntcorpdc1.reskit.com

dns.reskit.com

reskit.com

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . : dns.reskit.com

Description . . . . . . . . . . . : Acme XL 10/100Mb Ethernet NIC

Physical Address. . . . . . . . . : 00-CC-44-79-C3-AA

DHCP Enabled. . . . . . . . . . . : Yes

IP Address. . . . . . . . . . . . : 172.16.245.111

Subnet Mask . . . . . . . . . . . : 255.255.248.0

Default Gateway . . . . . . . . . : 172.16.240.1

DHCP Server . . . . . . . . . . . : 172.16.248.8

DNS Servers . . . . . . . . . . . : 172.16.55.85

172.16.55.134

172.16.55.54

Primary WINS Server . . . . . . . : 172.16.248.10

Secondary WINS Server . . . . . . : 172.16.248.9

Lease Obtained. . . . . . . . . . : Friday, May 05, 1999 2:21:40 PM

Lease Expires . . . . . . . . . . : Monday, May 07, 1999 2:21:40 PM

A number of other useful parameters for Ipconfig include /flushdns , which deletes the DNS name cache; /registerdns , which refreshes all DHCP leases and re-registers DNS names; and /displaydns which displays the contents of the DNS resolver cache.

The /release < adapter > and /renew < adapter > options release and renew the DHCP-allocated IP address for a specified adapter. If no adapter name is specified, the DHCP leases for all adapters bound to TCP/IP are released or renewed.

For /setclassid , if no class ID is specified, then the Class ID is removed. Table 3.3 lists all Ipconfig switches.

Table 3.3 Ipconfig Switches

Switch

Effect

/all

Produces a detailed configuration report for all interfaces.

/flushdns

Removes all entries from the DNS name cache.

/registerdns

Refreshes all DHCP leases and reregisters DNS names

/displaydns

Displays the contents of the DNS resolver cache.

/release < adapter >

Releases the IP address for a specified interface.

/renew < adapter >

Renews the IP address for a specified interface.

/showclassid < adapter >

Displays all the DHCP class IDs allowed for the adapter specified.

/setclassid < adapter > < classID to set >

Changes the DHCP class ID for the adapter specified.

/?

Displays this list.

The /showclassid and /setclassid options allow you to manipulate user class IDs from the command line. The user class IDs are options that a system administrator may set on the DHCP server to configure a client computer to identify itself with the server. Issuing the command ipconfig /showclassid < adapter > sends a query to the client's server; the server responds by providing the available classes. Once you know which classes are available, you can issue a command like ipconfig /setdhcpclassid < adapter > < class ID to set on the server > to set the class ID that the client will use from that point on. For more information about DHCP and class IDs, see "Dynamic Host Configuration Protocol" in this book.