Any device on an IP Network need some information about the network, including any information needed to communicate with someone who is not on the network. This information takes the form ofrouting information.
The route command is used to add or delete routing information from the memory of the NAT. significant information to a remote server for processing. In the NetNAT, this allows the collection of useful information without the need for masses of local storage or local processing. Computers that have more time on their hands are better at distilling and graphing statistical information.
NAT Notation For IP Address and Netmask
We have standardized on the shorthand notation used by many other manufacturers for the combination of a network address and its associated netmask. This notation can be explained through a number of examples:
Network Address Netmask NSC Notation ----------------- ---------------- --------------------- 220.127.116.11 255.255.0.0 123.234/16 18.104.22.168 255.255.255.0 123.234.222/24 22.214.171.124 255.255.254.0 123.234.222/23 126.96.36.199 255.255.255.255 188.8.131.52/32
The final number (after the slash) is the number of bits in the netmask. Because of this specification of netmask, the NAT is not compatible with networks that use “comb” style netmasks, where all one-bits are not contiguous. The following table gives the number of bits for each permitted netmask.
Netmask # of Bits Netmask # of Bits ----------------- ----------- ----------------- ----------- 184.108.40.206 1 255.128.0.0 9 192.0.0.0 2 255.192.0.0 10 220.127.116.11 3 255.224.0.0 11 240.0.0.0 4 255.240.0.0 12 248.0.0.0 5 255.248.0.0 13 252.0.0.0 6 255.252.0.0 14 254.0.0.0 7 255.254.0.0 15 255.0.0.0 8 255.255.0.0 16 Netmask # of Bits Netmask # of Bits ----------------- ----------- ----------------- ----------- 255.255.128.0 17 255.255.255.128 25 255.255.192.0 18 255.255.255.192 26 255.255.224.0 19 255.255.255.224 27 255.255.240.0 20 255.255.255.240 28 255.255.248.0 21 255.255.255.248 29 255.255.252.0 22 255.255.255.252 30 255.255.254.0 23 255.255.255.254 31 255.255.255.0 24 255.255.255.255 32
Checking Routing Information
The route command by itself will display the current “knowledge” of IP routes. Information displayed includes the IP Address of the destination host or network, the number of bits of netmask associated with that destination, the NAT logical interface to use in accessing that destination and the address of a gateway to be used, if the destination isn’t on the NAT’s network.
Setting a Default Route
A default is used in the absence of other routing information. For a LAN segment connected to the global Internet by way of a router (like one of our NATs), that router is the default route, or default gateway for that entire LAN. Any message that is addressed into the Internet will be handed to that router for subsequent delivery. That router, in turn, will have a default route, to get the message closer to its destination.
The NetNAT is usually the default gateway for every computer on the private network. This command specifies the default gateway for the NetNAT to use.
route add default [int name] [gateway]
- “Int name” is the name of a NAT logical interface on the default network.
- “Gateway” is the IP Address of the default gateway on that network.
Setting a Static Route
A static route specifies a knowledge of the proper route to a given network. This is used instead of a default route, when there is a better way to reach the destination than by using the default. For example, a network with an Internet connection and a dedicated link to an associated organization’s network would have a default pointing to the Internet, and a static route (for the other network) pointing to the dedicated link.
route add default en0 18.104.22.168 # default to Internet route add 140.63.33/24 en0 22.214.171.124 # static to associates
Here we see a default to a router at 126.96.36.199, which we trust to get our messages out into the Internet, and a static route to any of 250-some hosts on the 140.63.33 network. The notation “/24” says that our associates’ network uses a 24-bit netmask, or 255.255.255.0. Whether they actually do (at their site) is of no concern to us. We will send any message starting with 140.63.33 to them for delivery. The router at 188.8.131.52 will know how to get the messages to our associates.
Static routes are a valuable tool for the Enterprise Network Designer.
route add [dest net] [int name] [gateway]
- “Dest net” is the network IP Address/Netmask for a desired destination. This is in network/#bits notation.
- “Int name” is the name of a NAT logical interface to use to reach the destination.
- “Gateway” is the IP Address of the gateway that can get us closer to the destination.
Adding Routes to Connected Networks
Though it may seem obvious that the NAT can talk on its connected networks, it is nevertheless necessary to add routes for those. This is a very simple process but is occasionally forgotten. For an example, for an interface with an IP Address on en0 of 192.168.33.1 and a netmask of 255.255.255.0 (24-bits), we need a route command like this:
route addprivate 192.168.32/24 en0
Note that the route subcommand is addprivate instead of add. This keeps the NAT from advertising the route if a routing protocol is started on it. Due to the complexity of configuration of most routing protocols, we don’t recommend that you start one on the NAT. Feel free to run them on your other routers, though.
route addprivate [local net] [int name]
- “Local net” is the network IP Address/Netmask for the directly-connected network. This is in network/#bits notation.
- “Int name” is the name of a NAT logical interface that is connected to this network.