Using the hostname Command
The hostname command is the simplest of all the TCP/IP commands presented in this tutorial. It simply displays the computer's host name. For example:
C:\>hostname doug C:\>
Here, the host name for the computer is doug. The Windows version of the hostname command has no parameters. However, the Unix/Linux versions of hostname let you set the computer's host name as well as display it. You do that by specifying the new host name as an argument.
Using the ipconfig Command
Using the ipconfig command displays information about a computer's TCP/IP configuration. It can also be used to update DHCP and Domain Name Server (DNS) settings.
Displaying basic IP configuration
To display the basic IP configuration for a computer, use the ipconfig command without any parameters, like this:
C:\>ipconfig Windows IP Configuration Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::cca:9067:9427:a911%8 IPv4 Address. . . . . . . . . . . : 192.168.1.110 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 Tunnel adapter Local Area Connection* 6: Connection-specific DNS Suffix . : IPv6 Address. . . . . . . . . . . : 2001:0:4136:e38c:2c6c:670:3f57:fe91 Link-local IPv6 Address . . . . . : fe80::2c6c:670:3f57:fe91%9 Default Gateway . . . . . . . . . : :: Tunnel adapter Local Area Connection* 7: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::5efe:192.168.1.110%10 Default Gateway . . . . . . . . . : C:\>
When you use ipconfig without parameters, the command displays the name of the adapter, the domain name used for the adapter, the IP address, the subnet mask, and the default gateway configuration for the adapter. This is the easiest way to determine a computer's IP address.
Tip: If your computer indicates an IP address in the 169.254.x.x block, odds are good that the DHCP server isn't working. 169.254.x.x is the Class B address block that Windows uses when it resorts to IP Autoconfiguration. This usually happens only when the DHCP server can't be reached or isn't working.
Displaying detailed configuration information
You can display detailed IP configuration information by using an /all switch with the ipconfig command, like this:
C:\>ipconfig /all Windows IP Configuration Host Name . . . . . . . . . . . . : WK07-001 Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network Connection Physical Address. . . . . . . . . : 00-12-3F-A7-17-BA DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes Link-local IPv6 Address . . . . . : fe80::cca:9067:9427:a911%8(Preferred) IPv4 Address. . . . . . . . . . . : 192.168.1.110(Preferred) Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 DNS Servers . . . . . . . . . . . : 192.168.1.10 68.87.76.178 NetBIOS over Tcpip. . . . . . . . : Enabled C:\>
You can determine a lot of information about the computer from the ipconfig /all command. For example:
- The computer's host name is WK07-001.
- The computer's IPv4 address is 192.168.1.110, and the subnet mask is 255.255.255.0.
- The default gateway is a router located at 192.168.1.1.
- This router is also the network's DHCP server.
- The DNS servers are at 192.168.1.10 and 68.87.76.178.
In this tutorial:
- TCP/IP Tools and Commands
- Using the arp Command
- Using the hostname Command
- Renewing an IP lease
- Using the nbtstat Command
- Using the netdiag Utility
- Using the netstat Command
- Using the nslookup Command
- Displaying DNS records
- DNS-Land
- Using the pathping Command
- Using the ping Command
- Using the route Command
- Using the tracert Command