进到

/etc/network/interfaces.d

新建eth0-addrs.cfg

nano eth0-addrs.cfg

写入对应IP

auto eth0:0
iface eth0:0 inet static
    address 1.1.1.1/32

auto eth0:1
iface eth0:1 inet static
    address 2.2.2.2/32

auto eth0:2
iface eth0:2 inet static
    address 3.3.3.3/32

auto eth0:3
iface eth0:3 inet static
    address 4.4.4.4/32

重启网络

systemctl restart networking

禁用IPV6

nano /etc/sysctl.conf
# 禁用所有 IPv6
net.ipv6.conf.all.disable_ipv6 = 1
# 禁用特定接口(如 eth0)的 IPv6,如果 eth0 是你的主网卡
# net.ipv6.conf.eth0.disable_ipv6 = 1
# 禁用默认接口的 IPv6
net.ipv6.conf.default.disable_ipv6 = 1
sysctl -p
最后修改:2025 年 08 月 21 日
如果觉得我的文章对你有用,请随意赞赏