Partager via


Routing for IPv4 (Windows Embedded CE 6.0)

1/6/2010

Routingis a primary function of IP. Datagrams are handed to IPv4 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 IPv4 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. The following list shows the routes in the order in which they are searched for a match:

  1. Host (a route to a single, specific destination IP address)
  2. Subnet (a route to a subnet)
  3. Network (a route to an entire network)
  4. Default (used when there is no other match)

The following example shows a typical route table.

=============================================================================
 Interface List 
 2       0 40 5 5b 8b 9e    Novell 2000 Adapter.
=============================================================================

=============================================================================
 Active Routes 
  
 The no. of entries is ::: 7
      Destination       Netmask       GatewayAddress     Interface    Metric  
 ----------------------------------------------------------------------------
          0.0.0.0          0.0.0.0     10.99.99.254      10.99.99.1       1
       10.99.99.0    255.255.255.0       10.99.99.1      10.99.99.1       1
       10.99.99.1  255.255.255.255        127.0.0.1       127.0.0.1       1
   10.255.255.255  255.255.255.255       10.99.99.1      10.99.99.1       1
        127.0.0.0        255.0.0.0        127.0.0.1       127.0.0.1       1
        224.0.0.0        224.0.0.0       10.99.99.1      10.99.99.1       1
  255.255.255.255  255.255.255.255       10.99.99.1      10.99.99.1       1
=============================================================================

The route table above is for a device with the class A IP address of 10.99.99.1. It contains the entries described below:

  1. The first entry, to address 0.0.0.0, is the default route.

  2. The second entry is for the subnet 10.99.99.0, which this device resides on.

  3. The third entry, to address 10.99.99.1, is a host route for the local host. Note that it specifies the loopback address, which makes sense because a datagram bound for the local host should be looped back internally.

  4. The fourth entry is for the network broadcast address.

  5. The fifth entry is for the loopback address, 127.0.0.0.

  6. The sixth entry is for IP multicasting.

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

    Note

    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 10.99.100.40, the table is first scanned for a host route (not found), then for a subnet route (that is found). The packet is sent through the local interface 10.99.99.1. If a packet is sent to 10.200.1.1, the same search is used, and no host, subnet, or network route is found. In this case, the packet is directed to the default gateway, by inserting the MAC address of the default gateway into the destination MAC address field.

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 (using ICMP, as explained later) of a better route to a specific network, subnet, or host. Windows Embedded CE allows you to add routes manually with the route utility.

Most Autonomous System (AS) routers use a protocol such as Routing Information Protocol(RIP) or Open Shortest Path First (OSPF) to exchange routing tables with each other. Windows Embedded CE does not directly support RIP and OSPF. However an application developer or OEM could add this support.

By default, Windows Embedded CE-based systems do not behave as routers and do not forward IP datagrams between interfaces. To change this default behavior, set the IPEnableRouter entry under the HKEY_LOCAL_MACHINE\Comm\Tcpip\Parms\IpEnableRouter registry key equal to 1.

See Also

Concepts

Managing IPv4 Routes
Routing for IPv6