On Mon, 22 Apr 2002, ben_donohue wrote:
> Is the route table stored in a file somewhere? If so where? If not how
> does Linux remember static routes you have added between reboots? Hope
> this makes sense.
The forwarding table isn't a file, but is stored in the memory of the
running kernel. You can use the command "route -n" to display the
forwarding table, and variations on the "route" command to manually modify
it.
The forwarding table is empty on boot. It can be populated in a number of
ways, in order of preference
1) Using DHCP or PPP when you connect to the Internet.
DHCP is commonly used on enterprise networks, PPP is commonly used
on ISP dial-in networks. Both may contain the address of the
router to use for the default network, this gets inserted into
the forwarding table as
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.1.1.1 0.0.0.0 UG 0 0 0 eth0
2) By running a routing process, such as Zebra.
If the view of the network is more complex than a single path out to
the Internet or enterprise backbone, then running a routing process
will discover this complex topology and configure the kernel's
forwarding table. If you don't know what this means, then
you don't need to do it.
3) By manual configuration
For some reason I don't understand, some sites don't run DHCP
but prefer to force their users to understand networking in
order to use the network. A good thing car engineers don't
have the same philospohy.
If you are unfortunte enough to have this sort of system
administrator then you need to configure the default route
into the operating system, which writes it to the kernel
forwarding table when the networking is started.
For Red Hat Linux there's far too many graphical tools to do
this, but underneath they all modify /etc/sysconfig/network
setting the lines
NETWORKING="yes"
GATEWAY="10.1.1.1"
GATEWAYDEV="eth0"
for the values in our example "route -n" above. Rather than
rebooting, you can make this take effect with the command
/etc/init.d/network restart
If you need a static route that is not the default route,
and you shouldn't, then those routes are added to the file
/etc/sysconfig/static-routes.
4) By manual configuration each time
Using the route command, in our example
route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.1.1.1 dev eth0
which can be simplified to
route add default gw 10.1.1.1
Hope this helps,
Glen
PS: Pedantic network engineers like myself make a distinction
between a 'forwarding table' and a 'routing table'. The
forwarding table is used by the receiving interface to
decide where to send the packet. There can only be one
forwarding table for each interface. The kernel stores
the forwarding table.
The 'routing table' contains topology information about
the network. The best route in the routing table is
usually installed into the forwarding table. The routing
table usually has information not immediately
useful for forwarding, such as routes that were not the
'best' (they might come in handy as fall-back routes).
There can be many routing tables -- this is common in
networks that run multiple routing protocols (such as
RIP and OSPF). The routing tables are maintained by
a user space daemon, traditionally called a 'route
daemon' (UNIX) or 'routing process' (Cisco).
BGP (the routing protocol used in the internet backbone)
carries things to an extreme -- its routing table is called
a 'routing information base' to reflect the huge amount of
non-forwarding information.
You don't need a routing table for systems where the forwarding
table can only have one possible configuration. This is the
case for end-systems. On those the forwarding table is usually
configured by DHCP, PPP or manually; rather than from a route
daemon.
-- Glen Turner Network Engineer
(08) 8303 3936 Australian Academic and Research Network
[EMAIL PROTECTED] http://www.aarnet.edu.au/
--
The revolution will not be televised, it will be digitised
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug