By aknash
I installed the new droplet-agent on my CentOS 7 droplet, but attempts to connect using the Droplet Console timed out.
I reasoned it was my firewall (iptables) setup. When I disabled iptables, the Console connected, using IP address 198.211.111.194. ARIN shows that CIDR 198.211.96.0/19 belongs to Digital Ocean, so that makes sense.
How do I configure iptables to safely allow only legitimate SSH traffic for the Droplet Console?
Thanks in advance for your help!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @aknash,
Well, I’ll recommend allowing only IP addresses that are needed and only on PORTS that are meant to be used by such IPs.
To allow incoming SSH connections from a specific IP address or subnet, specify the source. For example, if you want to allow the entire 198.211.96.0/19 subnet, run these commands:
sudo iptables -A INPUT -p tcp -s 198.211.96.0/19 --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT
The second command, which allows the outgoing traffic of established SSH connections, is only necessary if the OUTPUT policy is not set to ACCEPT.
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.