I have a system with two NICs on it. This machine, and a few accompanying devices will be moved and attached to different LANs or sometimes it'll be using dial-up.
eth0: - 10.x.x.x address space - no internet gateway - only a few devices eth1 (when used): - 172.16.x.x or 192.168.x.x or other address spaces - access to the gateway from LAN to internet ppp0 (when used): - internet access through dialup using KPPP
I'm using ifconfig to bring interfaces up or down (other than with ppp0, which is handled by KPPP).
If I bring up eth1 first, it gets an address from its DHCP and gets the gateway and that is added to routing so there's no trouble reaching the LAN and the internet.
If I bring up eth0 first or second, it gets its address and sets the default gateway to within its address space (in the 10.x.x.x range). If I bring up eth0 first and eth1 second, the default gateway is still kept to within the 10.x.x.x range.
So no matter what I do, eth0 will override eth1 and "claim" the gateway in the routing.
Is there some way to either prevent eth0 from claiming the gateway, or to make sure eth1 (if brought up 2nd) uses its gateway? Or can I somehow prioritize a ranking of which interface's gateway should be used over the others?
I basically want to make sure eth1's default address space gateway is used if it's active, and if not, then the ppp0's default gateway is used. I'd like to be able to prevent eth0 from ever having the default gateway.