Linux: Two primary ips on the same interface

Posted on 2009-02-16
Last Modified: 2012-06-22
Hello.  I've been trying to get lvs_nat working and I've been stuck for several days now.  I'm wondering what it means to have two primary ip addresses on the same interface.

So I understand I should get something like this from "ip addr sh eth0" (cut and pasted from on online tutorial):

eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:16:3e:45:fc:f8 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet brd scope global secondary eth0

...but I'm ending up with a scenario like this:

eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:16:3e:45:fc:f8 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet brd scope global eth0

No "secondary" word there!  This has been a tough one to google.  I haven't been getting   anywhere.  Does anyone have any explanation for this?  Heartbeat beat is putting that second ip there for me as expected, but it should say secondary according to everything I've read.  Right now I have no aliases configured in any of my ifcfg-xxxx files. (Centos)

 - Zach
Question by:BarterZach
    LVL 43

    Expert Comment

    Do You know who adds this second IP, what command it uses.
    Can You verify routing table (ip ro show).
    For the ip itself, there's no real difference between primary and secondary. But routes are configured to use primary as source for outgoing connections.

    BTW: why You bother? Is something goes wrong with such config?
    LVL 27

    Accepted Solution


    "Address flags are set by the kernel and cannot be changed administratively. Currently the following flags are defined:"...

    So you can't change it until the kernel changes the flag itself.

    Also fix this incorrect broadcast:  brd

    Author Comment

    Thanks to both of you for the info.  That link had the info I was looking for!  Yeah, I didn't even notice what I had cut and pasted had the wrong broadcast address.  That was just from on online tutorial with some bad info I guess.  I just needed an example of the output you get from "ip addr sh eth0"

    Anyway, it's tough for me to post the actual results that I'm getting since it's on a different set of machines.  I need to go back over my configuration for heartbeat (the thing that is putting the second ip there).  It looks like if it gets added as a /32 and the non-virtual normal ip is set with a /24 prefix, both ips will list as primary.

    I don't think this solves the next problem I'm having though which is some sort of arp problem where the machine with the virtual ip won't respond to arp requests.  I do a tcpdump and see the response come in, but there is no reply going out the same interface.  I'm doing lvs_nat (or at least trying) and not lvs with direct routing so there shouldn't be "the arp problem" that I keep reading about in all the lvs info I've found online.  But at least I can move forward now and not keep myself stuck wondering about the primary secondary thing.

    Author Closing Comment

    Well, I think this is my first time posting on here so we'll see how this goes.  I didn't choose to add this to the Knowledge Base since my cut and pasted info had that broadcast address error in it.  ...No need to confuse everyone.
    LVL 27

    Expert Comment

    > don't think this solves the next problem

    It will, I'm 80% sure :-)

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now