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

HostKvm新上联通CUVIP线路VPS,八折优惠后1G内存套餐$5.2/月起

最近上洛杉矶机房联通CUVIP线路主机的商家越来越多了,HostKvm也发来了新节点上线的邮件,适用全场8折优惠码,基于KVM架构,优惠后最低月付5.2美元起。HostKvm是一家成立于2013年的国人主机商,提供基于KVM架构的VPS主机,可选数据中心包括日本、新加坡、韩国、美国、中国香港等多个地区机房,君选择国内直连或优化线路,延迟较低,适合建站或者远程办公等。以洛杉矶CUVIP线路主机为例,...

Sharktech($49/月),10G端口 32GB内存,鲨鱼机房新用户赠送$50

Sharktech 鲨鱼机房商家我们是不是算比较熟悉的,因为有很多的服务商渠道的高防服务器都是拿他们家的机器然后部署高防VPS主机的,不过这几年Sharktech商家有自己直接销售云服务器产品,比如看到有新增公有云主机有促销活动,一般有人可能买回去自己搭建虚拟主机拆分销售的,有的也是自用的。有看到不少网友在分享到鲨鱼机房商家促销活动期间,有赠送开通公有云主机$50,可以购买最低配置的,$49/月的...

Linode十八周年及未来展望

这两天Linode发布了十八周年的博文和邮件,回顾了过去取得的成绩和对未来的展望。作为一家运营18年的VPS主机商,Linode无疑是有一些可取之处的,商家提供基于KVM架构的VPS主机,支持随时删除(按小时计费),可选包括美国、英国、新加坡、日本、印度、加拿大、德国等全球十多个数据中心,所有机器提供高出入网带宽,最低仅$5/月($0.0075/小时)。This month marks Linod...

debian关闭防火墙为你推荐
49美金AirPods更换电池要多少钱:过保需要49美元轻量级服务器什么是轻量级应用服务器?服务器翻译怎么才能把英文页面直接翻译成中文gd域名注册请问gd注册的域名,能不能主……国外手机号求个美国手机号码 麻烦了 万分感激四叶草安全四叶草有着什么秘密、、??payoneer卡官网登录payoneer卡的钱如何转到香港汇丰银行里?怎么转,手续费是多少。求详细解答香港云服务器推荐香港服务器怎么样?哪个比较好啊?服务器网速测试如何测试服务器网速jsp的虚拟主机java虚拟主机,jsp的语言用哪种空间呢
网游服务器租用 高防服务器租用qy 备案域名出售 cdn服务器 12306抢票攻略 xfce patcha 服务器cpu性能排行 商家促销 52测评网 大容量存储器 国外免费asp空间 gtt web服务器安全 百度云加速 游戏服务器出租 贵阳电信测速 免费稳定空间 SmartAXMT800 美国主机侦探 更多