现在的位置: 首页 > 综合 > 正文

开启关闭Linux防火墙

2014年10月21日 ⁄ 综合 ⁄ 共 2377字 ⁄ 字号 评论关闭

 默认安装linux后(防火墙是开启状态),此时防火墙没有开放1521端口,使得Oracle的客户端无法连接服务器。此时或者关闭防火墙,或者设置防火墙开放1521端口。

1.检查iptables的状态

使用命令 service iptables status 

[root@pcmxexweb ~]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0           
 
Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    RH-Firewall-1-INPUT  all  --  0.0.0.0/0            0.0.0.0/0           
 
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         
 
Chain RH
-Firewall-1-INPUT (2 references)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           icmp type 255 
3    ACCEPT     esp  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     ah   --  0.0.0.0/0            0.0.0.0/0           
5    ACCEPT     udp  --  0.0.0.0/0            224.0.0.251         udp dpt:5353 
6    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0           udp dpt:631 
7    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:631 
8    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
9    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22 
10   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:23 
11   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80 
12   ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443 
13   REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited 

#说明防火墙当前是开启状态,并开放了22,23,80,443端口

2.关闭防火墙

使用命令 service iptables stop

[root@pcmxexweb ~]# service iptables stop
清除防火墙规则:                                           [确定]
把 chains 设置为 ACCEPT 策略:filter                       [确定]
正在卸载 Iiptables 模块:                                  [确定]

3.开启防火墙

使用命令 service iptables start 

[root@pcmxexweb ~]# service iptables start
应用 iptables 防火墙规则:                                 [确定]
载入额外 iptables 模块:ip_conntrack_netbios_ns            [确定]

 4.设置开机启动防火墙

使用命令 ntsysv

[root@pcmxexweb ~]# ntsysv

 

将会出现图形界面,在其中选中iptables。确认。

5.简单配置防火墙规则

 

[root@pcmxexweb ~]# setup

选择 防火墙配置--》定制--》在“其他端口”中输入要开放的端口 如:1521

抱歉!评论已关闭.