help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem getting the right IP (NAT & Linux vservers)


From: Henrik Christian Grove
Subject: Problem getting the right IP (NAT & Linux vservers)
Date: Fri, 26 Nov 2004 14:22:23 +0100
User-agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux))

Hi

I'm trying to put the configuration of some of our servers under
cfengine's control. 

We have a /24 range of public IP-addresses and do 1-to-1 NAT to 10.0.0/24.
For some of the machines I need their internal IP (i.e. 10.0.0.x), but DNS
for their hostname gives the external IP.

Okay, so I can use ${global.ipv4[eth0]} to get the IP of eth0. The problem
with that is that some of the machines are physical machines where the
used interface is eth0, but some of them are Linux vservers where the used
interface is eth0:<hostname> (they do have an eth0 interface, it just
doesn't have an IP). 

How do I solve that?

I can imagine three ways of doing it:
1. Doing some regexp substitution on public IP, transforming it to the
   internal.
2. Querying interfaces until an IP is found (try eth0, then
   eth0:<hostname>).
3. Querying the first existing interface from a list
   (place eyth0:hostname before eth0).

Unfortunately I can't figure out how to do either.

.Henrik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]