route - Show /Manipulate the IP Routing Table
The route command will show you the existing routing table and more importantly, if your system operates through a gateway, the default gateway can be setup using this command. Entering the basic command, route, will show the existing routing table. For example:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
This shows for this machine that a default gateway exists at IP address 192.168.1.1. The default gateway if not set can be added using the route command in the following format:
route add default gw gateway_ip
Where gateway_ip would be the IP address of the gateway/router for the subnet.
Setting up interfaces in this manner will last until next reboot. Each distribution has a file in the /etc directory where this configuration information is stored. For example, RedHat and Mandrake store this information and more somewhere in the directory /etc/sysconfig. The location that RedHat uses is the file /etc/sysconfig/network-scripts/ifcfg-eth0. The location of the file for your system could be found using the command:
grep -r IPADDR /etc/*
This search should be done with super user privileges. The file and a line in the file that the string IPADDR matches would be shown. This should contain the assigned IP address.
Finallly the file /etc/resolv.conf must have the apprpprate DNS nameserver's ip address added so that DNS lookups will occur. Add a line like this:
where DNS_IP is the actual ip address of the DNS server.
Home - Table Of Contents - Contact Us
CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com
Version 1.0 - Version Date: March 29, 2005
Adapted with permission from a work created by Tcat Houser et al.
CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.