C:\>ROUTE PRINT
Network AddressNetmaskGateway AddressInterfaceMetric
0.0.0.00.0.0.0172.16.34.1172.16.34.2321
127.0.0.0255.0.0.0127.0.0.1127.0.0.11
172.16.34.0255.255.255.0172.16.34.232172.16.34.2321
172.16.34.232255.255.255.255127.0.0.1127.0.0.11
172.16.255.255255.255.255.255172.16.34.232172.16.34.2321
10.0.0.010.0.0.0172.16.34.232172.16.34.2321
255.255.255.255255.255.255.255172.16.34.232172.16.34.2321

This table shows a computer with the IP address 172.26.34.232. The table contains the following seven entries:
  1. The first line is the default route. This is the route to which the computer sends IP packets if the other route entries do not specify where to send them.
  2. The second line is the loopback address. This is the address a host uses to send packets to itself. The loopback address is always 127.0.0.0, and the netmask is always 255.0.0.0.
  3. The third line is a network route.
  4. The fourth line is a host route for the local host (the route for this host computer).
  5. The fifth line is the subnet broadcast address.
  6. The sixth line is the IP multicast address. This is the address the computer sends packets to in order to reach an IP multicast group.
  7. The seventh line is for limited broadcast address. This is the address a host uses to reach all other addresses on the subnet.
Network Address

     The network address in the route table is the destination address. The network address column can have four different types of entries, listed here in the order in which they are searched for a match.
  1. Host address (a route to a single, specific destination IP address).
  2. Subnet address (a route to a subnet).
  3. Network address (a route to an entire network).
  4. Default gateway (a route used when there is no other match).

    If no match is found, the packets are discarded.
Netmask

     The netmask defines which portion of the network address must match in order for that route to be used. When the mask is written in binary, a 1 is significant (must match) and a 0 need not match.

     For example, the mask of all 255s (all 1s) means that the destination address of the packet to be routed must exactly match the network address in order for this route to be used. For another example, the network address 172.20.232.0 has a netmask of 255.255.255.0. This netmask means that the first three octets must match exactly, but the last octet need not match.

Gateway Address

     The gateway address is where the packet must be sent. This can be the local network card or the address of a gateway (router) on the local subnet.

Interface

     The interface is the address of the network card over which the packet should be sent. 127.0.0.1 is the software loopback address.

Metric

     The metric is the number of hops to the destination. Anything on the local subnet is one hop, and each router crossed after that is an additional hop. The metric is used to determine the best route.

Configuring Routes for a Multihomed Computer

     If your computer is multihomed and has connections to two separate IP networks, such as the corporate network and the Internet, the default gateway for only one network is used. For the computer to be able to communicate with the other network, routes must be added to the route table. This can be accomplished in one of two ways:



The following is a batch file that will delete a gateway address or add a
gateway address. This will prevent you from having to reboot Windows once
you change the gateway in the properties of the TCP/IP stacks on your system.

To delete the default gateway, use the command:

	gateway del

To add a default gateway, use the command:

	gateway add [IP address or hostname] [metric]

The metric is optional when adding the gateway. The IP address or hostname
is of course required.

:: gateway.bat
:_beg
	@echo off
	if '%1=='  goto _err
	if %1==add goto _add
	if %1==del goto _del
	goto _err
:_del
	route delete 0.0.0.0
	echo.
	goto _end
:_add
	route add 0.0.0.0 mask 0.0.0.0 %2 metric %3
	echo.
	goto _end
:_err
	echo Usage:
	echo.
	echo   gateway del
	echo   gateway add IP [metric]
	echo   gateway add hostname [metric]
	echo.
	echo Example:
	echo.
	echo   gateway add diamond.domain.com
	echo   gateway add 192.168.1.1 2
	echo.
:_end