Two NICs/controlling default route

Hi,

I have two network interfaces in my opensuse 11.3 system and want to control the interface which is used as default route. Somehow, it always picks the first card no matter what.

In particular, I have tried setting DHCLIENT_PRIMARY_DEVICE to ‘yes’ resp. ‘no’ in both ifcfg-* files in /etc/sysconfig/network. Also, I have tried DHCLIENT_SET_DEFAULT_ROUTE but that also appears to be ignored.

I remember having used this in the past with previous opensuse versions but it no longer seems to work. What is the correct way for doing this?

Cheers
Erik

Why not use Yast, either from the desktop or from the console?
Yast - Network - Network Settings should bring you there. The options you need should all be there.

BTW: For the Joost Prinsens in this world, we also have dutch subforums …:smiley:

I have experimented with dhcpd options and looked at what /etc/init.d/network did. From that output it looks like it is invoking dhcpd correctly, passing a -G option to avoid setting of the default route.

What /etc/init.d/network does is start dhcpcd as follows:

/sbin/dhcpcd --netconfig -L -E -HHH -G -c /etc/sysconfig/network/scripts/dhcpcd-hook -t 0 -h penguin eth1

However, the --netconfig option is also passed to dhcpcd and this one results in setting a default route. The man page for dhcpcd says that --netconfig forces the -N -Y -R options and sets the -c option to /etc/sysconfig/network/scripts/dhcpcd-hook. However, it is not equivalent to that as passing the individual options to dhcpcd instead of --netconfig results in the default route not being set (as expected). With --netconfig it does set the default route.

Use the advance settings in the file “/etc/sysconfig/network/routes” for manage routing.

You can manually use the route command of course:

route add default gw eth1

for example.

or


ip route replace default via dev eth0

but it doesn’t persist when you reboot.