posts - 88, comments - 3, trackbacks - 0, articles - 0
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

iptables rules

Posted on 2012-02-27 10:41 Milo的海域 阅读(220) 评论(0)  编辑  收藏 所属分类: Linux
Disable/Enable PORT
#disable port 29600
iptables -I INPUT -p tcp --dport 
29600 -j DROP
iptables -I OUTPUT -p tcp --dport 
29600 -j DROP

#enable port 29600 after disabled
iptables -D INPUT -p tcp --dport 29600 -j DROP
iptables -D OUTPUT -p tcp --dport 
29600 -j DROP

Block Ipaddress
# Block comming packets of ipaddress, then all packets come from this address will be dropped
iptables -A INPUT -s 192.168.1.5 -j DROP

# Block outgoing packets of ipaddress, then all packets sent to that address will be dropped
iptables -A OUTPUT -p tcp -d 192.168.1.2  -j DROP

Disable NIC traffic
# disable
iptables -A INPUT -jDROP -i eth1
iptables -A OUTPUT -jDROP -o eth1

# enable back
iptables -D INPUT -jDROP -i eth1
iptables -D OUTPUT -jDROP -o eth1

links
http://wiki.centos.org/HowTos/Network/IPTables
http://www.thegeekstuff.com/2011/06/iptables-rules-examples/

只有注册用户登录后才能发表评论。


网站导航: