# Reply with service IPs on interface where client asks

**URL:** <https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481>\
**Category:** Configuration\
**Created:** [July 13, 2015, 12:16pm UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481 "2015-07-13T12:16:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Firm](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Firm](https://discuss.aerospike.com/u/Firm)\
**Post date:** [July 13, 2015, 12:16pm UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/1 "2015-07-13T12:16:46Z")

</div>

Hi,

I set up internal network for intra-cluster communication and expects if client asks cluster nodes via internal IP address then service-addresses to be returned have to be also internal. But when client asks via public IP then external IPs have to be returned.

``

```
network {
service {
address any
port 3000
access-address public_ip
reuse-address
}
fabric {
address private_ip
port 3001
}
heartbeat {
mode multicast
address 239.X.X.X
port 9091
interface-address private_ip
interval 500
timeout 30
}
info {
address any
port 3003
}
}

```

Regards, Alex

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [July 13, 2015, 10:55pm UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/3 "2015-07-13T22:55:13Z")

</div>

The **access-address** parameter determines what a given host will advertise to the client applications. There isn’t any configuration option available for what you are requesting.

---

<div class="post-metadata">

**Author:** ![Firm](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Firm](https://discuss.aerospike.com/u/Firm)\
**Post date:** [July 14, 2015, 6:05am UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/4 "2015-07-14T06:05:01Z")

</div>

Hi kporter,

Well, I had thought so too. But … Right now client applications came to decision to use private\_ip to connect to servers. Although, public\_ip is specified in access-address on all AE servers. I’m confused how it works.

Regards, Alex

---

<div class="post-metadata">

**Author:** ![Firm](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Firm](https://discuss.aerospike.com/u/Firm)\
**Post date:** [July 14, 2015, 11:37am UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/5 "2015-07-14T11:37:39Z")

</div>

Hi kporter,

Here’s the dump of the answer from from cluster with configuration listed above:

```
root@ae1:~# java -jar ae-nodes-list-0.1.jar ae-internal.domain.com 3000
14:32:01.000 [main] INFO r.m.enrichment.tools.ae.nodes.Main -

local:
private_ip_1
public_ip_1
127.0.0.1

14:32:01.011 [main] INFO r.m.enrichment.tools.ae.nodes.Main - connecting to ae-internal.domain.com:3000...
14:32:01.080 [main] INFO r.m.enrichment.tools.ae.nodes.Main - connected
14:32:01.080 [main] INFO r.m.enrichment.tools.ae.nodes.Main - nodes=3
14:32:01.080 [main] INFO r.m.enrichment.tools.ae.nodes.Main -

node 0:
node.name=BB9B498XXXXXXXX
node.host=private_ip_1:3000
node.address=/private_ip_1:3000
node.aliases=[private_ip_1:3000, public_ip_1:3000]

14:32:01.080 [main] INFO r.m.enrichment.tools.ae.nodes.Main -

node 1:
node.name=BB95AE2XXXXXXXX
node.host=private_ip_3:3000
node.address=/private_ip_3:3000
node.aliases=[private_ip_3:3000, public_ip_3:3000]

14:32:01.081 [main] INFO r.m.enrichment.tools.ae.nodes.Main -

node 2:
node.name=BB91CA8XXXXXXXX
node.host=private_ip_2:3000
node.address=/private_ip_2:3000
node.aliases=[private_ip_2:3000, public_ip_2:3000]

14:32:01.081 [main] INFO r.m.enrichment.tools.ae.nodes.Main - --- done ---

```

Regards, Alex

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [July 14, 2015, 9:36pm UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/6 "2015-07-14T21:36:48Z")

</div>

Looks like there’s an internal to external IP mapping defined in the client policy: [http://www.aerospike.com/apidocs/java/com/aerospike/client/policy/ClientPolicy.html#ipMap](http://www.aerospike.com/apidocs/java/com/aerospike/client/policy/ClientPolicy.html#ipMap)

---

<div class="post-metadata">

**Author:** ![Firm](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Firm](https://discuss.aerospike.com/u/Firm)\
**Post date:** [July 15, 2015, 5:53am UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/7 "2015-07-15T05:53:30Z")

</div>

Hi kporter,

No policy at all (at least no traces in client’s config). I have 2 A records in DNS: one has all 3 public IPs, second - all 3 private IPs. When client is pointed to public A record - query returns only public IPs. When pointed to private A record - Aerospike servers return what I wrote above.

But what I can’t understand - how it does work. The initial question had emerged when I installed Aerospike cluster in second DC (we already had working Aerospike cluster with scheme described in this topic) and clients, pointed to internal A record began connecting to public IPs. After some time had passed they happened to connect to private IPs. Without any changes in client config.

Regards, Alex

---

<div class="post-metadata">

**Author:** ![wchu](https://avatars.discourse-cdn.com/v4/letter/w/a5b964/32.png) [@wchu](https://discuss.aerospike.com/u/wchu)\
**Post date:** [July 21, 2015, 3:27am UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/8 "2015-07-21T03:27:03Z")

</div>

Best to concentrate on the predictable method:

- Have access-address be public-ips, for all nodes in the cluster.
- Have one DNS entry also with only public ips as entries.
- If the client wants to access cluster via public ips, then nothing special needs to be done.
- If a different client wants to access the same cluster via private ips, then create on client side an ipmap, so public ip will be translated before accessing.

---

<div class="post-metadata">

**Author:** ![Firm](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@Firm](https://discuss.aerospike.com/u/Firm)\
**Post date:** [July 22, 2015, 7:09am UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/9 "2015-07-22T07:09:39Z")

</div>

Hi wchu,

I think it’s better to reply with public ips when asked on public interface. And with private ips when asked on private interface. Client might not have idea how to map public-\>private ip.

Regards, Alex

---

<div class="post-metadata">

**Author:** ![naoum](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@naoum](https://discuss.aerospike.com/u/naoum)\
**Post date:** [October 27, 2015, 7:54pm UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/10 "2015-10-27T19:54:11Z")

</div>

I was just trying to figure out the exact same thing - my cluster only uses private ip-s so when I connect to it from outside of aws using public IP how does it know which node to go to for the data?!

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [October 28, 2015, 5:27pm UTC](https://discuss.aerospike.com/t/reply-with-service-ips-on-interface-where-client-asks/1481/11 "2015-10-28T17:27:05Z")

</div>

The client is probably connecting to only the seed nodes you provided, if there were any nodes outside that list the client would probably have to choose a random node to send the request to which would then proxy to the appropriate node. You can see you proxy rate by running `asadm -e "show latency like proxy"`.
