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? -- Les Mikesell lesmiksell at gmail.com
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 -- INTERNET: bill at celestial.com Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax: (206) 232-9186 There are three kinds of men. The ones that learn by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves. -- Will Rogers
> 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
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 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