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

印象云七夕促销,所有机器7折销售,美国CERA低至18元/月 年付217元!

印象云,成立于2019年3月的商家,公司注册于中国香港,国人运行。目前主要从事美国CERA机房高防VPS以及香港三网CN2直连VPS和美国洛杉矶GIA三网线路服务器销售。印象云香港三网CN2机房,主要是CN2直连大陆,超低延迟!对于美国CERA机房应该不陌生,主要是做高防服务器产品的,并且此机房对中国大陆支持比较友好,印象云美国高防VPS服务器去程是163直连、三网回程CN2优化,单IP默认给20...

RackNerd:便宜vps补货/1核/768M内存/12G SSD/2T流量/1G带宽,可选机房圣何塞/芝加哥/达拉斯/亚特拉大/荷兰/$9.49/年

RackNerd今天补货了3款便宜vps,最便宜的仅$9.49/年, 硬盘是SSD RAID-10 Storage,共享G口带宽,最低配给的流量也有2T,注意,这3款补货的便宜vps是intel平台。官方网站便宜VPS套餐机型均为KVM虚拟,SolusVM Control Panel ,硬盘是SSD RAID-10 Storage,共享G口带宽,大流量。CPU:1核心内存:768 MB硬盘:12 ...

tmhhost(100元/季)自带windows系统,香港(三网)cn2 gia、日本cn2、韩国cn2、美国(三网)cn2 gia、美国cn2gia200G高防

tmhhost可谓是相当熟悉国内网络情况(资质方面:ISP\ICP\工商齐备),专业售卖海外高端优质线路的云服务器和独立服务器,包括了:香港的三网cn2 gia、日本 cn2、日本软银云服务器、韩国CN2、美国三网cn2 gia 云服务器、美国 cn2 gia +200G高防的。另外还有国内云服务器:镇江BGP 大连BGP数据盘和系统盘分开,自带windows系统,支持支付宝付款和微信,简直就是专...

debian关闭防火墙为你推荐
腾讯云网页版亿方云网页版安装wget命令LINUX下wget的使用如何登陆阿里云服务器阿里云服务器无法登陆,怎么办?linux开放8080端口怎么在linux 打开80端口可靠云主机买服务器合算还是用云主机靠谱?有什么好办法?阿里云服务器怎么样阿里云服务器怎么样?用来做网站效果好吗?快云服务器快云服务器性价比怎么样??美国手机号码美国电话域名分类域名的基本类型有哪些?爱奇艺会员体验购买什么东西才能获得爱奇艺的vip体验卷
网站服务器租用 青岛虚拟主机 域名注册信息查询 浙江vps 什么是二级域名 directspace bluevm kdata qq数据库 建立邮箱 稳定免费空间 银盘服务是什么 联通网站 空间首页登陆 阿里云手机官网 云服务是什么意思 国内空间 phpinfo 机柜尺寸 linux服务器系统 更多