以下是在 Red Hat 7.2 上设置 ip6tables 的步骤:

  1. 确认系统已经安装了 ip6tables:

    sudo yum install -y ip6tables
    
  2. 编辑 /etc/sysconfig/ip6tables 文件来设置规则:

    sudo vi /etc/sysconfig/ip6tables
    

    在文件中添加需要的规则,例如:

    *filter
    :INPUT DROP [0:0]
    :FORWARD DROP [0:0]
    :OUTPUT ACCEPT [0:0]
    
    # 允许icmpv6
    -A INPUT -p icmpv6 -j ACCEPT
    -A OUTPUT -p icmpv6 -j ACCEPT
    
    # 允许ssh
    -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
    
    # 允许http和https
    -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
    -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
    
    COMMIT
    

    这个例子中,规则允许 ICMPv6、SSH、HTTP 和 HTTPS 流量通过。

  3. 启动 ip6tables 服务:

    sudo systemctl start ip6tables
    
  4. 设置开机自启动:

    sudo systemctl enable ip6tables
    

现在,您已经成功设置了 ip6tables 规则来保护您的系统

red hat 72 如何设置 ip6tables

原文地址: https://www.cveoy.top/t/topic/fq89 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录