Re: Changing default gateway from the command line (fc3)
- From: Mark Owen <m.owen@xxxxxxxxxx>
- Date: Wed, 10 Aug 2005 19:43:41 +0100
On Wed, 10 Aug 2005 07:28:51 +0100, David Morris wrote:
> Mark Owen once wrote in <pan.2005.08.09.21.12.57.206588@xxxxxxxxxx>...
>>I've built up a fc3 box without X, Gnome etc in order to use it as a web
>>server. The box has 2 NICs with a default gateway set up to go through
>>one to the router. While setting the system up, I want to push traffic
>>by default to a different gateway (through the second NIC) and then
>>change to the proper one once everything is complete.
>>
>>I'm not used to using the CLI for everything and have been trying to find
>>out how to change the default gateway - an interesting problem (with
>>probably a simple solution!!).
>>eth0 currently has an IP of 192.168.0.7/16 & eth1 is 194.81.36.1/27.
>>Current default gateway is 194.81.36.30. Temporary DG is to be
>>192.168.1.1.
>>So far, I've tried using 'route add default gw 192.168.1.1' in various
>>ways without much luck. I've also tried editing
>>/etc/sysconfig/network-scripts/ifcfg-eth0 and adding the line
>>'GATEWAY=192.168.1.1'. Again this didn't seem to do the job.
>
> Isn't one of the issues here that the two NICs are on different networks,
> neither of which is the network of the default gateway that's wanted?
>
> I've never done this before, but I suspect you'd have to multi-home one of
> the NICs onto the same network as the 192.168.1.1 machine. Whether then
> you'd need to add some IP forwarding or not I don't know.
>
> Certainly the command you're using to change the network is correct in
> syntax.
>
> Looking again at your post, you should be able to contact the default
> gateway through eth0 if you're correct with the netmask, i.e.
> 192.168.0.0/16. This does though, I believe, break the 192.168.x.x
> networks though - they are supposed to be class C (i.e. /24) nets, not
> class B. The correct network for a private class B is 172.?.x.x (I can't
> remember the second octet without looking up the appropriate RFC).
>
> Of course, the whole my post may be a pile of dingo's kidneys...
David,
you are quite correct. The NICs are on different networks. The one is part
of a DMZ, which then gives access to the normal default gateway
(194.81.36.30). The other one is part of a LAN inside the firewall &
allows direct access for us without going through that firewall. The
machine was being rebuilt physically away from the DMZ and I was trying to
send default traffic temporarily through the LAN & out through the
firewall in order to use Yum to get files up to date.
The IP range of the LAN (192.168.0.0/16) is OK, if a bit excessive!
Perhaps I'm being a bit optimistic about the number of machines the
College are going to let me buy :-)
I confirmed this morning that the problem was me being too used to using a
GUI to change settings. The problem was sorted in a couple of ways from
the command line:
Either
/sbin/route del default gw 194.81.36.30
then
/sbin/route add default gw 192.168.1.1
or
/sbin/ip route change default via 192.168.1.1 dev eth0
Cheers.
--
Mark
.
- References:
- Changing default gateway from the command line (fc3)
- From: Mark Owen
- Re: Changing default gateway from the command line (fc3)
- From: David Morris
- Changing default gateway from the command line (fc3)
- Prev by Date: Re: Linux-compatible wireless access cards
- Next by Date: Re: Newbie: I want B&W "colours" please
- Previous by thread: Re: Changing default gateway from the command line (fc3)
- Next by thread: Re: Changing default gateway from the command line (fc3)
- Index(es):
Relevant Pages
|
|