Outbound Traffic Using IPv6 Instead of IPv4

Hi,

I’ve assigned a static IPv4 address to one of our machines and had this IP whitelisted with a third-party API.

However, we’ve discovered that outbound traffic from the application is using IPv6 instead of the assigned IPv4. We need to ensure that all outbound traffic uses the static IPv4 address, but so far haven’t found a reliable way to enforce this.

Could you advise on how we can force the application to use the assigned static IPv4 for all outbound connections?

Best regards,
Ankur

Hi… Assigning a static egress IP (as opposed to ingress) should have given you an IPv6 address as well. Could you just add that second one to the whitelist?

(It should show up in fly m egress-ip list, as I understand it.)

Problem is cant add Ipv6 to Whitelist. I think there should be a way to send outbound traffic using IPv4, Like some command to set IPv4 default to send traffic.

Hm… It might be worth looking into Linux’s /etc/gai.conf for that:

# For sites which prefer IPv4 connections change the last line to
#
#precedence ::ffff:0:0/96  100

I tried that out just now, and it did work in a simple, ad hoc trial, at least.

(There might be nuances that I’m unaware of, though…)

Thanks for providing suggestions. I tried your solution, But it is still using IPv6.

I am not sure why it is too much difficult, We should be allowed to use IPv4 over IPv6. Can you provide any more suggestions? After changing this file I restarted machine, but no luck!

Thanks for helping me.

there might be some way in your app to prefer IPv4 (in the network client, or such), otherwise I’d probably set a static route for 6pn and remove the IPv6 default route:

# ip -6 r a fdaa::/16 via $(ip -json -6 r show default | jq -r .[0].gateway)
# ip -6 r del default

you may have to adapt the above to your environment.

I will surely try this and let you know If it works or not! Thanks for helping me.

@mayailurus Thanks for your help. I think it worked and now my API is accepting IPv4. Thank you so much.

@lillian Thanks for suggestion.