|
|
|
|
Networking Personal Computers with TCP/IPBy Craig Hunt1st Edition July 1995 1-56592-123-2, Order Number: 1232 408 pages, $32.95 |
Windows 95 Network Applications
Windows 95 provides the basic TCP/IP applications FTP, TELNET, PING, ARP, NETSTAT, ROUTE and TRACERT (traceroute). These programs are available through the Windows 95 command-line interface. To use that interface, run MS-DOS prompt from the Programs menu in the Start menu, which opens a window that provides the familiar DOS-style command-line prompt. Enter the network commands at the prompt using the examples in the following sections as a guide to syntax and usage.
FTP and TELNET
The FTP command is the same command-line version of File Transfer Protocol that has been used on many systems for years. The example below shows a simple file retrieval using the Windows 95 FTP command.
C:\USERS\craig>ftp ruby.ora.com Connected to ruby.ora.com. 220 ruby FTP server ready. User (ruby.ora.com:(none)): craig 331 Password required for craig. Password: 230 User craig logged in. ftp> get temp.txt 200 PORT command successful. 150 Opening ASCII mode data connection for temp.txt (2059 bytes). 226 Transfer complete. 2108 bytes received in 0.49 seconds (4.30 Kbytes/sec) ftp> quit 221 Goodbye.The TELNET command can take two arguments: the host, and the port. You'll see examples of why it is useful to specify the port number in Chapter 8 and Chapter 9. The Windows 95 TELNET command opens a separate terminal window that supports basic VT100 terminal emulation.
PING
The PING command is used to test basic connectivity. By default, the Windows 95 version of ping sends four packets that are each 32 bytes long, as shown in the example below. Four packets are enough to prove connectivity. To send a different number of packets, specify the number with the -n command-line argument. Send packets of a different length with the -l argument. For example, the command ping -n 10 -l 1002 peanut.nuts.com sends ten packets that are each 1002 bytes long.
C:\WINDOWS>ping ruby.ora.com Pinging ruby.ora.com [198.112.208.25] with 32 bytes of data: Reply from 198.112.208.25: bytes=32 time=64ms TTL=238 Reply from 198.112.208.25: bytes=32 time=46ms TTL=238 Reply from 198.112.208.25: bytes=32 time=62ms TTL=238 Reply from 198.112.208.25: bytes=32 time=198ms TTL=238ARP
The ARP command is used to display or modify the contents of the ARP table. The table is built by the Address Resolution Protocol (ARP), and is used to map IP addresses to Ethernet addresses. To view the contents of the ARP table use the -a command option. Store new entries in the table with the -s option, and delete unwanted entries with -d. All three command options are shown in the example that follows. Note how similar this syntax is to the UNIX arp command.
C:\WINDOWS>arp -s 128.66.16.1 00-40-9a-01-a1-aa C:\WINDOWS>arp -a Interface: 128.66.26.36 Internet Address Physical Address Type 128.66.16.1 00-40-9a-01-a1-aa static 128.66.26.62 00-40-9a-00-04-eb dynamic C:\WINDOWS>arp -d 128.66.16.1 C:\WINDOWS>arp -a Interface: 128.66.26.36 Internet Address Physical Address Type 128.66.26.62 00-40-9a-00-04-eb dynamicThe first ARP command stores an entry in the table that maps the IP address 128.66.16.1 to the Ethernet address 00-40-9a-01-a1-aa. Viewing the table with the -a argument, we see that the entry stored with the -s argument is a static entry. That means the entry stays in the table until the system reboots or the entry is manually removed with the -d option, as we do later in the example. The dynamic entry was placed in the table by the ARP protocol. Dynamic entries periodically time-out and are removed from the table to keep the addresses fresh.
NETSTAT
The NETSTAT command provides a variety of information about the TCP/IP software and the network interface. NETSTAT provides the following interesting options:
- -a
- displays information on all active connections.
- -e
- displays Ethernet statistics.
- -r
- displays the routing table.
- -s
- displays protocol statistics.
Any of these command line options can be combined with the -n option to cause the command to display numeric addresses instead of host names. For example, netstat -nr displays the contents of the routing table and does not convert the IP addresses to hostnames before they are displayed. Some examples of the netstat command are shown below.
C:\WINDOWS>netstat -a Active Connections Proto Local Address Foreign Address TCP almond:1028 acorn.nuts.com:telnet UDP almond:nbname *:* UDP almond:nbdatagram *:* C:\WINDOWS>netstat -e Interface Statistics Received Sent Bytes 14719 15946 Unicast packets 44 46 Non-unicast packets 76 76 Discards 0 0 Errors 0 0 Unknown protocolsROUTE
The function and syntax of the Windows 95 ROUTE command is similar to the UNIX route command. Use the command to manually configure the routes in the routing table. Its syntax is:
ROUTE [-f] [command [destination] [MASK netmask] [gateway]]The ROUTE command options are:
- -f
Flushes all of the routes from the routing tables. If used with one of the commands, the table is flushed before the command is executed.
- command
The command field specifies the action that the ROUTE command should take. There are four command keywords:
ADD Add a route DELETE Delete a route CHANGE Modify an existing route PRINT Display the routing table
- destination
Identifies the network or host that is reached through this route.
- MASK netmask
The netmask is applied to the address provided in the destination field to determine the true destination of the route. If a bit in the netmask is set to 1, the corresponding bit in the destination field is a significant bit in the destination address. For example, a destination of 128.66.12.1 with a netmask of 255.255.0.0 defines the route to network 128.66.0.0, but the same destination with a mask of 255.255.255.255 defines the route to the host 128.66.12.1. If no value is specified for the netmask, it defaults to 255.255.255.255.
- gateway
Specifies the IP address of the gateway for this route.
In the following example we add a route to reach the host 128.66.12.3 and a route to reach the subnet 128.66.8. In each case, the netmask determines if the route is interpreted as a network route or a host route. After entering the new routes, we display the routing table with the ROUTE PRINT command to examine our handiwork.
C:\>route add 128.66.12.3 mask 255.255.255.255 128.66.24.5 C:\>route add 128.66.8.0 mask 255.255.255.0 128.66.24.8 C:\>route print Active Routes: Network Address Netmask Gateway Address Interface Metric 0.0.0.0 0.0.0.0 128.66.24.254 128.66.24.1 1 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1 128.66.8.0 255.255.255.0 128.66.24.8 128.66.24.1 1 128.66.12.3 255.255.255.255 128.66.24.5 128.66.24.1 1 128.66.24.0 255.255.255.0 128.66.24.1 128.66.24.1 1 128.66.24.1 255.255.255.255 127.0.0.1 127.0.0.1 1 128.66.255.255 255.255.255.255 128.66.24.1 128.66.24.1 1 224.0.0.0 224.0.0.0 128.66.24.1 128.66.24.1 1 255.255.255.255 255.255.255.255 128.66.24.1 128.66.24.1 1As the display shows, there are several more routes than the two we just entered. The default route (destination 0.0.0.0) is the route that was entered using the Gateway tab in the TCP/IP Properties window. All of the other routes are part of the minimal routing table that is created by installing TCP/IP. By destination, they are:
- 127.0.0.0
The loopback network route. 127.0.0.1 is the address of the loopback interface.
- 128.66.24.0
The direct route to the local network. This is the route the PC uses to reach the network to which it is directly attached. The gateway address is the address of the computer's own Ethernet adapter.
- 128.66.24.1
The localhost route. This is a special route to this localhost. The address 128.66.24.1 is the address of this host. The route to this host is through the loopback interface.
- 128.66.255.255
The broadcast route. Broadcasts are sent through the local Ethernet interface.
- 224.0.0.0.
The multicast route. Multicasts are sent through the local Ethernet interface.
- 255.255.255.255
The limited broadcast route. Limited broadcasts are sent through the local Ethernet interface.
The routes added by the ROUTE ADD command do not survive a boot. Put the ROUTE ADD commands in a batch file and store the batch file in the C:\WINDOWS\START MENU\PROGRAMS\STARTUP folder. Programs in the STARTUP directory are executed every time Windows 95 restarts. It's one way to ensure that the routes are reinstalled after a boot.
By default, the batch file runs and leaves an ugly MS-DOS window open. Fix this by setting the correct properties for the new batch file. Assume the batch file is named ROUTES.BAT. To set the file properties, open the C:\WINDOWS\START MENU\PROGRAMS\STARTUP folder. Highlight the ROUTES icon that represents the ROUTES.BAT file (you can highlight the icon with a single click). Then select Properties from the File menu of the Startup window. A window labeled Routes Properties will appear. Check the Close on exit box and select Minimized in the Run listbox. After these two values are set, click OK. You're done. The system automatically creates a ROUTES.PIF file to handle the execution of the new batch file. The routes are re-installed every time Windows 95 is restarted.
TRACERT
TRACERT is the Windows 95 version of the UNIX traceroute command. The TRACERT command displays each hop on the route from the PC to a remote site, as shown in the following example.
C:\WINDOWS>tracert buckeye.nuts.com Tracing route to buckeye.nuts.com [128.66.55.105] over a maximum of 30 hops: 1 25 ms 21 ms 22 ms 128.66.26.62 2 26 ms 23 ms 23 ms gw.nuts.com [128.66.16.253] 3 26 ms 23 ms 23 ms 128.66.2.239 4 28 ms 24 ms 24 ms 128.66.230.200 5 25 ms 23 ms 22 ms buckeye.nuts.com [128.66.55.105] Trace complete.If there is a problem with the route, the command stops printing out the names or addresses of the gateways at each hop. Instead, TRACERT prints out asterisks. An occasional asterisk is not a problem. However when the display becomes all asterisk, it indicates a routing problem at the last remote site listed in the TRACERT output.
These TCP/IP applications are not the only network applications provided with Windows 95. The operating system also includes some NetBIOS applications.
NetBIOS Applications
File and printer sharing are the most important NetBIOS applications. Windows 95 provides these services in a manner that is very similar to Windows for Workgroups. A Windows 95 system can use the files and printers offered by other Windows systems and it can offer those systems access to its files and printer. In this way, it acts as a peer to other Windows systems in a NetBIOS peer-to-peer network. A Windows 95 system can also be a client to a Windows NT server in a NetBIOS network. File and printer sharing under Windows NT is covered in the next chapter. In this section we discuss how files and printers are offered to network peers and how services offered by the PC's peers are used.
The first step in sharing files and printers on a Windows 95 system is to make sure that the necessary NetBIOS software is installed. Refer back to the Network window shown in Figure 6-5. When NetBIOS is not installed that window does not have the Identification and Access Control tabs and the File and Print Sharing button is "greyed out".
To install the necessary software, run the Network applet from the Control Panel. Click the Add button in the Configuration tab of the Network window. When the Select Network Component Type window appears, highlight Service and click Add. Highlight Microsoft in the Manufacturers section of the Select Network Service window and highlight File and printer sharing for Microsoft networks in the Network Services section of that window. Click OK. The three windows discussed here are all shown in Figure 6-27.
![]()
Figure 6-27: Installing Windows 95 NetBIOSFile and printer sharing for Microsoft Networks and Client for Microsoft Networks are now both listed as installed network components in the Network window because the Microsoft client software is automatically installed when the file and printer sharing software is installed. Configure the NetBIOS hostname and workgroup name using the Identification tab of the Network window. The hostname must be unique on the NetBIOS network and less than 16 characters long. The workgroup name must be the name assigned to your workgroup by the NetBIOS administrator. (See Chapter 7 for a discussion of NetBIOS and the role of the hostname and workgroup name.) Use the Access Control tab to modify access control only if you have a Windows NT server and the administrator of that server maintains a user access control list. For compatibility with Windows for Workgroups, let access control default to share-level control.
After setting the necessary values click OK in the Network window. The system will request the Windows 95 CDROM if it is not already loaded. After the necessary system files are copied, restart Windows.
Exporting Files and Printers
The Network Neighbors icon now appears on the desktop. We will use it later to access services offered by other PCs on the network. But first let's finish the job of offering the other PCs access to our computer's files and printer.
To offer access to one of your PC's file folders, use the Microsoft Explorer or My Computer to walk through the file system until the folder icon of the directory you want to export is displayed. Click-right on the folder icon to display the File menu. Select Sharing from that menu to display the Sharing tab of the Properties window, which is shown in Figure 6-28.
![]()
Figure 6-28: Sharing a File FolderOn the Sharing tab, select Share As to enable file sharing for the folder. The Share Name field contains the name advertised to remote systems. It defaults to the directory name of the folder but it can be any name you choose that is less than 16 characters long. Also type a useful description of the exported folder in the Comment field. The Comment can be displayed on remote systems and helps remote users understand the type of information stored in the folder.
Use the Access Type section of the Sharing tab to control how clients can use the directory. The three access control choices are:
- Read-Only
Permits the remote user to list the directory, read files contained in the directory, and copy files from the directory. The remote user cannot write to the directory.
- Full
Permits the remote user to read, write and delete the files contained in the directory. The remote user can create and delete sub-directories within the directory and even delete the directory itself.
- Depends on Password
Permits the remote user to have either read-only access or full access depending on the password entered by the user.
Use the Password section of the tab to enter the passwords that control access to the folder. Once you enter a password in these boxes the remote user must provide the same password to have access to the folder. The Read-Only Password field is active when Read-Only is selected in the Access Control section of the tab. The Full Password field is active when Full is selected. When Depends on Password is selected, both password fields are active and the remote user is given read access to the directory if she enters the Read-Only Password or full access if she responds with the Full Password.
Offering to share a printer is very similar to offering a folder. To export a printer, select Printers from the Settings menu in the Start menu. In the Printers window, click-right on the icon of the printer to open the File menu. Select Sharing from the menu to display the Sharing tab of the printer's Properties window.
![]()
Figure 6-29: Sharing a PrinterUse the Sharing tab, shown in Figure 6-29, to enter a share name for the printer. The default share name is the local name of the printer. Provide a description of the printer in the Comment field. (In Figure 6-29, the comment describes the printer and where it is located in the building.) Use the Password box to enter a password that limits access to the printer. If a password is defined, only those remote users who know the password will be able to use the printer.
Using Shared Files and Printers
Use the Network Neighbors icon, located on the desktop, to access shared file folders and printers. Double-clicking on this icon opens a window that displays the hosts in your workgroup and an item labeled Entire Network. Double-clicking on Entire Network opens a window that displays an icon for every workgroup on your network. Double-clicking on any of these workgroup icons displays the hosts in that workgroup. Walk through the network in this manner to find the host that offers the service you want.
To use a file folder offered by a PC, double-click on the PC's icon and then double-click on the folder's icon when it is displayed. If the folder is password protected, enter the password when prompted. Once the folder is open you can use the files in the folder as if they were local files. A Windows 95 exception to this rule affects shortcuts. A shortcut is an entry in a folder that refers indirectly to a file in another folder. If a shortcut is exported but the file referred to by the shortcut is not exported, the file cannot be accessed through the shortcut from a remote system. People exporting files to the network need to make sure they export the correct files!
Figure 6-30 shows an example of moving through the Network Neighbors window to a host window and finally to the password prompt.
![]()
Figure 6-30: Accessing a Shared FolderTo access a shared printer, locate the host among your Network Neighbors that has the printer you want to use and then double-click on the printer's icon. If this printer is not already installed on your PC, you are asked to install it now. Click Yes in the Printers dialog box to start the Add Printer Wizard, which is the same wizard used to install a local printer.
The wizard begins by asking if this printer is used by MS-DOS programs. The default is No. Select Yes to give DOS programs access to the printer. Selecting Yes causes the wizard to ask for the name of a printer port because some DOS programs refer to a printer using the name of the logical port to which it is attached, such as LPT1 or COM4. Press the Capture Printer Port button to pick a port. In the Capture Printer Port window, select a port from the Device listbox and click OK. (For the first printer installed on the PC the port is usually LPT1.) When the wizard returns to the Add Printer Wizard window, click Next.
The wizard then asks for a local printer name--the default name is the description of the remote printer. It also asks if this printer should be the default printer for Windows applications. If this is the only printer the system will be using check Yes. Otherwise check No for all printers except the one you consider the "primary" printer. Click Next to go to the last window of the printer setup and then click Finish.
By default the wizard sends a test to the printer. Wait for the test to finish and examine the output. If it is acceptable, click Yes in the printer test dialogue box displayed by the wizard. If the print test fails, click No to restart the printer wizard and to correct the configuration.
The printer is now installed in the Printers folder. It can be used by any Windows 95 program. It can also be used by any DOS program by referencing it by its port name, for example LPT1.
There is much more information about file and printer sharing later in this book. Chapter 7, Networking Windows NT, contains information about NetBIOS and about NetBIOS file and printer sharing. Chapter 10, File and Print Servers, is a complete chapter about using UNIX servers to provide file and print sharing services to PCs.
Back to: Networking Personal Computers with TCP/IP
© 2000, O'Reilly & Associates, Inc.
webmaster@oreilly.com