手机评站网今天精心准备的是《linux防火墙设置》,下面是详解!
linux如何关闭防火墙
一.Linux下开启/关闭防火墙命令
1) 永久性生效,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
需要说明的是对于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
二.UBuntu关闭防火墙
iptables -A INPUT -i ! PPP0 -j ACCEPT
三.CentOS Linux 防火墙配置及关闭
执行”setup”命令启动文字模式配置实用程序,在”选择一种工具”中选择”防火墙配置”,然后选择”运行工具”按钮,出现防火墙配置界面,将”安全级别”设为”禁用”,然后选择”确定”即可.
或者用命令:
#/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT
#/etc/rc.d/init.d/iptables save
这样重启计算机后,防火墙默认已经开放了80和22端口
这里应该也可以不重启计算机:
#/etc/init.d/iptables restart
关闭防火墙服务即可:
查看防火墙信息:
#/etc/init.d/iptables status
关闭防火墙服务:
#/etc/init.d/iptables stop
永久关闭?不知道怎么个永久法:
#chkconfig –level 35 iptables off
linux如何关闭防火墙
1) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off
2) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
需要说明的是对于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 如何关闭防火墙
Linux中的防火墙有多种,一般指的iptables。
1. Linux防火墙(Iptables)重启系统生效
开启: chkconfig iptables on 关闭: chkconfig iptables off
2.Linux防火墙(Iptables) 即时生效,重启后失效
开启: service iptables start 关闭: service iptables stop
3.其它linux防火墙,请自行参考说明文档。一般对于Linux下的服务都可以用以上命令执行开启和关闭操作,而防火墙通常都以服务形式运行,因此也算是一个通用的方法。
Linux 服务器如何开放端口 配置防火墙
打开配置文件
命令代码 [root@localhost ~]# vi /etc/sysconfig/iptables
正确的配置文件
配置代码
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT
配置[*]通配代码
-A INPUT -m state –state NEW -m tcp -p tcp –dport * -j ACCEPT
注意点:新开放的端口一定要在端口22后面
重启防火墙使配置生效
命令代码
[root@localhost ~]# /etc/init.d/iptables restart
其它
查看开放端口
命令代码
[root@localhost ~]# /etc/init.d/iptables status
关闭防火墙
命令代码
[root@localhost ~]# /etc/init.d/iptables stop
如何查看linux系统的防火墙设置
从配置菜单关闭防火墙是不起作用的,索性在安装的时候就不要装防火墙
查看防火墙状态:
/etc/init.d/iptables status
暂时关闭防火墙:
/etc/init.d/iptables stop
禁止防火墙在系统启动时启动
/sbin/chkconfig --level 2345 iptables off
重启iptables:
/etc/init.d/iptables restart
题外话:
BT或者骡子速度慢用不着关防火墙,只要把相应端口开放就可以了
在文件
/etc/sysconfig/iptables
在系统原始配置的:RH-Firewall-1-INPUT规则链增加类似这样的行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 39764 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 39764 -j ACCEPT
如果发现原有-j REJECT一类的语句,上面两句要放在它的前面
重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off 或者 /sbin/chkconfig --level 2345 iptables off
2) 即时生效,重启后失效
service 方式
开启: service iptables start
关闭: service iptables stop
iptables方式
查看防火墙状态:
/etc/init.d/iptables status
暂时关闭防火墙:
/etc/init.d/iptables stop
重启iptables:
/etc/init.d/iptables restart
Linux防火墙的linux 如何查看防火墙是否开启
一、基本查看命令
chkconfig命令只是查看和设置服务的自动启动情况,并不能反映当前服务的状态.
二、服务查看方式
service iptables status可以查看到iptables服务的当前状态
但是即使服务运行了,防火墙也不一定起作用,你还得看防火墙规则的设置
iptables -L
上述命令的返回值如果显示没有防火墙规则,那就是不起作用;反之就是防火墙在起作用.
三、查看服务状态
iptables 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
四、Linux运行级别
linux有六个运行级别,0(关机),1单用户,2多用户(无NFS),3完全多用户, 4(未使用),5图形界面X11,6重启,
五、不同操作系统服务配置文件路径
CENTOS/redhat,service iptables status
debian,/etc/init.d/iptables
Linux防火墙iptables限制几个特定ip才能访问服务器。
要限制哪几个特定IP?访问什么服务器?问问题能不能说得具体点?
既然你没说那我只能自己举例子了:
内网是192.168.1.0/24,限制只有192.168.100和192.168.1.200能访问WEB服务器。
将WEB服务器的INPUT链设置成默认拒绝
iptables -P INPUT DROP
然后再添加下面两条规则
iptables -A INPUT -s 192.168.1.100 -j ACCEPT
iptables -A INPUT -s 192.168.1.200 -j ACCEPT
linux防火墙限制https上传大小怎么设置
修改文件/etc/sysconfig/iptables
[root@bogon ~]# cd /etc/sysconfig/
[root@bogon sysconfig]# vi iptables
在文件中加入如下内容,目的是对外界开放8080端口
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
2.将iptables服务重启。
[root@bogon sysconfig]# service iptables restart
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
Applying iptables firewall rules: [ OK ]
Loading additional iptables modules: ip_conntrack_ftp [ OK ]
[root@bogon sysconfig]#
这样就放开了8080端口的限制。
linux怎么清除防火墙规则
linux怎么清除防火墙规则?...
linux怎么清除防火墙规则?
使用的是iptables吗?
如果是iptables的话,清除规则:
# iptables -F
注意!清除规则是恢复到默认规则,如果默认规则为ACCEPT那就全是ACCEPT,如果默认规则是DROP的话,那就是全DROP了。
linux 如何查看防火墙是否开启
我怎么看iptables是否开启呢linux操作系统在网上查的是chkconfigiptables--list可打印出来的iptables0:关闭1:关闭2:启用3:启用4:启用5:启用6:关闭这些是什么意思怎么看是否已经开启了...
我怎么看iptables是否开启呢 linux操作系统 在网上查的是chkconfig iptables --list 可打印出来的 iptables 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭 这些是什么意思
怎么看是否已经开启了呢 还有其他命令么 多谢
展开
详细步骤如下:
1、打开Linux系统进入桌面,点击上方菜单栏处【系统】选项;
2、在弹出的菜单栏中,依次点击【管理】,【防火墙】选项;
3、进入防火墙界面,输入用户密码,进行安全验证;
4、连接服务器后,输入语句‘service iptables status’,回车,会显示防火墙状态;
5、输入语句‘chkconfig iptables on’,可以开启防火墙。或者使用语句‘chkconfig iptables off’,关闭防火墙,需要重启后生效。