Set up WireGuard to give an engineer access to a private network.
IntermediateScenarioSecurity: Firewalls, SGs, NACLs & VPN
Answer
Situation read → WireGuard is a lightweight VPN with a very small config.
What I'd do →
- On the server install
wireguard-tools, generate keys withwg genkey | tee server.key | wg pubkey > server.pub - Write
/etc/wireguard/wg0.confwith[Interface] Address=10.8.0.1/24 ListenPort=51820 PrivateKey=...and a[Peer]withPublicKeyandAllowedIPs = 10.8.0.2/32 - Enable forwarding and NAT for the private network
- Start with
wg-quick up wg0and checkwg show - Open UDP 51820 in the security group
Why → AllowedIPs doubles as routing table and access control for each peer.
Interview tip → Say rotating keys and removing a peer are one-line operations, which is why it's popular.
More on Security: Firewalls, SGs, NACLs & VPN
Security group versus NACL: explain the differences.BeginnerHow do you let only your office IP SSH into a server?BeginnerWhat does it mean that a security group can reference another security group?BeginnerStateful versus stateless firewalls: what is the practical difference?BeginnerWhat is a WAF and where do you place it?BeginnerWhat is the difference between a site-to-site VPN and a client VPN?Beginner