[Nix-dev] Fwd: NixOps: How do I bind services to internal IP addresses on GCE?

roconnor at theorem.ca roconnor at theorem.ca
Wed Jun 24 18:27:39 CEST 2015


On Wed, 24 Jun 2015, Rob Vermaas wrote:

> Hi,
>
>> My question is, is there some way to access the internal IP address of a
>> deployed machine so I can add it to my cassandra.yaml file during
>> deployment?  Alternatively is there some way to have the /etc/hosts
>> resolve the machines name, "db", to the internal IP address instead of the
>> external IP address?  Or is there some other solution to this problem I am
>> having?
>
>
> NixOps provides two options that will allow accessing public and
> private IP addresses. In your case you can use networking.privateIPv4.
>
>> From the manual:
>
> ===========
>
> networking.privateIPv4
>
> IPv4 address of this machine within in the logical network. This
> address can be used by other machines in the logical network to reach
> this machine. However, it need not be visible to the outside (i.e.,
> publicly routable).
>
> Example: "10.1.2.3"
>
> Declared by:
>
> <nixops/options.nix>
>
>
> networking.publicIPv4
>
> Publicly routable IPv4 address of this machine.
>
> Example: "198.51.100.123"
>
> Declared by:
>
> <nixops/options.nix>

That seems like the way to go.  Unfortunately when I try to use 
config.networking.privateIPv4 I get the rror

error: The option `networking.privateIPv4' is used but not defined.

To double check that I've got my expression correct, I tried 
config.networking.publicIPv4, and that expression succeeds (though isn't 
the value I want).

On the off chance I'm supposed to manage my private IP addresses myself, I 
tried setting networking.privateIPv4 address myself, but setting that 
parameter doesn't influence the private IP address that is assigned. 
Anyhow, I think NixOps is supposed to be setting the 
config.networking.privateIPv4 value.

I've tried NixOps 1.3pre1484_a932a9e and NixOps 1.3pre1486_7489764.

-- 
Russell O'Connor                                      <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''


More information about the nix-dev mailing list