Skip to content

Instantly share code, notes, and snippets.

@luoqeng
Forked from lynus/wan_ssh
Created April 9, 2018 03:35
Show Gist options
  • Save luoqeng/9379d53658eddd8e20390f03236f7312 to your computer and use it in GitHub Desktop.
Save luoqeng/9379d53658eddd8e20390f03236f7312 to your computer and use it in GitHub Desktop.
openwrt:allow wan ssh into your wrt
by default,openwrt do not allow ssh access from wan, here are two method to change that:
1.login into your wrt from a lan host.issue the following command:
iptables -F
the command "flush away" all the firewall rules,including the one that rejects ssh request from wan.
now you can try ssh from anywhere.
aware that the firewall deactivation leads to highly security risk.and after the wrt restarts ,all default firewall configuration comes back.you hava to "flush" the rules once again.
2.add the following lines in /etc/config/firewall :
config rule
option src wan
option dest_port 22
option target ACCEPT
option proto tcp
after restart ('reboot' commmand),wrt accept port 22 request (in this case ,ssh request)from wan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment