4. Configuring TCP/IP on Windows 7
Windows 7 can use either
IPv4 or IPv6 to communicate with other machines on a network, but the
Windows 7 machine must receive the TCP/IP address. There are two ways
that a Windows 7 machine can get a TCP/IP address: statically or
dynamically.
4.1. Assigning Static TCP/IP Numbers
As an administrator, it
may be necessary to configure a Windows 7 machine manually (static
configuration). To configure a Windows 7 machine manually, you must know
the following:
Which TCP/IP address the machine will receive
What the subnet mask is
What the default gateway (router's TCP/IP address) is
What the DNS TCP/IP addresses are
Complete Exercise 1
to configure a Windows 7 machine to use a static TCP/IP address. This
example uses TCP/IP addresses for a local network, but you can use your
own TCP/IP addresses if you know what they should be.
Click Start and type Network and Sharing Center in the Windows 7 integrated search box. In the Network and Sharing Center window, click the Local Area Connection item in the View Your Active Networks section. Click the Properties button from the Activity section of the Local Area Connection Status box. In
the Local Area Connection Properties dialog box, click to select (do
not deselect the check box) Internet Protocol Version 4 (TCP/IPv4) and
click the Properties button, Manual configuration will work with both
IPv4 and IPv6. Under
the General tab, click the Use The Following IP Address radio button.
Type in the following (unless you want to use your own settings): Subnet Mask: 255.255.255.0 Default Gateway: 192.168.1.1 Click the Use The Following DNS Server Addresses radio button and type in 4.2.2.2 (unless you want to use your own settings) in the TCP/IP Address field.
|
Now let's take a look at how to configure a Windows 7 machine to use DHCP.
5. Configuring a Windows 7 Machine to use DHCP
Dynamic IP configuration
assumes that you have a DHCP server on your network that is reachable by
the DHCP clients. DHCP servers are configured to automatically provide
DHCP clients with all their IP configuration information, including IP
address, subnet mask, and DNS server.
For large networks, DHCP is
the easiest and most reliable way of managing IP configurations. By
default, a Windows 7 machine is configured as a DHCP client for dynamic
IP configuration.
Complete Exercise 2 to configure a Windows 7 machine to use dynamic IP configuration.
Click Start and type Network and Sharing Center in the Windows 7 integrated search box. In the Network and Sharing Center window, click the Local Area Connection item in the View Your Active Networks section. Click the Properties button from the Activity section of the Local Area Connection Status box. In
the Local Area Connection Properties dialog box, click to select (do
not deselect the check box) Internet Protocol Version 4 |TCP/IPv4) and
click the Properties button. DHCP will work with both IPv4 and IPv6. Choose
the Obtain An IP Address Automatically radio button from the General
tab of the Internet Protocol Version 4 (TCP/IPv4) Properties dialog box. Choose
the Obtain DNS Server Address Automatically radio button from the
General tab of the Internet Protocol Version 4 (TCP/IPv4) Properties
dialog box. To
use this configuration, click OK to accept the selection and close the
dialog box. To exit without saving (if you had a valid static
configuration), choose Cancel.
|
If you are using DHCP and you
are not connecting to other machines properly, you can do an i pconf i g
/al 1 to see what your TCP/IP address is. If your TCP/IP address starts
with 169.254.x.x, you are not connecting to the DHCP server and your Windows 7 machine is using APIPA.
5.1. Understanding APIPA
Automatic Private IP
Addressing (APIPA) is used to automatically assign private IP addresses
for home or small business networks that contain a single subnet, have
no DHCP server, and are not using static IP addressing. If APIPA is
being used, clients will be able to communicate only with other clients
on the same subnet that are also using APIPA. The benefit of using APIPA
in small networks is that it is less tedious and has less chance of
configuration errors than statically assigning IP addresses and
configuration. APIPA is used with Windows 7 under the following
conditions:
When the client is configured as a DHCP client, but no DHCP server is available to service the DHCP request.
When
the client originally obtained a DHCP lease from a DHCP server, but
when the client tried to renew the DHCP lease, the DHCP server was
unavailable and the lease period expired.
APIPA uses a Class B network
address space that has been reserved for its use. The address space is
the 169.254.0.0 network, where the range of 169.254.0,1-169.254,255,254
is available for the host to assign to themselves. The steps that APIPA
uses are as follows:
The Windows 7 client attempts to use a DHCP server for its configuration, but no DHCP servers respond.
The
Windows 7 client selects a random address from the
169.254.0.1-169.254.255.254 range of addresses and will use a subnet
mask of 255.255.0.0.
The
client uses a duplicate-address detection method to verify that the
address it selected is not already in use on the network.
If
the address is already in use, the client repeats steps 1 and 2. If the
address is not already in use, the client configures its network
interface with the address it randomly selected, if you note the number
of the address the APIPA client can select from (65536 addresses), the
odds of selecting a duplicate is very slim.
The
Windows 7 network client continues to search for a DHCP server every
five minutes. If a DHCP server replies to the request, the APIPA
configuration is dropped and the client receives new IP configuration
settings from the DHCP server.
You can determine whether your
network interface has been configured using APIPA by looking at your IP
address. You can do this easily from the command interpreter by using
the ipconfig /al 1 command. Let's take a look at how to test your TCP/IP
configuration.
6. Testing IP Configuration
After you have installed
and configured the TCP/IP settings, you can test the IP configuration by
using the ipconfig, ping, and nbtstat commands. These commands are also
useful in troubleshooting IP configuration errors. You can also
graphically view connection details through the Local Area Connection
Status of the Network and Sharing Center.
6.1. Using the ipconfig command
The ipconfig command displays your IP configuration. Table 8 lists the command switches that you can use with the ipconfig command.
Table 8. Ipconfig Switches
Switch | Description |
---|
/7 | Shows all of the help options for i pconfi 9 |
/ a11 | Shows
verbose information about your IP configuration, including your
computer's physical address, the DNS server you are using, and whether
you are using DHCP" |
/allcompartments | Shows IP information for all compartments" |
/release | Releases an IPv4 address that has been assigned through DHCP |
/release6 | Releases an IPv6 address that has been assigned through DHCP |
/renew | Renews an IPv4 address through DHCP |
/renew6 | Renews an IPv6 address through DHCP |
/flushdns | Purges the DNS Resolver cache |
/registerdns | Refreshes DHCP leases and re-registers DNS names |
/displaydns | Displays the contents of the DNS Resolver Cache |
/showclassid | Lists the DHCP class IDs allowed by the computer |
/setclassID | Allows you to modify the DHCP class ID |
If TCP/IP is still not working properly on the Windows 7 machine, you may need to do some troubleshooting.
7. TCP/IP Troubleshooting
If you are having trouble connecting to network resources, you might want to check the following:
If you can access
resources on your local subnet but not on a remote subnet, you should
check the default gateway settings on your computer. Pinging a remote
host and receiving a Destination Unreachable message is also related to
default gateway miscon figuration.
If
you can access some but not all resources on your local subnet or
remote subnet, you should check your subnet mask settings, the wiring to
those resources, or the devices between your computer and those
resources.
Use the
ipconfig utility to ensure that you are not configured with an APIPA
address. If so, determine why you are not receiving IP settings from
your DHCP server.
If
you can access a resource (for example, by pinging a computer) by IP
address, but not by name, you should check the DNS settings on your
computer.
After we have TCP/IP set up on
our Windows 7 machine, we can then connect the Windows 7 machine to the
network. In the next section, you will look at how to connect Windows 7
to a network.