
我對 iptables 非常熟悉,而且很iptables -L -v
容易閱讀。備份很容易,我對此感到滿意。
然而,在最新版本的 Ubuntu 中,ufw 嚴重污染了 iptables。除了清晰的規則清單之外,我還有很多不易閱讀的規則:
$ iptables -L -v
Chain INPUT (policy DROP 6114 packets, 331K bytes)
pkts bytes target prot opt in out source destination
131K 76M ufw-before-logging-input all -- any any anywhere anywhere
131K 76M ufw-before-input all -- any any anywhere anywhere
6618 368K ufw-after-input all -- any any anywhere anywhere
6191 346K ufw-after-logging-input all -- any any anywhere anywhere
6191 346K ufw-reject-input all -- any any anywhere anywhere
6191 346K ufw-track-input all -- any any anywhere anywhere
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
390K 324M ufw-before-logging-forward all -- any any anywhere anywhere
390K 324M ufw-before-forward all -- any any anywhere anywhere
4 2160 ufw-after-forward all -- any any anywhere anywhere
4 2160 ufw-after-logging-forward all -- any any anywhere anywhere
4 2160 ufw-reject-forward all -- any any anywhere anywhere
4 2160 ufw-track-forward all -- any any anywhere anywhere
Chain OUTPUT (policy ACCEPT 1 packets, 52 bytes)
pkts bytes target prot opt in out source destination
326K 317M ufw-before-logging-output all -- any any anywhere anywhere
326K 317M ufw-before-output all -- any any anywhere anywhere
164 14960 ufw-after-output all -- any any anywhere anywhere
164 14960 ufw-after-logging-output all -- any any anywhere anywhere
164 14960 ufw-reject-output all -- any any anywhere anywhere
164 14960 ufw-track-output all -- any any anywhere anywhere
...
從這個角度來說。我不太明白ufw的目的。它似乎比 iptables 增加了複雜性,但沒有真正的優勢。
我錯了嗎?
答案1
如果您知道iptables
,如果您發現iptables -L -v
它足夠容易閱讀並且您喜歡它,那麼您就不需要ufw
。
iptables
使用 Linux 核心中的資料包過濾規則表。您可以創建的表、鍊和規則構成了一個強大且靈活的工具,但通常令人生畏且不太直觀。有了它們,高級的事情是可能的,但基本的事情並不總是像新手用戶(或一般用戶)希望的那麼容易。
這裡輸入ufw
(或另一個類似的工具)作為iptables
.它使基本的事情變得簡單,但不一定允許高級的事情。任何喜歡 GUI 的人都可以使用gufw
. Ubuntu 之所以推出,ufw
是因為它的目標用戶可能對底層的工作原理不感興趣。他們想要一個類似於他們在 Windows 或家庭路由器的 HTTP 介面中看到的簡單介面。進階使用者可以「手動」停用ufw
和使用iptables
。
目的ufw
是有一個簡單的前端。對一般人來說,這個前端是更簡單比您可以在iptables
.實際上創建的“大量不易閱讀的規則”ufw
現在是後端。你是對的,ufw
這增加了複雜性,但喬從來沒有看到它。
一旦您決定使用ufw
(或繼續使用它,如果它預設存在),您就不應該關心後端。將後端視為提供前端的工具的內部部分。
如果你想iptables
成為你的前端,那麼就不要使用ufw
,因為ufw
它會將自己置於「更前面」。