I have a multi-homed server running bgp via quagga

If I fire up an application on this server that initiates a connection, by default it is going to choose the interface with the lowest metric, ie the address of the neighbour of the bgp router, which is unfortunate since these neighbour addresses are not even deliverable upstream.

In the event that the software initiating the connection does not have the ability to bind to a specific ip address, is it possible to make the application bind to a specific ip by another method? adjusting the metrics to prefer an interface doesn't seem viable with dynamic routing.

There is the option of running the bgp in a jail and using a vnic, if nothing else is going to work


I Will award the bounty if someone explains:.
how to do this.
Explains how to do this on Linux if it isn't possible in BSD.
Provides an authoritative reference of why this isn't possible at this time.

1 Answer 1


We usually add routes to the server that tells it the next hop is a certain ip address. It will use the card that is in the same subnet at the next hop.

You didn't say what OS but I see freebsd in your tag so I'll assume that.

You have to essentially make freebsd a router the add static routes. For more details than what's below visit freebsd.org using this link. The following info is from there.

30.2.2. Configuring a Router with Static Routes

Contributed by Al Hoang.

A FreeBSD system can be configured as the default gateway, or router, for a network if it is a dual-homed system. A dual-homed system is a host which resides on at least two different networks. Typically, each network is connected to a separate network interface, though IPaliasing can be used to bind multiple addresses, each on a different subnet, to one physical interface.

In order for the system to forward packets between interfaces, FreeBSD must be configured as a router. Internet standards and good engineering practice prevent the FreeBSD Project from enabling this feature by default, but it can be configured to start at boot by adding this line to /etc/rc.conf:

gateway_enable="YES" # Set to YES if this host will be a gateway

To enable routing now, set the sysctl(8) variablenet.inet.ip.forwarding to 1. To stop routing, reset this variable to 0.

The routing table of a router needs additional routes so it knows how to reach other networks. Routes can be either added manually using static routes or routes can be automatically learned using a routing protocol. Static routes are appropriate for small networks.

For config examples and more details please visit this link at freebsd.org

  • this is true, but the question pertains to the case where the source of ip traffic can't be the same as the card with the next hop
    – camelccc
    Sep 5, 2017 at 3:44

You must log in to answer this question.

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