Your app servers need to reach the internet for updates but must not be reachable from it. How do you set it up on a Linux gateway?
IntermediateScenarioNetworking, SSH and remote access
Answer
Situation read → A NAT gateway with forwarding and masquerade.
What I'd do →
echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/90-forward.conf && sudo sysctl --system
sudo nft add table ip nat
sudo nft add chain ip nat postrouting '{ type nat hook postrouting priority 100; }'
sudo nft add rule ip nat postrouting oifname "eth0" ip saddr 10.0.2.0/24 masquerade
Add forward rules that allow 10.0.2.0/24 -> eth0 and only established/related traffic back. Save with nft list ruleset > /etc/nftables.conf.
Why → Outbound connections are translated; unsolicited inbound has no NAT mapping and is dropped.
Interview tip → In AWS, say you'd use a managed NAT Gateway rather than run this yourself.
More on Networking, SSH and remote access
A key belonging to a departed engineer may be in `authorized_keys` on 300 servers. How do you rotate SSH keys across the fleet?IntermediateYou need to reach a database on a private subnet from your laptop through a bastion. How?BeginnerYour security team wants SSH hardened on all servers. What changes do you make?BeginnerA new server needs a static IP, gateway and DNS on RHEL 9. How do you configure it persistently?BeginnerYou're changing the network config of a remote server over SSH and could lose access. How do you protect yourself?IntermediateA web server should accept HTTP/HTTPS from anywhere but SSH only from the office. Configure the firewall.Beginner