Ubuntu iptables 设置
在ubuntu中由于不存在 /etc/init.d/iptales文件,所以无法使用service等命令来启动iptables,需要用modprobe命令。
启动iptables
modprobe ip_tables
关闭iptables(关闭命令要比启动复杂)
iptalbes -F
iptables -X
iptables -Z
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
modprobe -r ip_tables
依次执行以上命令即可关闭iptables,否则在执行modproble -r ip_tables时将会提示 FATAL: Module ip_tables is in use
iptables -F
iptables -X
#抛弃所有不符合三种链规则的数据包
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
#设置:本地进程 lo 的 INPUT 和 OUTPUT 链接 ; eth1的INPUT链
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth1 -m state --state ESTABLISHED,RELATED -jACCEPT
iptables -A INPUT -i eth1 -m state --state NEW,INVALID -j LOG
iptables -A OUTPUT -o lo -j ACCEPT
#对其他主要允许的端口的 OUTPUT设置:
# DNS
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 53 -jACCEPT
iptables -A OUTPUT -o eth1 -p UDP --sport 1024:65535 --dport 53 -jACCEPT
#HTTP
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 80 -jACCEPT
#HTTPS
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 443 -jACCEPT
#Email 接受 和发送
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 110 -jACCEPT
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 25 -jACCEPT
# FTP 数据和控制
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 20 -jACCEPT
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 21 -jACCEPT
#DHCP
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 68 -jACCEPT
iptables -A OUTPUT -o eth1 -p UDP --sport 1024:65535 --dport 68 -jACCEPT
#POP3S Email安全接收
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 995 -jACCEPT
#时间同步服务器 NTP
iptables -A OUTPUT -o eth1 -p TCP --sport 1024:65535 --dport 123 -jACCEPT
#拒绝 eth1 其他剩下的
iptables -A OUTPUT -o eth1 --match state --state NEW,INVALID -jLOG
最后是有关于iptables存储的命令:
在
iface ath0 inet dhcp
后面加上
Ubuntu iptables 设置的更多相关文章
- ubuntu iptables设置【转】
root@qustdjx-K42JZ:/home/qustdjx# iptables -L -nChain INPUT (policy ACCEPT)target prot opt sourc ...
- 阿里云服务器上使用iptables设置安全策略
转自:http://www.netingcn.com/aliyun-iptables.html 公司的产品一直运行在云服务器上,从而有幸接触过aws的ec2,盛大的云服务器,最近准备有使用阿里云的弹性 ...
- ubuntu下设置jupyter notebook 2017年07月29日 19:28:34 小旋锋 阅读数:8329 标签: ubuntu 更多 个人分类: python 二三事 来源:http://blog.csdn.net/suzyu12345/article/details/51037905 Ipython Notebook现在已经改名为Ipython jupyter,是最知名最好用的
ubuntu下设置jupyter notebook 来源:http://blog.csdn.net/suzyu12345/article/details/51037905 Ipython No ...
- [转载]ubuntu防火墙设置
原文地址:ubuntu防火墙设置作者:風飏 自打2.4版本以后的Linux内核中, 提供了一个非常优秀的防火墙工具.这个工具可以对出入服务的网络数据进行分割.过滤.转发等等细微的控制,进而实现诸 ...
- ubuntu下设置数据库字符集
就linux环境下出现的数据库乱码的问题,以ubuntu为例进行的总结 ubuntu环境设置的字符集utf8,windows默认字符集是GBK,Ubuntu的默认字符集为utf-8,这使 得在用tel ...
- Ubuntu iptables配置
sudo su sudo apt-get install iptables-persistent modprobe ip_tables #启动iptable #删除原有iptables规则 ipt ...
- ubuntu server设置时区和更新时间
ubuntu server设置时区和更新时间 今天测试时,发现时间不对,查了一下时区: data -R 结果时区是:+0000 我需要的是东八区,这儿显示不是,所以需要设置一个时区 一.运行 ...
- Ubuntu中设置静态IP和DNS
在Ubuntu中设置静态IP共两步:1>设置IP:2>设置DNS1>设置IP 编辑 /etc/network/interface文件: sudo vi /etc/n ...
- 在Ubuntu中设置中文输入法
在Ubuntu中设置中文输入法 */--> pre { background-color: #2f4f4f;line-height: 1.6; FONT: 10.5pt Consola,&quo ...
随机推荐
- 打不开BT,一直重复的关闭开启。
/bt-btif (25335): ...preload_wait_timeout (retried:0/max-retry:1)...D/bt_userial(25335): RX terminat ...
- SQLServer在多个表中都增加一个字段的方法
1.使用游标 declare @sql varchar(), @name varchar() declare my_cursor scroll cursor for select name from ...
- web服务器小记
服务器分web服务器,应用程序服务器以及HTTP服务器,此处只解释web服务器,详情: http://www.cnblogs.com/zhaoyl/archive/2012/10/10/2718575 ...
- 35W行数据的文本文件,每500行添加4个换行符。代码实现思路
- VIM继承C语言(转)
在下面的基础上加上了astyle sh.c --style=kr --indent=spaces --indent-cases --pad-header --pad-oper --unpad-pare ...
- Unity3D项目优化(转)
前言: 刚开始写这篇文章的时候选了一个很土的题目...<Unity3D优化全解析>.因为这是一篇临时起意才写的文章,而且陈述的都是既有的事实,因而给自己“文(dou)学(bi)”加工留下的 ...
- android cts 命令的说明
Host help showthis message 帮助文档 exit exitcts command line 退出CTS ls 全部用l替代,--plan直接用p替代,也即 l p .其他类似 ...
- A SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene40' does not exist.
简单的建立索引和查询索引并不难,关键在于他的二次开发,让他适合你自己的需求 既然要二次开发就必须查看源码 首先看看索引过程中的核心类吧: IndexWriter 这个是核心组件, 建立和打开索引,以及 ...
- 解析GenericOptionsParser
hadoop源代码分析(4)-org.apache.hadoop.util包-GenericOptionsParser类[原创] 一 准备 hadoop版本:1.0.3,GenericOptio ...
- js html 交互监听事件学习
事件处理程序(handler): HTML事件处理程序: <input type="button" value="Click Here" onclick= ...