Subject: Re: How to set outbound address?
To: John F. Woods <email@example.com>
From: Francis Dupont <Francis.Dupont@inria.fr>
Date: 10/03/1995 19:19:18
In your previous mail you wrote:
Currently, when I make TCP connections to the outside world, the source
address is that of my PPP interface, which has an address belonging to
my ISP, as well as something of a funny name (funhouse-gw.ultra.net).
Is there a really obvious way to cause outgoing connections to have a
source that is an address in my own class C space?
=> I know (and use) two methods:
- first explicitely bind (with the bind system call) the source
address. Unfortunately almost all the applications leave the
source address unbound.
- or understand how the source address is selected: the route to
the destination is used, this route gives an interface (in your
case the PPP interface) and an address of this interface.
If the interface is not the loopback then this address is used
as the source address for unbound sockets.
Then you have to set the interface address of the default route,
using ifconfig for adding secondary addresses to the default
interface and route with -ifa option. Another way is to leave
the PPP interface unumbered if your ISP supports this.
(PS: there are some nasty bugs in the current routing code
ie the route command can panic easily).