Re: Changing default gateway from the command line (fc3)



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


.



Relevant Pages

  • Re: RRAS - Works on internal network, not past DMZ
    ... > VPN Users would connect directly to the Public interface of the RRAS box. ... The Firewall would need some additional configuration if you ... On the network connections configuration of the RRAS box, ... but the 'multiple gateway' error message has me spooked. ...
    (microsoft.public.windows.server.networking)
  • Re: Dual NICs on Server 2003 issue
    ... The OUTSIDE Nic is the Internet. ... connects via another gateway to a remote site that is on a 10.0.1.x subnet. ... 192.168.87.x network INTERNAL then via the 192.168.87.1 gateway to the ... > stand alone server in an existing AD domain we have 2 NICS installed. ...
    (microsoft.public.windows.server.networking)
  • RE: Client not acquiring IP address from ICS server
    ... specifically say the gateway puter must have an ip set to 192.168.0.1. ... Have you used any registry network ... Either way ics shouldn't stop it getting online. ... other computers shares its probably the firewall. ...
    (microsoft.public.windowsxp.network_web)
  • Re: firewall ??
    ... > network to access the net while providing a secure environment. ... > already assigned a default gateway on my network. ... > apply a firewall with Internet connection sharing that acts as a new ... > that connection without using NAT? ...
    (Fedora)
  • Re: 2003 DC Multihomed - 1 Nic wont answer - help!!
    ... No no nat, internally on the lan there is no problem, with the gateway ... gateway is pointed at my internal network gateway through the appliance then ... Are both NICs on the same subnet connected to the same physical network? ... Have you installed NAT on this server? ...
    (microsoft.public.windows.server.networking)