Okay, I'm going to actually read this and answer correctly =)
On 2005-04-28, Graham Murray <(E-Mail Removed)> wrote:
> [snipped]
>
> I have no problems with routing incoming packets to the correct
> system, nor with setting the correct outgoing IP address (using
> iptables 'nat' table) for connections originating from other systems
> on the LAN.
>
Bad Idea(tm), I would highly recommend *against* doing this as you are
pointlessly using connection tracking for a task there is no need to, as in
my other 'quick' post use the 'source based' routing method described there.
> However I have been unable to force outgoing connections from the
> Linux system to use the IP address which I want. For most things this
> does not matter but I have the requirement to set up a VPN, which
> requires fixed endpoint addresses, from this system. I have tried
> setting the source address in the 'ip route' command, but this has no
> effect. I tried setting SNAT in the iptables 'nat' OUTPUT table, but
> SNAT is not valid in that table.
>
> [1] I know that this is not the best setup, but the ISP supplied the
> ADSL router and we do not have access to change its configuration.
>
I think you have to compile an option into the kernel firstly to support
this, OUTPUT chain 'nat' table action. However really in all the programs I
see this being done in/with its handled on the application layer, not the
kernel layer. Squid for example does just this, you tell it which IP address
to source its packets from (when its initiating connections). You probably
actually want to look to 'binding' your program to a particular IP, this is
obviously is assuming if it does not have to speak to multiple subnets
directly.
The routing system in the kernel has no idea of anything other than layer 3
(IP) traffic, TCP/UDP occurs on layer 4; I never can remember the OSI table
properly

I think you are looking to bind your services to particular IP's
on the local interfaces rather than the usual '0.0.0.0', aka all IP's which
means it picks the IP linked to the default gateway by default.
Have fun
Alex