Also note that updating your routing table manually via a boot script will only work temporarily - When the DHCP client renews its IP address - which typically happens every 1-24 hours, depending on your server's configuration - it will override the default gateway again. Your best bet is to either modify your dhclient as described below, or go static-either with a dhcp reservation or manually entered IP address.
Tim Fournet wrote: > If your goal is to have your DHCP client not use the default gateway > that the DHCP server gives you, you can override this by creating an > /etc/dhclient.conf file and place a line in that file that reads > something like: > > supersede routers "my.default.route.ip" ; > > You can "man dhclient.conf" for more info and a full sample to start > from. Another option would be to give your host a static reservation in > the DHCP server, and have that reservation not give out a default route. > > -Tim > > > > Dustin Puryear wrote: > >> Since your internal interface is doing DHCP, you can't do this without >> making a choice: >> >> 1. Don't do DHCP on your internal face, define static IPs for both >> internal and external, and only define your gateway for your external >> (via netconfig or by hand-editing >> /etc/sysconfig/networks-scripts/ifcfg-eth[0,1]. >> >> 2. Update your /etc/rc.d/rc.local script to adjust your routing table as >> necessary. >> >> The issue here is that you are using DHCP, nothing else. It's going to >> setup your default route. You need to address that one way or the other. >> >> Oh, and David's example doesn't appear to be RHEL to me. I've never seen >> an /etc/init.d/myroute on Red Hat or Red Hat-like systems. I could be >> wrong about this though. Update us. >> >> -- >> Puryear Information Technology, LLC >> Baton Rouge, LA * 225-706-8414 >> http://www.puryear-it.com >> >> Author: >> "Best Practices for Managing Linux and UNIX Servers" >> "Spam Fighting and Email Security in the 21st Century" >> >> Download your free copies: >> http://www.puryear-it.com/publications.htm >> >> Petri Laihonen wrote: >> >> >>> Distro I'm using is RHEL4.x >>> >>> Petri >>> >>> >>> willhill wrote: >>> >>> >>>> The easy solution is to swap the wires. Other solutions depend on what >>>> distribution you are using. >>>> >>>> On Sunday 29 April 2007 1:09 pm, Petri Laihonen wrote: >>>> >>>> >>>> >>>>> How would I save default gateway setting? >>>>> >>>>> I have 2 network interfaces eth0 and eth1 respectfully. >>>>> >>>>> eth0 is the outside network connection with static IP >>>>> eth1 is the internal connection getting IP from DHCP (and apparently >>>>> route as well) >>>>> >>>>> For some reason the default gateway is been set to the eth1 using the >>>>> route out from internal network. This prevent me from connecting to the >>>>> server using outside network connection. (None of the services respond >>>>> to connection attempts, except from internal network) ... >>>>> >>>>> >>>>> >>>> _______________________________________________ >>>> General mailing list >>>> General at brlug.net >>>> http://mail.brlug.net/mailman/listinfo/general_brlug.net >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> General mailing list >>> General at brlug.net >>> http://mail.brlug.net/mailman/listinfo/general_brlug.net >>> >>> >> _______________________________________________ >> General mailing list >> General at brlug.net >> http://mail.brlug.net/mailman/listinfo/general_brlug.net >> >> > > > _______________________________________________ > General mailing list > General at brlug.net > http://mail.brlug.net/mailman/listinfo/general_brlug.net >