[CentOS] control outgoing IP address?

Filipe Brandenburger filbranden at gmail.com
Thu Jun 19 04:08:00 UTC 2008


On Tue, Jun 17, 2008 at 6:51 PM, Les Mikesell <lesmikesell at gmail.com> wrote:
> I'd like to have it use it's original IP as the source for outbound connections.
>  Where do you control that?

I didn't try it, but you probably can control that with the "ip route"
command when you create a route to a specific network or a default
route.

Maybe try something like:

# ip route add default via [Gateway_Address] dev [Interface] src [Alias_Address]

Maybe the syntax is not 100% right, "man ip" might help you.

You can also use this IP for outgoing connections only to some
specific destinations, by using a more specific network address
instead of "default".

You will probably have to remove the default gateway configuration
from /etc/sysconfig/network and add this "ip route" command somewhere
(rc.local?).

Anyway, let us know if you got it to work!

HTH,
Filipe



More information about the CentOS mailing list