Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

Linux: Two primary ips on the same interface

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 10.0.1.31/24 brd 192.168.0.255 scope global eth0
    inet 10.0.1.10/24 brd 192.168.0.255 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 10.0.1.31/24 brd 192.168.0.255 scope global eth0
    inet 10.0.1.10/24 brd 192.168.0.255 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
0
BarterZach
Asked:
BarterZach
  • 2
  • 2
1 Solution
 
ravenplCommented:
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?
0
 
NopiusCommented:
http://www.policyrouting.org/iproute2.doc.html#ss9.3

"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 192.168.0.255
0
 
BarterZachAuthor Commented:
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.
0
 
BarterZachAuthor Commented:
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.
0
 
NopiusCommented:
> don't think this solves the next problem

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

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now