Junyangz's docs
  • Introduction
  • Ops
    • Linux-tips
    • MySQL-5.7.20
    • Upgrading MySQL
    • Upgrade OpenSSH to 7.7p1 in CentOS 6
    • Linux PERSISTENT NAMING
    • Use Kafka with Flume - CRS2
    • Setup Chroot SFTP in CentOS
    • Setup software RAID-5 in CentOS
    • SSH-port-forwarding
    • Elasticsearch In Production
    • ELK-simple-tutorial
    • Ansible Playbooks for Apache Kafka in production
    • GitHub Actions depoly Hexo
    • Test HTTP3/QUIC docker
    • Docker tutorial
    • SFTP-auth-pubkey
    • Linux Process Substitution
  • Note
    • Interview
      • interview-prepare
      • 2020-campus-recruiting
    • Android Tips
    • MacOS tips
    • Secret knowledge
    • GPG-Note
    • ud185
    • ud185-2
    • Introducing Tensorflow Federated
    • Tensorflow Federated
    • Expert Python Programing
    • What happens when zh_CN
    • TILGC
    • VScode keyboard shortcuts
    • Abseil Python
    • Latex Note
    • Git Cheatsheet
    • Study Smarter Not Harder
    • Machine Learning Interviews
    • 深度学习中的优化
    • Beej's Guide to Network Programming Note
      • ch4
      • ch5
      • ch6
      • ch7
  • [Share]
    • What to do after what to do
    • Truman is everywhere
    • Way2outer
    • 未来十五年
  • Quote
Powered by GitBook
On this page

Was this helpful?

  1. Ops

SSH-port-forwarding

PreviousSetup software RAID-5 in CentOSNextElasticsearch In Production

Last updated 2 years ago

Was this helpful?

# 本地转发(SERVER可以访问目标服务)本机监听forwardingPort
ssh -g -f -N -L forwardingPort:targetIP:targetPort user@SERVER
# 远程转发(SERVER具有公网IP,提供内网服务外网访问)SERVER监听forwardingPort
ssh -f -N -R forwardingPort:targetIP:targetPort user@SERVER
# 动态转发(创建了SOCKS代理服务,流量转发至SERVER)
ssh -p PORT -f -N -D *:20080 user@SERVER

Reference

IBM
SSH Manual Page