• Routing
  • Published: June 2003




    Download 0.8 Mb.
    bet25/161
    Sana21.03.2017
    Hajmi0.8 Mb.
    #1047
    1   ...   21   22   23   24   25   26   27   28   ...   161

    Internet Protocol (IP)


    IP is the mailroom of the TCP/IP stack, where packet sorting and delivery take place. At this layer, each incoming or outgoing packet is referred to as a datagram. Each IP datagram bears the source IP address of the sender and the destination IP address of the intended recipient. Unlike MAC addresses, the IP addresses in a datagram remain the same throughout a packet’s journey across an internetwork, unless you are using source routing. IP layer functions are described below.

    Routing


    Routing is a primary function of IP. Datagrams are handed to IP from UDP and TCP above, and from the NIC(s) below. Each datagram is labeled with a source and destination IP address. IP examines the destination address on each datagram, compares it to a locally maintained route table, and decides what action to take. There are three possibilities for each datagram:

    • It can be passed up to a protocol layer above IP on the local host.

    • It can be forwarded using one of the locally attached NICs.

    • It can be discarded.

    The route table maintains four different types of routes:

    1. Host route (a route to a single, specific destination IP address)

    2. Subnet route (a route to a subnet)

    3. Network route (a route to an entire network)

    4. Default route (used when there is no other match)

    To determine the single route to use to forward an IP datagram, IP uses the following process:

    1. For each route in the route table, IP performs a bit-wise logical AND between the destination IP address and the netmask. IP compares the result with the network destination for a match. If they match, IP marks the route as one that matches the destination IP address.

    2. From the list of matching routes, IP determines the route that has the most bits in the netmask. This is the route that matches the most bits to the destination IP address and is therefore the most specific route for the IP datagram. This is known as finding the longest or closest matching route.

    3. If multiple closest matching routes are found, IP uses the route with the lowest metric. If multiple closest matching routes with the lowest metric are found, IP can choose to use any of those routes. For Windows Server 2003, IP uses the route corresponding to the adapter that is the highest in the binding order. You can view and modify the binding order from the Adapters and Bindings tab in the Advanced Settings dialog box for the Network Connections folder.

    You can use the route print command to view the route table from the command prompt, as shown here:

    C:\>route print

    IPv4 Route Table

    ===========================================================================

    Interface List

    0x1 ........................... MS TCP Loopback interface

    0x10002 ...00 53 45 00 00 00 ...... WAN (PPP/SLIP) Interface

    0x10003 ...00 04 5a 56 10 06 ...... Linksys LNE100TX Fast Ethernet


    Adapter(LNE100TX v4)

    ===========================================================================

    ===========================================================================

    Active Routes:

    Network Destination Netmask Gateway Interface Metric

    0.0.0.0 0.0.0.0 157.60.136.1 157.60.137.88 20

    157.60.136.0 255.255.252.0 157.60.137.88 157.60.137.88 20

    157.60.137.88 255.255.255.255 127.0.0.1 127.0.0.1 20

    157.60.255.255 255.255.255.255 157.60.137.88 157.60.137.88 20

    127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1

    224.0.0.0 240.0.0.0 157.60.137.88 157.60.137.88 20

    255.255.255.255 255.255.255.255 157.60.137.88 157.60.137.88 1

    Default Gateway: 157.60.136.1

    ===========================================================================

    Persistent Routes:

    None


    If the IPv6 protocol is installed, the display of the route print command also lists IPv6 routes.

    The route table above is for a computer with the IP address of 157.60.137.88, the subnet mask of 255.255.252.0, and the default gateway of 157.60.136.1. It contains the following entries:



    • The first entry, to destination 0.0.0.0, is the default route.

    • The second entry is for the subnet 157.60.136.0, on which this computer resides.

    • The third entry, to destination 157.60.137.88, is a host route for the local host. It specifies the loopback address, which makes sense because a datagram bound for the local host should be looped back internally.

    • The fourth entry is for the all-subnets-directed broadcast address corresponding to the original Class B network ID 157.60.0.0.

    • The fifth entry is for the loopback network, 127.0.0.0.

    • The sixth entry is for IP multicasting, which is discussed later in this paper.

    • The final entry is for the limited broadcast (all ones) address.

    The Default Gateway is the currently active default gateway. This is useful to know when multiple default gateways are configured.

    On this host, if a packet is sent to 157.60.138.49, the closest matching route is the local subnet route (157.60.136.0 with the mask of 255.255.252.0). The packet is sent via the local interface that is assigned the IP address 157.60.137.88. If a packet is sent to 10.200.1.1, the closest matching route is the default route. In this case, the packet is forwarded to the default gateway at 157.60.136.1.

    The route table is maintained automatically in most cases. When a host initializes, entries for the local network(s), loopback, multicast, and configured default gateway are added. More routes may appear in the table as the IP layer learns of them. For instance, the default gateway for a host may advise it of a better route to a specific address using ICMP redirect, which is explained later in this paper. Routes also may be added manually using the route command, or by a routing protocol. The -p (persistent) switch can be used with the route command to specify permanent routes. Persistent routes are stored in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes.

    Windows Server 2003 TCP/IP introduces a new Automatic metric configuration option for interface-based and default gateway routing metrics. If selected for the interface, automatic metric configuration determines the metric for the routes associated with the interface configuration, such as subnet routes and host routes, based on the speed (bit rate) of the interface. The higher the speed, the lower the metric. For example, routes associated with 10 Mbps Ethernet interfaces have a metric of 30 and routes associated with 100 Mbps Ethernet interfaces have a metric of 20. If selected for the default gateway, automatic metric configuration determines the metric for the default route assigned to the interface, which is also based on the speed of the interface. Automatic metric configuration for both interface metrics and default routes are enabled by default and can be modified from the advanced configuration properties of the TCP/IP protocol for a connection in Network Connections. For more information, see An explanation of the Automatic Metric feature for Internet Protocol routes.

    DHCP servers can also provide a base metric and a list of default gateways. If a DHCP server provides a base of 100, and a list of three default gateways, the gateways will be configured with metrics of 100, 101, and 102 respectively. A DHCP-provided base metric does not apply to statically configured default gateways.

    By default, Windows-based systems do not behave as routers and do not forward IP datagrams between interfaces. However, the Routing and Remote Access service is included in Windows Server 2003 and can be enabled and configured to provide dynamic IP routing services using RIP and OSPF. Windows XP Professional includes support for silent RIP.

    When running multiple logical subnets on the same physical network, the following command can be used to have IP treat all subnets as local (all destinations are on the local link):



    Download 0.8 Mb.
    1   ...   21   22   23   24   25   26   27   28   ...   161




    Download 0.8 Mb.