iptables提示unable to initialize table 'filter'解決辦法

來源:互聯網
上載者:User

部分執行yum update升級或自己編譯了Linux核心的系統,在完成升級以後,重啟或啟動iptables會出現“iptables-restore: unable to initialize table 'filter''”錯誤,中文翻譯是:iptables的恢複:無法初始化表“過濾器”。

詳細錯誤如下:


Applying iptables firewall rules: FATAL: Could not open 'kernel/net/ipv4/netfilter/ip_tables.ko': No such file or directoryiptables-restore v1.4.9: iptables-restore: unable to initialize table 'filter'Error occurred at line: 1Try `iptables-restore -h' or 'iptables-restore --help' for more information.

這個原因是可能在升級核心時,同時升級了iptables的系統模組,最新的模組未被載入,所以我們可以嘗試以下方法解決。


一、嘗試直接載入模組
modprobe ip_tablesmodprobe iptable_filter

手動載入 ip_tables 和 iptables_filter模組,若沒提示錯誤,表示模組載入沒問題,直接嘗試iptables重啟即可。

若提示以下錯誤(如)請嘗試第二步操作:


二、檢查當前核心中是否有iptables相關模組
ls -al /lib/modules/`uname -r`/kernel/net/ipv4/netfilter

SSH執行以上命令,並輸出以下結果

如果在輸出的結果中擁有以上兩個紅色框線所示內容,則表示系統中有相關模組,但可能沒被載入,需要手動載入。如果沒有框線所示內容,請嘗試重新編譯核心。


depmod -a

載入完畢後,再進行一次模組載入


modprobe ip_tablesmodprobe iptable_filter

SSH執行以上命令,重新分析並載入模組,執行完畢,嘗試啟動iptables,如則表示啟動成功。


三、附一個核心重編譯方法
cd /usr/src/linux    #進入源碼目錄make install         #進行安裝操作

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.