# Use second public ip

**URL:** <https://forum.pritunl.com/t/use-second-public-ip/1944>\
**Category:** Pritunl VPN\
**Created:** [March 28, 2024, 2:08pm UTC](https://forum.pritunl.com/t/use-second-public-ip/1944 "2024-03-28T14:08:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fibis](https://forum.pritunl.com/user_avatar/forum.pritunl.com/fibis/32/788_2.png) [@fibis](https://forum.pritunl.com/u/fibis)\
**Post date:** [March 28, 2024, 2:08pm UTC](https://forum.pritunl.com/t/use-second-public-ip/1944/1 "2024-03-28T14:08:49Z")

</div>

Hi,

My server (Ubuntu 22.04) has two public IPs assigned. The server is configured to route all traffic though the second domain. Pritunl is using for WireGuard and OpenVPN the first IP. How can I tell Pritunl that it should use the other public IP?

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [March 28, 2024, 11:21pm UTC](https://forum.pritunl.com/t/use-second-public-ip/1944/2 "2024-03-28T23:21:30Z")

</div>

With an enterprise subscription there is a route option for the NAT interface name to modify what interface is used for the route.

---

<div class="post-metadata">

**Author:** ![esaday](https://forum.pritunl.com/user_avatar/forum.pritunl.com/esaday/32/779_2.png) [@esaday](https://forum.pritunl.com/u/esaday)\
**Post date:** [September 3, 2024, 1:53pm UTC](https://forum.pritunl.com/t/use-second-public-ip/1944/3 "2024-09-03T13:53:21Z")

</div>

Just in case someone stumbles on this: `NAT interface name` option does not work on AWS EC2. I couldn’t exactly figure out why but this is my theory:  
This is how it looks after you add a new ENI/NIC to your EC2:

```auto
[ec2-user@ip-10-255-x-x ~]$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default ip-10-255.... 0.0.0.0 UG 100 0 0 eth0
default ip-10-255.... 0.0.0.0 UG 101 0 0 eth1
ip-10-255-1-0.a 0.0.0.0 255.255.255.0 U 100 0 0 eth0
ip-10-255-1-0.a 0.0.0.0 255.255.255.0 U 101 0 0 eth1

```

Notice the Metric value for `eth1` is greater than the `eth0` value making `eth0` `primary/preffered` gateway. Hence, OpenVPN somehow figures this out, and in the server logs you can see these two lines:

```auto
us=573049 net_route_v4_best_gw query: dst 0.0.0.0
us=573122 net_route_v4_best_gw result: via 10.255.1.1 dev eth0

```

So even if you input a different value in the `NAT Interface Name` field in the Pritunl Web UI it practically has no effect.

This might be achievable with a new routing table and IP rule to when to use that specific route table; [example SO answer on how to do so](https://stackoverflow.com/a/62044554)

But I’m unsure about it since underlying OpenVPN behavior is pretty much unknown to me.

Please don’t get me wrong; I’m not trying to place blame—just noting my findings in the hope that this helps someone.
