SSH Port Forwarding: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
(Created page with "==References== * [https://www.ssh.com/ssh/tunneling/example SSH Port Forwarding or Tunneling] * Enable Disable Port * Convention of Port...")
 
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Local Forwarding==
'''Python Flask'''
ssh [email protected] -L 5000:localhost:5000
http://localhost:5000/
'''RabbitMQ'''
ssh [email protected] -L 15672:10.19.83.10:15672
http://localhost:15672/
username: guest
password: guest
'''Node Red'''
ssh [email protected] -L 1880:localhost:1880
http://localhost:1880/
'''Mosquitto'''
ssh [email protected] -L 1883:localhost:1883
==Remote Forwarding==
<code>nano /etc/ssh/sshd_config</code>
GatewayPorts no|yes| clientspecified
<syntaxhighlight lang="ini" highlight="3" start="86" line>
#AllowAgentForwarding yes
AllowTcpForwarding yes
GatewayPorts clientspecified
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
</syntaxhighlight>
<syntaxhighlight lang="ini">
Match User pi   
    AllowTcpForwarding yes
    GatewayPorts yes
</syntaxhighlight>
<syntaxhighlight lang="bash">
systemctl restart sshd
service sshd restart
</syntaxhighlight>
<syntaxhighlight lang="bash">
ssh [email protected] -R 10.19.83.10:80:cdn.chorke.org:1983
ssh [email protected] -R 10.19.83.10:80:localhost:1983
ssh [email protected] -R 10.19.83.10:80:0.0.0.0:1983
ssh [email protected] -R 10.19.83.10:80::1983
ssh [email protected] -R localhost:80::1983
ssh [email protected] -R 80:1983
</syntaxhighlight>
==References==
==References==
{|
| valign="top" |
* [https://www.booleanworld.com/guide-ssh-port-forwarding-tunnelling/ A Guide to SSH Port Forwarding or Tunnelling]
* [https://www.techrepublic.com/article/how-to-use-local-and-remote-ssh-port-forwarding/ Local and Remote SSH port forwarding]
* [https://www.ssh.com/ssh/tunneling/example SSH Port Forwarding or Tunneling]
* [https://www.ssh.com/ssh/tunneling/example SSH Port Forwarding or Tunneling]
* [https://stackoverflow.com/questions/29936948 SSH Multiple Ports Forward]
* [[Bash/Port|Enable Disable Port]]
* [[Bash/Port|Enable Disable Port]]
* [[Convention for Port|Convention of Port]]
* [[Convention for Port|Convention of Port]]
* [[Bash/Port/Forward|Port Forward]]
* [[Bash/Port/Forward|Port Forward]]
* [[RabbitMQ]]
* [[Mosquitto]]
* [[Flask]]
| valign="top" |
* [https://serverfault.com/questions/1159599/ SSH server » Ubuntu » Change the default port]
* [https://stackoverflow.com/questions/4549945/ <code>rsync</code> » Specify a different ssh port]
* [[Bastion SSH Tunneling]]
* [[OpenSSL]]
| valign="top" |
|}

Latest revision as of 11:51, 1 November 2024

Local Forwarding

Python Flask
ssh [email protected] -L 5000:localhost:5000
http://localhost:5000/
RabbitMQ
ssh [email protected] -L 15672:10.19.83.10:15672
http://localhost:15672/
username: guest
password: guest
Node Red
ssh [email protected] -L 1880:localhost:1880
http://localhost:1880/
Mosquitto
ssh [email protected] -L 1883:localhost:1883

Remote Forwarding

nano /etc/ssh/sshd_config

GatewayPorts no|yes| clientspecified
#AllowAgentForwarding yes
AllowTcpForwarding yes
GatewayPorts clientspecified
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
Match User pi     
    AllowTcpForwarding yes
    GatewayPorts yes
systemctl restart sshd
service sshd restart
ssh [email protected] -R 10.19.83.10:80:cdn.chorke.org:1983
ssh [email protected] -R 10.19.83.10:80:localhost:1983
ssh [email protected] -R 10.19.83.10:80:0.0.0.0:1983
ssh [email protected] -R 10.19.83.10:80::1983
ssh [email protected] -R localhost:80::1983
ssh [email protected] -R 80:1983
ssh [email protected] -R 80

References