詳細解析RHEL 5防火牆的設定

來源:互聯網
上載者:User

眾所周知防火牆是電腦的安全性的重要保障,所以在RHEL 5防火牆的設定中也很很要,也正是因為它很重要所以在這裡要對這個重要而又繁瑣的RHEL 5防火牆設定進行一下詳細的描述。

在RHEL5.2上安裝好了Oracle,可以開始進行Oracle練習了。由於我的RHEL是安裝在虛擬機器上的,總在虛擬機器裡操作終歸不是那麼方便並且響應速度也較慢。好在Oracle 10g裡已經有了B/S的管理介面,那麼在VM的Host上操作豈不是簡單、快捷!虛擬機器(VM)IP:10.10.10.197,虛擬機器主機(HOST)IP:10.10.10.198,橋接方式Bridged)串連。可當我在瀏覽器地址欄輸入地址http://10.10.10.197:1158/em時,卻提示“Firefox  無法建立到 10.10.10.197:1158 伺服器的串連”。可在VM中卻執行得很強大,在10.10.10.198上Ping 10.10.10.197也沒問題。開始尋找解決辦法。從System->Administration->Security Level and Firewall】進入。RHEL 5防火牆是Enabled狀態。可Trusted Services裡卻明明有WWW(HTTP)服務,為何還是不行呢?

安全及防火牆菜單)

防火牆狀態及設定)

再從System->Administration->Server Settings->Services】查看服務,找到一個名為iptables的服務,原來它就是防火牆服務。

防火牆服務)

有停止,和在Windows下的Services一樣,那麼Stop掉。在10.10.10.198上重新整理http://10.10.10.197:1158/em。一切盡在預料之中,介面出來了!看來還是防火牆配置的問題。在網路上搜尋了一下,可以進行如下配置參考:http://linux.ccidnet.com/art/9513/20070601/1098119_1.html):

1. 查看RHEL 5防火牆現有配置
[root@RHEL ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source   destination
RH-Firewall-1-INPUT  all  --  0.0.0.0/00.0.0.0/0 
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   tcp dpt:1158
Chain FORWARD (policy ACCEPT)
target prot opt source   destination
RH-Firewall-1-INPUT  all  --  0.0.0.0/00.0.0.0/0 
Chain OUTPUT (policy ACCEPT)
target prot opt source   destination
Chain RH-Firewall-1-INPUT (2 references)
target prot opt source   destination
ACCEPT all  --  0.0.0.0/00.0.0.0/0 
ACCEPT icmp --  0.0.0.0/00.0.0.0/0   icmp type 255
ACCEPT esp  --  0.0.0.0/00.0.0.0/0 
ACCEPT ah   --  0.0.0.0/00.0.0.0/0 
ACCEPT udp  --  0.0.0.0/0224.0.0.251 udp dpt:5353
ACCEPT udp  --  0.0.0.0/00.0.0.0/0   udp dpt:631
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   tcp dpt:631
ACCEPT all  --  0.0.0.0/00.0.0.0/0   state RELATED,ESTABLISHED
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   state NEW tcp dpt:21
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   state NEW tcp dpt:22
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   state NEW tcp dpt:443
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   state NEW tcp dpt:23
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   state NEW tcp dpt:80
REJECT all  --  0.0.0.0/00.0.0.0/0   reject-with icmp-host-prohibited

2.清除RHEL 5防火牆配置
[root@RHEL ~]# iptables -F
[root@RHEL ~]# iptables -X
[root@RHEL ~]# /etc/rc.d/init.d/iptables save
Saving firewall rules to /etc/sysconfig/iptables:  [  OK  ]
[root@RHEL ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source   destination
Chain FORWARD (policy ACCEPT)
target prot opt source   destination
Chain OUTPUT (policy ACCEPT)
target prot opt source   destination

3.添加RHEL 5防火牆配置
將特定的連接埠添加到允許清單。比如EM使用的1158、telnet使用的23和Litener使用的1521等。
[root@RHEL ~]# iptables -A INPUT -p tcp --dport 1158 -j ACCEPT
[root@RHEL ~]# iptables -A INPUT -p tcp --dport 23 -j ACCEPT
[root@RHEL ~]# iptables -A INPUT -p tcp --dport 1521 -j ACCEPT

儲存配置:
[root@RHEL ~]# /etc/rc.d/init.d/iptables save
Saving firewall rules to /etc/sysconfig/iptables:  [  OK  ]

查看一下當前配置:
[root@RHEL ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source   destination
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   tcp dpt:1158
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   tcp dpt:23
ACCEPT tcp  --  0.0.0.0/00.0.0.0/0   tcp dpt:1521
Chain FORWARD (policy ACCEPT)
target prot opt source   destination
Chain OUTPUT (policy ACCEPT)
target prot opt source   destination  

重啟一下防火牆服務:
[root@RHEL ~]# service iptables restart
Flushing firewall rules:   [  OK  ]
Setting chains to policy ACCEPT: nat filter[  OK  ]
Unloading iptables modules:[  OK  ]
Applying iptables firewall rules:  [  OK  ]
Loading additional iptables modules: ip_conntrack_netbios_n[  OK  ]ntrack_ftp
經過如此配置,在10.10.10.198上訪問EM正常,使用PL/SQL Developer等也能正常串連。

其實如果仔細的跟住步驟來,應該還是比較容易掌握RHEL 5防火牆設定的,以上就是筆者對於RHEL 5防火牆設定的總結,希望可以協助到大家對於RHEL 5防火牆的使用。

  1. 設定ORACLE11g隨RHELRHEL 5下Samba伺服器的搭建
  2. RHELRHEL搭建FTP伺服器步驟和問題解析(1)
  3. RHELRHEL 5搭建FTP的完美組合
  4. 問題解析:這樣使用RHELRHEL 4上配置Postfix的完美4步
  5. RHEL架設RHEL4系統Sendmail的七大步驟

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.