Re:You only live once, self host a NAT Gateway
by unquietwiki on Friday November 21, 2025 @07:09PM
(#46010645)
Assigning an IP is ideal if you're having to whitelist traffic to/from a data center, application, or service.
Re:You only live once, self host a NAT Gateway
by nodesocket on Friday November 21, 2025 @07:22PM
(#46010754)
Sure that one’s case, though you might be able to give out a host instead of IP to others to whitelist. Then you just set a low TTL and update the DNS record.
Re:You only live once, self host a NAT Gateway
by Nextgrid on Friday November 21, 2025 @07:41PM
(#46010879)
OpenWrt is also a good option.
Re:You only live once, self host a NAT Gateway
by topspin on Friday November 21, 2025 @09:05PM
(#46011395)
"NAT instances"
That's what you did before AWS had the "NAT Gateway" managed service. It's literally called "NAT Instance" in current AWS documentation, and you can implement it in any way you wish. Of course, you don't have to limit yourself to iptables/nftables etc. OPNsense is a great way to do a NAT instance.
Re:You only live once, self host a NAT Gateway
by nodesocket on Friday November 21, 2025 @09:10PM
(#46011418)
I believe the NAT instances also use super old and end-of-life Amazon Linux. I prefer Debian Trixie with Packer and EC2 instances and no EIP. Most secure, performant, and cost effective setup possible.
> NAT AMI is built on the last version of the Amazon Linux AMI, 2018.03, which reached the end of standard support on December 31, 2020 and end of maintenance support on December 31, 2023.
Re:You only live once, self host a NAT Gateway
by sarathyweb on Saturday November 22, 2025 @02:17AM
(#46012823)
We can follow the documentation for setting up the NAT instance on any distro. I tested with Rocky Linux 9 and it worked.
Re:You only live once, self host a NAT Gateway
by vladvasiliu on Saturday November 22, 2025 @01:42AM
(#46012675)
> Also, don’t assign a EIP to your EC2 NAT instances (unless you absolutely must persist a given public IP) as that counterintuitively routes through public traffic. Just use a auto-assigned public IP (no EIP).
Could you point me to somewhere I can read more about this? I didn't know there was an extra charge for using an EIP (other than for the EIP itself).
The bash configuration is literally a few lines:
Change ens5 with your instance network interface name. Also, VERY IMPORTANT you must set source_dest_check = false on the EC2 NAT instances.Also, don’t assign a EIP to your EC2 NAT instances (unless you absolutely must persist a given public IP) as that counterintuitively routes through public traffic. Just use a auto-assigned public IP (no EIP).