I'd like to consolidate some services that have been assigned by IP (dns, syslog etc.) onto one machine by giving it IP aliases to accept connections for the old addresses until all the references are fixed. However, I'd like to have it use it's original IP as the source for outbound connections. Where do you control that?
On Tue, Jun 17, 2008, Les Mikesell wrote:
I'd like to consolidate some services that have been assigned by IP (dns, syslog etc.) onto one machine by giving it IP aliases to accept connections for the old addresses until all the references are fixed. However, I'd like to have it use it's original IP as the source for outbound connections. Where do you control that?
That depends on the application. You can specify the outgoing IP address for postfix with ``smtp_bind_address'' in main.cf. The inn NNTP server uses ``sourceaddress'' in the inn.conf file, etc.
Bill
I'd like to consolidate some services that have been assigned by IP (dns, syslog etc.) onto one machine by giving it IP aliases to accept connections for the old addresses until all the references are fixed. However, I'd like to have it use it's original IP as the source for outbound connections. Where do you control that?
There may be settings in each application that control that, but in case there are not .. you should be able to do something like :
iptables -t nat -A POSTROUTING -p tcp --sport 334 -j SNAT --to 2.3.4.5
Barry
Barry Brimer wrote:
I'd like to consolidate some services that have been assigned by IP (dns, syslog etc.) onto one machine by giving it IP aliases to accept connections for the old addresses until all the references are fixed. However, I'd like to have it use it's original IP as the source for outbound connections. Where do you control that?
There may be settings in each application that control that, but in case there are not .. you should be able to do something like :
iptables -t nat -A POSTROUTING -p tcp --sport 334 -j SNAT --to 2.3.4.5
Is there no way to control the default source address?
On Wed, 18 Jun 2008, Les Mikesell wrote:
Barry Brimer wrote:
I'd like to consolidate some services that have been assigned by IP (dns, syslog etc.) onto one machine by giving it IP aliases to accept connections for the old addresses until all the references are fixed. However, I'd like to have it use it's original IP as the source for outbound connections. Where do you control that?
There may be settings in each application that control that, but in case there are not .. you should be able to do something like :
iptables -t nat -A POSTROUTING -p tcp --sport 334 -j SNAT --to 2.3.4.5
Is there no way to control the default source address?
In some applications you can .. but it is application dependent. what applications are you looking to do this with?
Barry
Don't take this as a definitive answer, but I have multi-aliased CentOS boxen.
I find that outgoing connections always come from the main IP address, not the aliases. In particular these boxen are web servers hosting multiple sites, hence the multi-IP and connections to the database all appear to be from the main IP.
Applications can be attached to individual IPs, but I think the default routing is to use the main IP of the interface.
On Tue, Jun 17, 2008 at 6:51 PM, Les Mikesell lesmikesell@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