Both NICs are using DHCP. Via DHCP assignments, the default route assigned is from my LAN DHCP server. My ISP also assigns a gateway, but it doesn’t stick and I have to manually reconfigure routing after each boot. This machine is my internet firewall so I need the gateway to use my ISP’s setting.
Is there a way to get the gateway from my ISP to take precendence? I don’t want to configure it statically via the Default Gateway option as my ISP sometimes changes their setup which could make a static configuration invalid.
Yeah, I thought of writing a script right after I posted. I wrote one that works a treat, but apparently after.local isn’t the right place for it as it doesn’t kick in after booting. Guess I’ll have to do some digging re: where it should go. In the meantime, here’s the script:
Oh, and the reason I didn’t think of a script earlier is because I have a SLES 9 machine with the same NIC config, and the gateway from its eth1 is the one that sticks. I just can’t figure out how I got that to work.
/etc/init.d/after.local works if I change runlevels, which is what the rc file indicates should happen. It does not seem to execute as part of the boot process however, which is where I need it.
Well, this turns out to be a matter of patience. The script is running after all – I was testing for it too soon after bootup. If I logged in immediately after booting and then ran the route command, the eth0 gateway was listed, so I presumed the script wasn’t running. In reality, it had not run yet, and if I waited another 15 seconds or so, the script would run and the route would change.
So, thanks for your help and sorry I took us down the wrong path!
If I ever figure out how I got this working on SLES 9 without the script workaound, I’ll post back…