V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
rizon
V2EX  ›  程序员

firewall-cmd 怎么配置端口转发?

  •  
  •   rizon ·
    othorizon · 2019-04-02 10:25:46 +08:00 · 2034 次点击
    这是一个创建于 1875 天前的主题,其中的信息可能已经有所发展或是发生改变。

    内网机器 A 和 B,在 B 上安装了 zerotier,然后在另一台机器可以借助 zerotier 的虚拟网来连接 B。 于是想要在 B 做端口转发来访问 A。
    因为 A 上不想安装 zerotier,A 是一个群晖 nas,zerotier 会导致硬盘一直在咔咔的响。
    B 是 centos 的系统,但是我用 firewall-cmd 配置了端口转发没有用? 请问这东西怎么配置啊?

    firewall-cmd --add-forward-port=port=7100:proto=tcp:toaddr=xxx.xx.xx.xxx:toport=22

    PS. 执行firewall-cmd --get-zone-of-interface=[zerotier 虚拟网卡]结果是 no zone
    PS. 转发 22 端口是因为 A 机器上装了 git server,想要用 git 去 push 代码到 A 上

    1 条回复    2019-04-02 10:37:12 +08:00
    rizon
        1
    rizon  
    OP
       2019-04-02 10:37:12 +08:00
    firewall-cmd 的几个 zone 有什么区别吗?除了 trusted 和 drop 之外,剩下的有区别吗?还是只是起了个名字而已?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   991 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 21:41 · PVG 05:41 · LAX 14:41 · JFK 17:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.