3

I have ubuntu-16.04.1-server connected to my router through Ethernet. I only want local PCs to be able to connect to it using SSH. How to do that?

also (if possible), How to disconnect this server from the Internet (completely) and only accept LAN SSH requests.

Thanks

4

Unless your router is configured to forward traffic to your server, it should be inaccessible from outside your LAN already.

However for an extra layer of security, you can configure the default firewall to only accept LAN connections by specifying an appropriate IP range, either via iptables or via ufw e.g.

sudo ufw allow from 192.168.1.0/24 to any port 22
sudo ufw enable
1
  • Thank you, I tried to connect to my server from my friend's house and couldn't get access. – Linuxing Sep 19 '16 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.