If I want to add a route (static route) to force outgoing packets
that
are destined for a particular host to use that interface (eth3 on this
host)
then how do I do that? System is RedHat Enterprise Linux 3AS.
I suspect this involved the "add route default" command or whatever
the syntax is -- I did it for Solaris years ago but don't remember
exactly how.
$ Linux host1.localdomain 2.4.21-57.ELhugemem #1 SMP Fri Jun 13
00:09:04 EDT 2008 i686 i686 i386 GNU/Linux
$ ifconfig eth3
eth3 Link encap:Ethernet HWaddr 00:0A:5E:7A:E7:33
inet addr:10.156.30.176 Bcast:10.156.30.255 Mask:
255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:619971 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:44019924 (41.9 Mb) TX bytes:256 (256.0 b)
Interrupt:24
Thanks in advance.
man route
there are some examples in there too..... ;-)
--
Luuk
Not sure exactly. This is what I do for lo:
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 dev lo
Hope this helps,
Sid
You'll probably want to make the route permanent across reboots and
interface bounces. RH changed their convention for route config files,
but I believe the following convention applies to RHEL3. (It's been a
while.)
Create the file /etc/sysconfig/network-scripts/route-eth3
The contents should be
ADDRESS0=<whatever-host-address>
NETMASK0=255.255.255.255
GATEWAY0=<gateway-if-remote-or-eth3-addr-if-local>
If you want other routes, then the next set would use 1 instead of 0,
etc., for as many as you need. You must start at 0. You must not skip
any numbers. You can specify whole networks, but you asked about just
one host, so the example mask is all 1s.
Then "ifdown eth3 ; ifup eth3" will handle running "route" (or "ip
route," I forget when that changed, too) for you, plus the config is
applied automatically on reboot.
to verify the route give command "route"
To make a static route using one of the interface (in our case gigabit
interface), first we need to delete the present route and add the new
route.Commands are follows,
# route -n (this will show the present routing gateway)
# route del default (this will delete the present route)
# route add default gw ipaddressofthegigabit
# route -n (Shows the route is configured to gigabit)
Now all the traffic will route through the gigabit card.
Cheers!
Melbin Mathew
www.talk2melbin.com