Setting a different default source address

Chris Hastie lists at oak-wood.co.uk
Thu Oct 30 02:39:48 PDT 2008


Is it possible to set a default source address on a machine?

I have an ADSL connection with a fixed IP and a further /29 routed to
it. Until recently I used an ADSL router which acquired the connection
IP, and then the first of the /29 on the internal interface.

In an effort to conserve both IPs and the number of machines I have
running I have recently changed to using an ADSL modem (Vigor Draytek
110) which essentially does no more than change the PPPoA to PPPoE. A
FreeBSD machine then handles the connection using ppp.

The machine in question has always used one of the /29 addresses, and
continues to do so (this is assigned to its DMZ facing NIC, vr0). Now,
of course, outgoing packets are using the connection address, which is
assigned to tun0.

Whilst I can override this on an application by application basis for
many things (eg postfix smtp_bind_address parameter, ping -S switch) is
there any way to override it system wide, so that the address from the
/29 is used by default?

I think I succeeded in doing something similar for an IPv6 tunnel by not
assigning an IP address to gif0 and configuring the routing as follows
in rc.conf:

ipv6_defaultrouter="-interface gif0"

But I'm not clear whether this would work with ppp, and if so, how to do it.


More information about the freebsd-questions mailing list