Introduction
To make Microsoft's Dial-Up Networking (DUN) function with
a remote modem over a network, NetModem Client may
need to manipulate the client PC's routing table.
Depending upon several factors —
including the number of network cards present
in the PC, the entries in the routing table, and the
location of the server —
there may be situations where NetModem Client
is unable to correctly configure the routing table.
With an understanding of this issue, the problem may be fixed by
manually adjusting the TCP/IP routing table.
Background
NetModem
Client automatically reads the routing table on startup,
and if needed it will add an additional route to the
Windows routing table as each virtual COM port is opened
and thereby connects to a NetModem Server. Each added route
is removed when the client application closes the virtual
COM port.
Changes need to be made to the routing table in order for
Dial-Up Networking (client connections to a RAS server)
to work only if the following two conditions are true:
- The server's IP address is not on the same subnet
as the PC.
- The route to the server's address is handled via
a "default" route. A default route is one with a
network address of 0.0.0.0.
What NetModem Client does
If NetModem Client determines that an additional route
is necessary, then it needs to calculate the correct
information for that route. NetModem Client builds
this route using the first default route found in
the routing table. It builds a "specific" route
using the IP address of the server and a netmask of
255.255.255.255. It uses the same gateway address
as is used in the default route.
For example, consider the following (abbreviated)
routing table:
Network
Address |
Netmask
|
Gateway
|
Interface
|
Metric
|
|
|
|
|
|
0.0.0.0 |
0.0.0.0 |
10.0.0.1 |
10.0.0.33 |
1 |
10.0.0.0 |
255.255.255.0 |
10.0.0.33 |
10.0.0.33 |
1 |
10.0.0.33 |
255.255.255.255 |
127.0.0.1 |
127.0.0.1 |
1
|
This example for a PC with an address of 10.0.0.33,
on a class C subnet (a netmask of 255.255.255.0).
Only addresses 10.0.0.1 through 10.0.0.254 are accessible
in this subnet, which is specified in the second route
listed. The first route is the default route, which
specifies that all other address outside the range
of the 10.0.0.x subnet be delivered via the gateway
at 10.0.0.1.
Now suppose that the server's IP address is 10.2.2.55,
which is not on the client PC's subnet. NetModem Client
will take the gateway address of the default route,
a netmask of 255.255.255.255, the IP address of the
PC, and add a new route so that the routing table
will now read:
Network
Address |
Netmask
|
Gateway
|
Interface
|
Metric
|
|
|
|
|
|
0.0.0.0 |
0.0.0.0 |
10.0.0.1 |
10.0.0.33 |
1 |
10.0.0.0 |
255.255.255.0 |
10.0.0.33 |
10.0.0.33 |
1 |
10.2.2.55 |
255.255.255.255 |
10.0.0.1 |
10.0.0.33 |
1 |
10.0.0.33 |
255.255.255.255 |
127.0.0.1 |
127.0.0.1 |
1
|
The new route specifies that the address 10.2.2.55
can be reached via the 10.0.0.1 gateway, and singles
out that address over and above the other addresses
reachable via the default route. This guarantees that
the server will be accessible even if the default
route changes.
Why NetModem Client Does This
At first glance this additional route appears to
be redundant. It is, after all, specifying the gateway
address that is already listed in the default route.
So, why bother?
The issue is that Dial-Up Networking sessions also
manipulate the routing table. Even when used
with a local modem, DUN causes all subnets to be inaccessible.
This issue is not unique to redirected COM ports.
Consider this hypothetical Dial-Up Networking session
to an ISP. Once dialed-in, the ISP will assign the
calling PC an IP address of 10.23.0.135, and specify
that a default route use the gateway at 10.23.0.1
(presumably this gateway knows how to route packets
to the rest of the Internet). What happens next is
that the routing table gets a new default route added,
so the top two entries in the routing table look like
this:
Network
Address |
Netmask
|
Gateway
|
Interface
|
Metric
|
|
|
|
|
|
0.0.0.0 |
0.0.0.0 |
10.23.0.1 |
10.23.0.135 |
1 |
0.0.0.0 |
0.0.0.0 |
10.0.0.1 |
10.0.0.33 |
2
|
The core of the problem is this: with the above routing
table, all packets outside the range 10.0.0.1 to 10.0.0.254
will be routed via 10.23.0.1 to the ISP —
not to the gateway on the LAN. This includes
the server which is at 10.2.2.55! Dial-Up Networking
has, in effect, sawed off the limb it is sitting on
by updating the routing table such that the server
is no longer accessible to the PC.
Dial-Up Networking doesn't have this problem with
a local modem because the modem can always send and
receive data to the PC regardless of the state of
the routing table. Modems on servers, however, can
be cut off from the PC if the routing table suddenly
makes them inaccessible. By adding the specific host
route to the 10.2.2.55 address, the server is guaranteed
to be always accessible, because the server is not
dependent upon the default route.
Solving the Problem of Multiple Default Routes
The NetModem Client can run into problems when the
PC's routing table contains more than one default
route. The two most common situations where this occurs
are:
- The PC is "multi-homed," meaning it has more than
one network card, each of which connects to a different
subnet on the LAN.
- The PC has been configured to have redundant default
routes, with one intended to act as the backup for
the other.
The problem is that NetModem Client needs to determine
which gateway address to use for the additional routes
(see above), and with multiple default routes it is
forced to guess which gateway is the correct one.
NetModem Client will always use the gateway address
from the first default route in the routing table.
In either case, this means that NetModem Client might
have guessed wrong.
In the first case, the server may not be
accessible via the network card selected for the gateway.
In the second case, sometimes the backup gateway address
is not online.
There are two solutions to this problem:
- Avoid using default routes when at all possible.
Unless your LAN can also route to the Internet,
using a default route to route to other subnets
is somewhat misleading. If the routing table is
adjusted to specify the other subnets directly rather
than using a default route, then the problem goes
away.
- Manually add a static route to the Client PCs routing table
which specifies which gateway to use for the NetModem Server PC.
How to manually add a route to the NetModem Client PCs routing table
From a Command Prompt, type "
route print" to view the current
routing table.
For example, if your default route uses a gateway address
of
192.168.1.1, and the NetModem Server is on IP address
1.2.3.4 which is a different subnet then the NetModem
Client, and the route to this IP address is handled by a
"default route" (with a network address of 0.0.0.0), then
the new static route which needs to be created will use
this same gateway address, and its Network Address
(Destination) will be the IP address of the NetModem Server,
and its NetMask will be
255.255.255.255.
For this example, the Command Line to add a static route
to your routing table is:
route ADD -p 1.2.3.4 MASK 255.255.255.255 192.168.1.1
By adding this static route, it will ensure that NetModem
Client will still be able to connect to the NetModem Server
even after DUN has caused your default routes to change.
When "
-p" is used with the
ADD command, it makes the route
persistent across boots of the system. Otherwise, the route is not preserved.
For a list of other route commands, type "route ?".
Note: In Windows Vista and later, the "
route ADD" command must be
entered from an "Administrator Command Prompt" This is opened
by Right-clicking the Command Prompt icon, and selecting "Run
as Administrator".