美文网首页
Centos7端口映射

Centos7端口映射

作者: 上帝与我同幻想 | 来源:发表于2017-06-14 19:45 被阅读0次

    端口映射命令(80>8080):

    iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
    

    重启后会失效。

    保存命令:

    service iptables save
    

    centos7没有该命令:

    # service iptables save
    The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, 
    force-reload, status). For other actions, please try to use systemctl.
    

    解决方法:
    1.先执行如下命令:

    systemctl stop firewalld
    systemctl mask firewalld
    

    2.安装iptables services

    yum install iptables-services
    

    3.设置开机启动

    systemctl enable iptables
    

    4.重启iptables service

    systemctl restart iptables
    

    5.执行保存配置命令

    service iptables save

    相关文章

      网友评论

          本文标题:Centos7端口映射

          本文链接:https://www.haomeiwen.com/subject/rbseqxtx.html