debian关闭防火墙如何查看linux关闭防火墙是否关闭

debian关闭防火墙  时间:2021-05-18  阅读:()

如何在debian下关闭防火墙

ebian下iptables输入命令后即时生效,但重启之后配置就会消失,可用iptables-save快速保存配置,因为Debian上iptables是不会保存规则的,然后在开机自动的时候让iptables自动加载刚刚导出的配置文件,方法如下: 若要停止iptables,iptables -F清空所有配置效果等同于停止。

whereis iptables 查找iptables 所在的路径。

1、将iptables配置保存到/etc/iptables,这个文件名可以自己定义,与下面的配置一致即可 iptables-save > /etc/iptables 2、创建自启动配置文件,并授于可执行权限 iptables-save > /etc/iptables 3、编辑该自启动配置文件,内容为启动网络时恢复iptables配置 vi /work/if-pre-up.d/iptables 内容为: #!/bin/sh /sbin/iptables-restore < /etc/iptables 保存并退出。

这样重启之后iptables就自动加载规则了。

##注意:在下次修改iptables规则之后要重新导出配置文件。

#清空配置 iptables -F iptables -X iptables -Z #配置,禁止进,允许出,允许回环网卡 iptables -P INPUT DROP iptables -A OUTPUT -j ACCEPT iptables -A INPUT -i lo -j ACCEPT #允许ping iptables -A INPUT -p icmp -j ACCEPT #允许ssh iptables -A INPUT -p tcp --dport 22 -j ACCEPT #允许ftp iptables -A INPUT -p tcp --dport 21 -j ACCEPT iptables -A INPUT -p tcp --dport 20 -j ACCEPT #允许ftp被动接口范围,在ftp配置文件里可以设置 iptables -A INPUT -p tcp --dport 20000:30000 -j ACCEPT #学习felix,把smtp设成本地 iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT -s 127.0.0.1 iptables -A INPUT -p tcp -m tcp --dport 25 -j REJECT #允许DNS iptables -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT iptables -A INPUT -p udp -m udp --dport 53 -j ACCEPT #允许http和https iptables -A INPUT -p tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp --dport 443 -j ACCEPT # 允许已建立的或相关连的通行 iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT #禁止其他未允许的规则访问 iptables -A INPUT -j REJECT #(注意:如果22端口未加入允许规则,SSH链接会直接断开。

) iptables -A FORWARD -j REJECT #保存配置 iptables-save > /etc/iptables 由于Debian安装iptables后默认不是服务e79fa5e98193e59b9ee7ad9431333361326231提示service iptables提示unrecognized service,需要添加脚本到/etc/init.d/,脚本如下 建议将其保存为/etc/init.d/iptables,然后chmod +x /etc/init.d/iptables 添加运行权限。

#!/bin/sh -e ### BEGIN INIT INFO # Provides: iptables # Required-Start: # : # Default-Start: 2 3 4 5 # : 0 1 6 # Short-Description: start and iptables firewall # Description: Start, and save iptables firewall ### END INIT INFO PATH=”/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin” IPTABLES=/sbin/iptables IPTABLES_SAVE=/sbin/iptables-save IPTABLES_RESTORE=/sbin/iptables-restore IPTABLES_CONFIG=/etc/iptables.conf [ -x $IPTABLES ] || exit 0 . /lib/lsb/init-functions case "$1" in start) log_action_begin_msg "Starting firewall" type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true if $IPTABLES_RESTORE < $IPTABLES_CONFIG ; then log_action_end_msg $ else log_action_end_msg $ fi type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true ;; ) log_action_begin_msg "Saving current firewall configuration" if $IPTABLES_SAVE > $IPTABLES_CONFIG ; then log_action_end_msg $ else log_action_end_msg $ fi log_action_begin_msg "Flushing ALL firewall rules from chains!" if $IPTABLES -F ; then log_action_end_msg $ else log_action_end_msg $ fi log_action_begin_msg "Deleting ALL firewall chains [Warning: ACCEPTING ALL PORT SERVICES!]" if $IPTABLES -X ; then $IPTABLES -P INPUT ACCEPT $IPTABLES -P FORWARD ACCEPT $IPTABLES -P OUTPUT ACCEPT log_action_end_msg $ else log_action_end_msg $ fi ;; save) log_action_begin_msg "Saving current firewall configuration" if $IPTABLES_SAVE > $IPTABLES_CONFIG ; then log_action_end_msg $ else log_action_end_msg $ fi ;; force-reload|restart) log_action_begin_msg "Reloading firewall configuration [Warning: POTENTIAL NETWORK INSECURITY DURING RELOAD]" $IPTABLES -F $IPTABLES -X if $IPTABLES_RESTORE < $IPTABLES_CONFIG ; then log_action_end_msg $ else log_action_end_msg $ fi ;; *) echo "Usage: /etc/init.d/iptables {start||save|restart|force-reload}" exit 1 ;; esac exit 0

LIUNX4.7怎么关闭防火墙 急急急急!!!!!!!!

1) 永久性生效,重启后不会复原

开启: chkconfig iptables on

关闭: chkconfig iptables off

2) 即时生效,重启后复原

开启: service iptables start

关闭: service iptables

需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。

在开启了防火墙时,做如下设置,开启相关端口,

修改/etc/sysconfig/iptables 文件,添加以下内容: -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

linux 关闭防火墙命令是什么

1) 永久性生效,重启后不会复原 开启:5261 chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后复原 开启: service iptables start 关闭: service iptables 需要说明的4102是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作1653。

在开启了防火墙时,做如下设置,开启相关端口, 修改/etc/sysconfig/iptables 文件,添加以下内容专: -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 更多属Linux操作知识,可以百度《Linux就该这么学》。

Red Hat linux 6.1如何关闭防火墙

1)立即关闭,并非永久关闭 service iptables 2)永久关闭 iptables -F 关闭防火墙功能 chkconfig iptables off 禁止防火墙启动 另外,运行 setup 在界面,选择Firewall configuration,进入下一界面,选择 Security Level为Disabled,保存。

linux怎么永久关闭防火墙?

1) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后失效 开启: service iptables start 关闭: service iptables 需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。

在开启了防火墙时,做如下设置,开启相关端口, 修改/etc/sysconfig/iptables 文件,添加以下内容: -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT

如何查看linux关闭防火墙是否关闭

查看防火墙状态: /etc/init.d/iptables status 暂时关闭防火墙: /etc/init.d/iptables 禁止防火墙在系统启动时启动 /sbin/chkconfig --level 2345 iptables off 重启iptables: /etc/init.d/iptables restart

湖北22元/月(昔日数据)云服务器,国内湖北十堰云服务器,首月6折

昔日数据怎么样?昔日数据新上了湖北十堰云服务器,湖北十堰市IDC数据中心 母鸡采用e5 2651v2 SSD MLC企业硬盘 rdid5阵列为数据护航 100G高防 超出防御峰值空路由2小时 不限制流量。目前,国内湖北十堰云服务器,首月6折火热销售限量30台价格低至22元/月。(注意:之前有个xrhost.cn也叫昔日数据,已经打不开了,一看网站LOGO和名称为同一家,有一定风险,所以尽量不要选择...

UCloud云服务器低至年59元

最近我们是不是在讨论较多的是关于K12教育的问题,培训机构由于资本的介入确实让家长更为焦虑,对于这样的整改我们还是很支持的。实际上,在云服务器市场中,我们也看到内卷和资本的力量,各大云服务商竞争也是相当激烈,更不用说个人和小公司服务商日子确实不好过。今天有看到UCloud发布的夏季促销活动,直接提前和双十一保价挂钩。这就是说,人家直接在暑假的时候就上线双十一的活动。早年的双十一活动会提前一周到十天...

CloudCone中国春节优惠活动限定指定注册时间年付VPS主机$13.5

CloudCone 商家产品还是比较有特点的,支持随时的删除机器按时间计费模式,类似什么熟悉的Vultr、Linode、DO等服务商,但是也有不足之处就在于机房太少。商家的活动也是经常有的,比如这次中国春节期间商家也是有提供活动,比如有限定指定时间段之前注册的用户可以享受年付优惠VPS主机,比如年付13.5美元。1、CloudCone新年礼物限定款仅限2019年注册优惠购买,活动开始时间:1月31...

debian关闭防火墙为你推荐
阿里服务器一年多少钱在阿里巴巴网开店一年要交多少费用?日本名字大全日本动漫人物名字大全虚拟主机安全吗虚拟机环境有哪些安全隐患?怎么架设服务器如何搭建游戏服务器可靠云主机买服务器合算还是用云主机靠谱?有什么好办法?ddos防御怎样防御DDOS攻击?vps什么是VPS? 和虚拟主机有什么不同?ck香港官网香港ck Calvin Klein正装什么价位?一般什么时候会打折?搭建服务器教程怎么在自己的电脑上建立服务器菲律宾高防服务器菲律宾高防服务器锐一网络这家公司怎么样?
企业主机 阿里云邮箱登陆首页 彩虹ip ibox官网 免费防火墙 免费高速空间 购买国外空间 1元域名 云营销系统 photobucket atom处理器 云服务是什么意思 博客域名 数据湾 汤博乐 香港博客 magento主机 2016黑色星期五 极域网 上海服务器托管 更多