Thursday, June 09, 2011

Open the SSH port on the WAN side of a router running OpenWRT

By opening the SSH port on the WAN side of your router running OpenWRT, you can allow SSH login from the Internet into your router. There are two ways to accomplish this.

Method 1. Add the following settings to /etc/config/firewall
config rule
        option src              wan
        option dest_port        22
        option target           ACCEPT
        option protocol         tcp

Method 2. Add the following settings to /etc/firewall.user
iptables -t nat -A prerouting_wan -p tcp --dport 22 -j ACCEPT
iptables        -A input_wan      -p tcp --dport 22 -j ACCEPT

No comments: