FAQ
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
[email protected]

Search Discussions

  • Bill Campbell at Jun 17, 2008 at 11:03 pm

    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: [email protected] 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
  • Barry Brimer at Jun 17, 2008 at 11:53 pm

    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
  • Les Mikesell at Jun 18, 2008 at 1:04 pm

    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?

    --
    Les Mikesell
    [email protected]
  • Barry Brimer at Jun 18, 2008 at 1:17 pm

    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
  • Kevin Thorpe at Jun 18, 2008 at 1:42 pm
    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.
  • Filipe Brandenburger at Jun 19, 2008 at 4:08 am

    On Tue, Jun 17, 2008 at 6:51 PM, Les Mikesell 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcentos @
categoriescentos
postedJun 17, '08 at 10:51p
activeJun 19, '08 at 4:08a
posts7
users5
websitecentos.org
irc#centos

People

Translate

site design / logo © 2023 Grokbase