I build a simple web on local pc,want to expose my local port with ssh remote forwording via my vps.
Setting in my vps.
vim /etc/ssh/sshd_config
GatewayPorts yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
systemctl restart sshd
Open port 8001 on my vps.
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Build a ssh remote port forwording on my local pc.
ssh -fNR 0.0.0.0:8001:localhost:80 root@vps_ip
Check port 8001 on my vps.
netstat -plant | grep 8001
tcp 0 0 127.0.0.1:8001 0.0.0.0:* LISTEN 797/sshd: root
tcp6 0 0 ::1:8001 :::* LISTEN 797/sshd: root
It is ready to listen on 8001.
To ping the vps_ip from other pc(not the previous local pc),shows that connection between pc is in good status.
Input http://vps_ip:8001
in other pc.
The connection was reset
The connection to the server was reset while the page was loading.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
Why can’t expose my local port publicly with ssh remote forwording via vps?
Go to Source
Author: it_is_a_literature