Linux iptables 设置
来源:互联网 发布:c语言~(~a^a),a|1 编辑:程序博客网 时间:2024/06/01 10:43
编辑 /etc/sysconfig/iptables
然后运行 /sbin/service iptables restart
防火墙规则只有在 iptables 服务运行的时候才能被激活。要手工启动服务,使用以下命令:
/sbin/service iptables restart
要确保它在系统引导时启动,使用以下命令:
/sbin/chkconfig --level 345 iptables on
ipchains 服务不能和 iptables 服务同时运行。要确定ipchains 服务被禁用,执行以下命令:
/sbin/chkconfig --level 345 ipchains off
以下是比较常见的防火墙规则:iptables -F#删除已经存在的规则iptables -P INPUT DROP#配置默认的拒绝规则。基本规则是:先拒绝所有的服务,然后根据需要再添加新的规则。iptables -A INPUT -p tcp --dport 80 -j ACCEPT #打开WEB服务端口的tcp协议iptables -A INPUT -p tcp --dport 110 -j ACCEPT #打开POP3服务端口的tcp协议iptables -A INPUT -p tcp --dport 25 -j ACCEPT #打开SMTP服务端口的tcp协议iptables -A INPUT -p tcp --dport 21 -j ACCEPT#打开FTP服务端口的tcp协议iptables -A INPUT -p tcp -s 202.106.12.130 --dport 22 -j ACCEPT#允许IP地址为202.106.12.130这台主机连接本地的SSH服务端口iptables -A INPUT -p tcp --dport 53 -j ACCEPT#允许DNS服务端口的tcp数据包流入iptables -A INPUT -p udp --dport 53 -j ACCEPT#允许DNS服务端口的udp数据包流入iptables -A INPUT -p icmp -icmp-type echo-request -i eth1 -j DROP#防止死亡之ping,从接口eth1进入的icmp协议的请求全部丢弃。iptables -A FORWARD -p tcp --syn -m limit --limit 1/s -j ACCEPT#防止SYN Flood (拒绝服务攻击)根据服务器情况,你也可以自行添加规则。
iptables -I RH-Firewall-1-INPUT 20 -p TCP -s 211.161.250.232/32 -m state --state NEW --dport 3306 -j ACCEPT
iptables -I RH-Firewall-1-INPUT 20 -p TCP -s 211.161.192.0/24 -m state --state NEW --dport 3306 -j ACCEPT
- Linux iptables 设置
- linux-iptables设置NAT
- Linux iptables 设置
- Linux iptables 设置
- Linux VPS iptables 设置
- linux iptables 设置详解
- linux iptables 防火墙设置
- linux iptables端口映射设置
- linux IPTABLES 设置
- linux iptables 防火墙 设置
- linux iptables端口映射设置
- 【Linux】防火墙iptables设置
- linux iptables设置
- linux防火墙iptables设置
- Linux 下iptables 防火墙设置
- linux 防火墙 iptables 设置 (系统管理员)
- linux下IPTABLES设置详解
- linux下iptables防火墙设置
- 给定一个链表的头指针,要求只遍历一次,将单链表中的元素顺序反转过来
- make -C M=
- dwz框架如何将弹出的子窗口传值回父窗口
- 矩阵的Crout分解
- 生产订单作为成本分摊、分配接受方对象配置
- Linux iptables 设置
- Java成幀与解析
- 交叉编译
- flash教程
- 查表:根据butterfly 状态UUID获取状态中文名称
- Java 遍历Map
- JAVA String 对象
- Win7虚拟Wifi,实现无线路由器的AP功能
- Java中删除文件、删除目录及目录下所有文件