5SERVER
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Unsolved
    • Solved

    关于免费VPS的NAT端口使用

    Announcements - 公告
    1
    1
    111
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • admin
      admin last edited by

      首先,你需要知道的外网IP。

      可以通过以下命令获取到:

      curl ifconfig.me
      

      或者

      wget http://ifconfig.me/ip
      cat ip
      

      这样你就知道VPS的外网IP了。


      假设获取到的IP是:xxx.xxx.xxx.xxx

      然后结合你的内网IP,

      这里再假设下内网IP:198.18.100.78

      NAT端口映射关系:
      xxx.xxx.xxx.xxx的 7801 至 7899 将被映射到 198.18.100.78 的 1 到 99

      比如我要ssh远程登录到198.18.100.78这个主机上的默认22号端口,那我的ssh命令如下:

      ssh -p 7822 xxx.xxx.xxx.xxx
      

      这样就能ssh登录到198.18.100.78的22号端口了。

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Telegram Group | Telegram Channel | Telegram Discussion