RHEL:無法使用 ipset 實用程式並出現錯誤:無法開啟與核心的會話

RHEL:無法使用 ipset 實用程式並出現錯誤:無法開啟與核心的會話

我使用的是 VPS 供應商提供的 VPS,該 VPS 運行 2.6 核心、帶有 OpenVZ 虛擬化系統的 RHEL。我想使用 ipset 實用程式來管理 iptables 防火牆上的 IP 集。

這是我在創建 ipset 時遇到的錯誤:

mindaugas@517713:~$ sudo ipset create cf_ipv4 hash:net 
ipset v6.20.1: Cannot open session to kernel.

命令的追蹤:https://p.defau.lt/?NwzyZkxR_VgekwCRr6YlWg

問題:是否可以透過這些選項在此類機器上使用 ipset?如果是這樣-我該怎麼做?

安裝輸出:

mindaugas@517713:~$ mount
/dev/simfs on / type simfs (rw,relatime,usrquota,grpquota)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
none on /dev type devtmpfs (rw,nosuid,noexec,relatime,mode=755)
none on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/cgroup type tmpfs (rw,relatime,size=4k,mode=755)
none on /run type tmpfs (rw,nosuid,noexec,relatime,size=275252k,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
none on /run/shm type tmpfs (rw,relatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,relatime,size=102400k,mode=755)

以下是相關資訊:

mindaugas@517713:~$ uname -r
2.6.32-042stab120.3

mindaugas@517713:~$ sudo rpm -qa
vzkernel-headers-2.6.32-042stab120.3.x86_64

mindaugas@517713:~$ ipset --help
ipset v6.20.1
Usage: ipset [options] COMMAND

mindaugas@517713:~$ sudo apt-get install xtables-addons-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
xtables-addons-common is already the newest version.
The following packages were automatically installed and are no longer required:
  dmsetup grub-common grub-gfxpayload-lists grub-pc grub-pc-bin grub2-common
  libdevmapper1.02.1 libfuse2
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

因此,您實際上並沒有使用 RHEL 核心(您使用的事實apt-get讓我想知道它是否是 RHEL),而是 OpenVZ 容器。 OpenVZ 容器依賴託管系統核心提供的功能,在這種情況下不支援 ipset。您可以在容器中安裝任何東西來使 OpenVZ 託管環境支援它,您需要與您的託管提供者聯繫以建立具有 iptables/ipset 支援的核心。

相關內容