From: <Microsoft Internet Explorer 5¡Æ¢® AuAa>
Subject: Understanding routing for Solaris
Date: Sun, 17 Jun 2001 11:58:04 +0900
MIME-Version: 1.0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.enteract.com/~lspitz/routing.html
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Understanding routing for Solaris</TITLE>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3018.900" name=3DGENERATOR>
<META=20
content=3D"Published article on how to set up routing tables in Solaris. =
 Also how to leverage VLSM"=20
name=3Ddescription>
<META content=3D"VLSM,routing,solaris,CIDR,subnet,IP,subnet   =
mask,interfaces"=20
name=3Dkeywords></HEAD>
<BODY link=3D#0000ff vLink=3D#800080><I><FONT=20
face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+1>How to get your =
packets from=20
point a to point b</FONT></FONT></I> <BR><B><FONT=20
face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+4>Routing with=20
Solaris</FONT></FONT></B>=20
<P><B><FONT size=3D-1><A=20
href=3D"mailto:lance@honeynet.org?Subject=3DRouting With Solaris">Lance=20
Spitzner</A></FONT></B> <BR>Last Modified: 9 March, 2000=20
<P><B>This article is the second in a two part series. In the <A=20
href=3D"http://www.enteract.com/~lspitz/interfaces.html">first =
article</A> I=20
discussed how to configure, modify and troubleshoot network interface =
cards.=20
This second article will discuss routing issues for systems with two or =
more=20
network interface cards. I will not be discussing gated nor any routing=20
protocols, such as RIP or OSPF. This article will focus only on =
implementing=20
static routing tables. Throughout this article I will be using the octet =
method=20
for denoting subnet masks, as opposed to the more modern method of using =
a /.=20
Example, I will be designating a class C network as 255.255.255.0, as =
opposed to=20
/24. I decided to use the older notation as this is what Solaris =
uses.&nbsp; If=20
you have any questions about IP addressing or subnetting, I highly =
recommend you=20
first review <A=20
href=3D"http://www.3com.com/nsc/501302.html">http://www.3com.com/nsc/5013=
02.html</A>.</B>=20
<BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT=20
size=3D+2>Routing</FONT></FONT></B>=20
<P>Routing has always fascinated me, it is amazing how a system knows =
where to=20
forward a packet. In this article, I will discuss how Solaris 2.6 knows =
just=20
that, where to forward a packet. The first part of this article I will =
explain=20
and setup some basic static routes. In the second part of the article I =
will=20
cover some of Solaris 2.6's more advanced capabilities, specifically =
VLSM=20
(Variable Length Subnet Masks).=20
<P>Routing is the process of forwarding a packet from point A to point =
B.=20
Solaris does this by building a routing table. When it forwards a =
packet, it=20
first refers to the routing table to decided where to send the packet. =
The key=20
to successful routing with Solaris is building a proper routing table. =
You start=20
building your routing table with your first network interface device.=20
<P>When you configure a network interface device, the kernel =
automatically=20
builds a static routing table. For example, lets say you are on a system =
that=20
has a single interface, elx0. You configure the device to have an IP =
address of=20
207.229.165.133, with a netmask of 255.255.255.0. To see the routing =
table the=20
kernel has built, use the command netstat &#8211;nr.=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>Routing =
Table:</FONT></FONT>=20
<BR><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1>Destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Gateway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
Flags Ref&nbsp;&nbsp; Use&nbsp;&nbsp;&nbsp; Interface</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New,Courier"><FONT size=3D-1>----------------- =
--------------------=20
----- ----- ------ ---------</FONT></FONT> <BR><FONT=20
face=3D"Courier New,Courier"><FONT =
size=3D-1>207.229.165.0&nbsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
1&nbsp;&nbsp;&nbsp;&nbsp; 20=20
elx0</FONT></FONT> <BR><FONT face=3D"Courier New,Courier"><FONT=20
size=3D-1>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
UH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; =
94=20
lo0</FONT></FONT>=20
<P>&nbsp;Here we see the system's routing table. The first column is=20
<I>Destination</I>, which network does the packet want to go to. The =
second=20
column is <I>Gateway</I>, the IP address the packet must go to get to =
the=20
destination (the next hop). The third column is <I>Flags</I>, which =
denotes=20
interface information, such as U for up, and G for Gateway. The fourth =
column is=20
<I>Ref</I>, which denotes how many times that specific MAC address is =
referenced=20
in the routing table. The fifth is <I>Use</I>, or how many packets have =
gone=20
through the interface. The last column is <I>Interface</I>, it show the =
device=20
the packet must go through if the destination is the local network.=20
<P>In the example above we have two routes. The bottom one, 127.0.0.1, =
is the=20
standard loopback route. All systems have this route, the kernel uses it =
to talk=20
to itself. The second entry is a result of the elx0 interface. This =
entry says=20
if you need to get to a node on the 207.229.165.0 network, go to=20
207.229.165.133, which is the system interface. This entry is called the =
local=20
network entry and is added by default. The kernel assumed that because =
elx0 has=20
an IP address of 207.229.165.133 and a netmask of 255.255.255.0, it must =
be=20
connected to the local network 207.229.165.0. Thus, if you want to talk =
to any=20
node on the 207.229.165.0 network, the kernel knows exactly where to =
send the=20
packet.=20
<P>Any time you add a new interface, the kernel adds a routing entry =
similar to=20
the one above. It assumes that the new interface can talk to the local=20
network.&nbsp; Your system can now talk to the local network, =
207.229.165.0. But=20
what about other networks, such as the Internet? If you were to attempt =
to talk=20
to any node on any other network, such as 206.54.252.8, you would get =
the=20
following error.=20
<P>&nbsp;<FONT face=3D"Courier New"><FONT size=3D-1>lisa #ping=20
206.54.252.8</FONT></FONT> <BR><FONT size=3D-1><FONT=20
face=3D"Courier New">&nbsp;&nbsp; ICMP Net Unreachable from gateway lisa =

(</FONT>207.229.165<FONT face=3D"Courier New">.133)</FONT></FONT> =
<BR><FONT=20
size=3D-1><FONT face=3D"Courier New">&nbsp;&nbsp; for icmp from lisa=20
(</FONT>207.229.165<FONT face=3D"Courier New">.133)</FONT></FONT>=20
<P>The system has no idea how to reach this node. To fix this, we need =
to give=20
the system a default route. When the kernel is given a destination it =
does not=20
know, it sends it to the default route. The default route is usually the =
IP=20
address of another router. This router takes the packet and does one of =
two=20
things with it. If the destination is local to the router, it sends the =
packet=20
to the local destination. If not, the router sends the packet upstream =
to=20
another router. This process repeats itself until the packet has reached =
its=20
destination.=20
<P>By default, Solaris uses a routing protocol to dynamically determine =
the=20
default route, RIP or Route Discovery. During the init process, the=20
/etc/rc2.d/S69inet will attempt to find a router running route discovery =

(/usr/sbin/in.rdisc). If this fails after three attempts, the script =
then=20
launches /usr/bin/in.routed, otherwise known as RIP. However, we will =
use=20
neither method. Instead, we are going to manually set the default route. =
When=20
the default route is manually set, neither routing protocol is =
initiated. The=20
advantages to this are a simpler and more secure system to administer.=20
<P>You manually define the default route with the file =
/etc/defaultrouter. This=20
file consists of a single entry, the IP address of the default router. =
This file=20
is read during the init process (specifically /etc/rc2.d/S69inet) and =
added to=20
the routing table.&nbsp; For this system, we have identified the default =
router=20
as 207.229.165.1. This is the IP address of the router that connects us=20
Internet. If our system does not know a packet's destination, it sends =
the=20
packet to the default router. With our default route, the new routing =
table=20
would looks as follows=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>Routing =
Table:</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT=20
size=3D-1>Destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
Gateway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
Flags Ref&nbsp;&nbsp; Use&nbsp;&nbsp;&nbsp; Interface</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>-------------------- =
-------------------- -----=20
----- ------ ---------</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>207.229.165.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp; 20 =

elx0</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
UG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;=20
20</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
UH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 30=20
lo0</FONT></FONT>=20
<P>Based on this table, the system now has two choices for forwarding a =
packet.=20
If the destination is on the 207.229.165.0 network, the packet is sent =
to the=20
local network. However, if the destination is any other network, then =
the packet=20
is sent to the default router. Notice that the default router, =
207.229.165.1, is=20
on the local network. If the default route is not on the local network, =
the=20
system cannot reach the default router.=20
<P>To define the netmasks of your network, you use the file =
/etc/netmasks. This=20
file is read during the bootup process, defining the makeup of your =
networks.=20
Here is an example of a /etc/netmasks file.<BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>
<P>#<BR># The netmasks file associates Internet Protocol (IP) =
address<BR># masks=20
with IP network numbers.<BR># <BR># network-number netmask<BR>#<BR># The =
term=20
network-number refers to a number obtained from the Internet =
Network<BR>#=20
Information Center. Currently this number is restricted to being a =
class<BR># A,=20
B, or C network number. In the future we should be able to support<BR>#=20
arbitrary network numbers per the Classless Internet Domain Routing<BR># =

guidelines.<BR>#<BR># Both the network-number and the netmasks are =
specified=20
in<BR># "decimal dot" notation, e.g:<BR>#<BR># 128.32.0.0=20
255.255.255.0<BR>#<BR>207.229.165.133 255.255.255.0<BR>172.16.1.0=20
&nbsp;&nbsp;&nbsp;&nbsp; 255.255.255.0<BR>192.168.1.0 &nbsp;&nbsp;&nbsp; =

255.255.255.240<BR>
<P></FONT></FONT>This file defines the network 207.229.165.0 as a =
standard class=20
C network. However, the file also defines 172.16.1.0 as a class C =
network, even=20
though it is normally a class B network. Last, we see the network =
192.168.1.0=20
broken down even smaller as a 16 IP subnet. We discuss subnetting later =
in the=20
article.=20
<P><BR>&nbsp;=20
<P><FONT size=3D-1>&nbsp;</FONT><B><FONT=20
face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+2>IP=20
Forwarding</FONT></FONT></B>=20
<P>Up to this point we have been discussing singled homed system. Single =
homed=20
systems have one of two choices, talk to the local network, or to the =
default=20
router. Things get more complicated when you add a second interface. =
Your system=20
now becomes multi-homed, and potentially a gateway. A multi-homed host =
is any=20
system with two or more interfaces, usually on different networks. A =
gateway is=20
any multi-homed system that routes packets between different networks.=20
<P>Lets take a look at what happens when we add a second interface. We =
add the=20
interface elx1 to our system, with an IP address of 10.1.6.1, netmask=20
255.255.255.0.=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>Routing =
Table:</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT=20
size=3D-1>Destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
Gateway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
Flags Ref&nbsp;&nbsp; Use&nbsp;&nbsp;&nbsp; Interface</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>-------------------- =
-------------------- -----=20
----- ------ ---------</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>207.229.165.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
2&nbsp;&nbsp;&nbsp;&nbsp; 20=20
elx0</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>10.1.6.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
10.1.6.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp; =
123=20
elx1</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
UG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;=20
20</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
UH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; =
30=20
lo0</FONT></FONT>=20
<P>Looking at the routing table, you notice only one change, the =
addition of=20
interface elx1. If a packet is destined for any node on the 10.1.6.0 =
network,=20
the packet is forward out the elx1 interface.=20
<P>However, there is another, and far more important change not seen =
here, IP=20
forwarding has just been enabled on this machine. Basically, IP =
forwarding means=20
the system will route packets between networks. Based on the table =
above, the=20
gateway will forward a packet one of two ways. If it does not know the=20
destination, it will forward the packet to the default router. If the=20
destination is on one of the two local networks, then the packet will be =

forwarded to its destination.=20
<P>IP forwarding is enabled during the init process, in =
/etc/rc2.d/S69inet. If=20
the system detects more then 2 interfaces (including the loopback) ip =
forwarding=20
will be enabled by default. Your system is now a gateway.=20
<P>You can have a system with 2 or more interfaces and not forward =
packets if=20
you want. This is done one of two ways. First, by touching the file=20
/etc/notrouter. During the init process, /etc/rc2.d/S69inet will look =
for this=20
file. If it finds it, it turns off ip forwarding by executing the =
following=20
command.=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>ndd -set /dev/ip =
ip_forwarding=20
0</FONT></FONT>=20
<P>&nbsp;You can manually turn off ip forwarding any time by executing =
the same=20
command. <BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT size=3D+2>Route =

Command</FONT></FONT></B>=20
<P>The route command allows you to manually change the route table. You =
can add,=20
delete or change routes in real time. For example, lets say the IP =
address of=20
the default router has changed, but you cannot afford to reboot the =
system. You=20
have to change the IP address of the default route without rebooting. =
You do=20
this with the route command. The syntax is simple,=20
<P><FONT face=3D"Courier New,Courier"><FONT size=3D-1>lisa #route change =
default=20
207.229.165.5 1</FONT></FONT>=20
<P>This command changes the default router from 207.229.165.1 to a .5. =
The=20
syntax is simple, type the network information as you want it to appear =
in the=20
routing table. The last number at the end of the command is the metric, =
or how=20
many hops to the next gateway. Any node, including a router, on the =
local=20
network is a hop of 1. The route add command allows you to add =
additional routes=20
to the routing table, just as route delete removes them. If you want to =
make a=20
route command permanent, add the command to the bottom of =
/etc/rc.2/S69inet. The=20
init script will execute the route command and update the routing table. =

<BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT=20
size=3D+2>VLSM</FONT></FONT></B>=20
<P>Starting with 2.6, Solaris supports VLSM (Variable Length Subnet =
Mask). VLSM=20
means a network can be variably subnetted into smaller networks, each =
smaller=20
network having a different subnet mask. What that means to you is that =
life just=20
got a lot easier.=20
<P>Under Solaris 2.5.1 or earlier, you could only define a single subnet =
for a=20
network. For example, if you defined the network 10.1.6.0 with a =
255.255.255.0=20
subnet mask as we have done, older versions of Solaris would assume that =
any=20
network starting with 10 was a 255.255.255.0 subnet mask. You have now =
locked=20
yourself in. You had to manually add an individual route for any =
10.0.0.0=20
network that did not have this subnet. This could easily reach into the=20
hundreds!=20
<P>VLSM does not make this assumption, it gives you flexibility in =
setting up=20
your routing tables. You can have as many different subnets as you want =
for a=20
network. Lets take a look at an example. Our current routing table (see =
example=20
from above) is configured for two local networks and a single default =
route for=20
everything else (the Internet). However, this system is to be the =
gateway for a=20
large corporation, the company's firewall. This means all inbound and =
outbound=20
traffic must go through it.=20
<P>The corporation is made up of an internal 10.0.0.0 network, which is=20
subnetted into over 100 smaller networks. Each smaller, subnetted =
network has a=20
different subnetmask. For example=20
<P><FONT size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
10.15.146.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
255.255.254.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (510 hosts)</FONT> <BR><FONT =

size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
10.128.112.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
255.255.248.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (2046 hosts)</FONT> =
<BR><FONT=20
size=3D-1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
10.220.160.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
255.255.240.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (4094 hosts)</FONT>=20
<P>Here you see the company's various, different networks. We have to =
create a=20
routing table that routes all default traffic to the Internet, but at =
the same=20
time routes anything on the 10.0.0.0 internally. Remember, our internal =
network=20
is really over a hundred smaller 10.0.0.0 networks, all variably =
subnetted.=20
<P>First, we have to identify the internal router. In our case, we will =
use=20
10.1.6.5. This is the IP address of the router on the internal network. =
Notice=20
how this router is on the local network of interface elx1. Now, since we =
are=20
using Solaris 2.6, which support VLSM, we need only 1 command to route =
all the=20
variably subnetted 10.0.0.0 networks=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>lisa #route add net =
10.0.0.0 10.1.6.5=20
1</FONT></FONT>=20
<P>With this single command, we have taken care of all routing issues, =
something=20
possible only with VLSM. Lets take a look at the routing table and =
explain what=20
I mean.=20
<P><FONT face=3D"Courier New"><FONT size=3D-1>Routing =
Table:</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT=20
size=3D-1>Destination&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
Gateway&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
Flags Ref&nbsp;&nbsp; Use&nbsp;&nbsp;&nbsp; Interface</FONT></FONT> =
<BR><FONT=20
face=3D"Courier New"><FONT size=3D-1>-------------------- =
-------------------- -----=20
----- ------ ---------</FONT></FONT> <BR><FONT face=3D"Courier =
New"><FONT=20
size=3D-1>207.229.165.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.133&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
2&nbsp;&nbsp;&nbsp;&nbsp; 20=20
elx0</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>10.1.6.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
10.1.6.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp; =
123=20
elx1</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>10.0.0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
10.1.6.5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
U&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0</FONT></FONT> <BR><FONT=20
face=3D"Courier New"><FONT=20
size=3D-1>default&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
207.229.165.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
UG&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;=20
20</FONT></FONT> <BR><FONT face=3D"Courier New"><FONT=20
size=3D-1>127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;=20
127.0.0.1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;=20
UH&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; =
30=20
lo0</FONT></FONT>=20
<P>The first line states that if your destination is on the =
207.229.165.0=20
network, the network is local to the interface elx0. If your destination =
is on=20
the 10.1.6.0 network, the network is local to the interface elx1. If =
your=20
destination is on any 10.0.0.0 network EXCEPT to 10.1.6.0, the packet is =

forwarded to the gateway 10.1.6.5. Last, if the destination meets none =
of the=20
above criteria (the Internet), the packet is forwarded to the default =
router,=20
207.229.165.1.=20
<P>You may be confused as to how does the system know where to forward =
anything=20
on 10.1.6.0. By looking at the routing table, you see two entries that =
would=20
work, one for 10.1.6.0 and one for 10.0.0.0, both work for 10.1.6.0. The =
system=20
always selects the most specific path first.=20
<P>Now, if this was on a system that did not support VLSM, such as =
2.5.1, things=20
would be MUCH uglier. As stated earlier, the 10.0.0.0 is variably =
subnetted into=20
smaller networks. Without VLSM, you would have to manually add a static =
route=20
for each separate network with the route add command. If you do not, the =
kernel=20
will assume that all the 10.0.0.0 networks are subnetted the same, =
causing all=20
sorts of interesting routes. As you can see, VLSM is extremely powerful. =

<BR>&nbsp;=20
<P><B><FONT face=3DHelvetica,Arial><FONT =
size=3D-1>&nbsp;</FONT></FONT><FONT=20
face=3D"Helvetica-Narrow,Arial Narrow"><FONT =
size=3D+2>CIDR</FONT></FONT></B>=20
<P>I decided to discuss CIDR, as it is easy to confuse with VLSM and =
they are=20
both closely related. Defined in 1993 by rfc 1519, Classless =
Inter-Domain=20
Routing is used for routing aggregation, also known as supernetting. =
Simple=20
stated, this means lumping several networks into one. The purpose is to =
reduce=20
routing tables, which are beginning to overload backbone routers. An =
example=20
would be taking 256 class C networks and defining them as a single =
network,=20
aggregating them together. You can define the networks 207.229.0.0 =
&#8211;=20
207.229.255.0 with the single routing entry of 207.229.0.0 subnet mask =
of=20
255.255.0.0.=20
<P>CIDR aggregates several networks together for simpler routing, =
compared to=20
VLSM which variably subnets a network into smaller networks. Confused? =
Don't=20
feel bad, so is half the Internet. To learn more, I highly recommend you =
read=20
3Com's Whitepaper on IP addressing, VLSM, and CIDR at <A=20
href=3D"http://www.3com.com/nsc/501302.html">http://www.3com.com/nsc/5013=
02.html</A>=20
<BR>&nbsp; <BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT=20
size=3D+2>Conclusion</FONT></FONT></B>=20
<P>The key to successful routing is your routing tables. By defining a =
proper=20
routing table, your packets will get from point A to point B. VLSM is a =
standard=20
that allows greater flexibility and in developing a proper routing =
table.=20
Remember, a happy gateway is a happy network. <BR>&nbsp;=20
<P><B><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT=20
size=3D+2>Downloads</FONT></FONT></B>=20
<P>Figuring out subnet masks and CIDR aggregation can be quite=20
challenging.&nbsp; However, for the brain dead like me there exists an =
AWESOME=20
little tool called IP Calculator from Net3 Group Inc.&nbsp; This freely=20
distributed Windows tool is a great way to solve all your subnetting=20
problems.&nbsp; I HIGHLY recommend it.=20
<CENTER><B><A=20
href=3D"http://www.enteract.com/~lspitz/ip_calculator.zip">ip_calculator.=
zip</A>&nbsp;&nbsp;=20
603 KB</B></CENTER>
<P>For you Unix weenies, there is a Unix version of this tool, located =
at <A=20
href=3D"http://www.interloper.net/~dan/software">http://www.interloper.ne=
t/~dan/software</A>
<P><BR>
<P><B><I><FONT face=3D"Helvetica-Narrow,Arial Narrow"><FONT =
size=3D+1>Author's=20
bio</FONT></FONT></I></B> <BR><I>Lance Spitzner enjoys learning by =
blowing up=20
his Unix systems at home. Before this, he was an <A=20
href=3D"http://www.enteract.com/~lspitz/officer.html">Officer in the =
Rapid=20
Deployment Force,</A> where he blew up things of a different nature. You =
can=20
reach him at <A =
href=3D"mailto:lance@honeynet.org">lance@honeynet.org</A> .</I>=20
<BR>&nbsp; <BR>&nbsp;=20
<CENTER>
<TABLE border=3D5>
  <TBODY>
  <TR>
    <TD><I><FONT face=3DBraggadocio><FONT color=3D#800000><FONT =
size=3D+2><A=20
      href=3D"http://www.enteract.com/~lspitz/pubs.html">Whitepapers /=20
      =
Publications</A></FONT></FONT></FONT></I></TD></TR></TBODY></TABLE></CENT=
ER></BODY></HTML>

