0

I have two network interfaces in a FreeBSD box, both configured with DHCP; each is assigned an IP and gateway. FreeBSD is using the wrong interface for outbound traffic. How can I override the default router (preferably only by changing /etc/rc.conf)?

1 Answer 1

0

Prioritizing network interfaces is done by assigning metrics. Interfaces with a higher metric (cost) are less desirable. On Windows and Linux, at least, metrics are also directly supported on routes, in addition to interfaces.

On FreeBSD, you can pass arbitrary options to ifconfig via a ifconfig_<ifname> variable in rc.conf:

ifconfig_em0="inet 192.0.2.129/27 metric 10"
ifconfig_em1="inet 192.0.2.129/27 metric 20"

I don’t have a VM handy to verify the exact syntax right now, but that’s basically how it works.

Official information is available on the rc.conf(5) and ifconfig(8) man pages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .