如何在 OpenBSD 上禁用 IPv6?

如何在 OpenBSD 上禁用 IPv6?

我确信在我的网络中我不会只使用 IPv6 IPv4。所以根据亲吻原则我需要禁用它。我该怎么做?操作系统是OpenBSD 5.1。

答案1

 -inet6          Disable inet6(4) on the given interface and remove all
                 configured inet6(4) addresses, including the link-local
                 ones.  To turn it on again, assign any inet6 address or
                 run rtsol(8).

这个 if 来自 `man ifconfig'。

 family      Specify which type of Internet protocol family to prefer, if
             a host is reachable using different address families.  By
             default IPv4 addresses are queried first, and then IPv6
             addresses.  The syntax is:

                   family family1 [family2]

             A maximum of two families can be specified, where family can
             be any of:

                   inet4     IPv4 queries.
                   inet6     IPv6 queries.

这是来自“man resolv.conf”

定制内核不是 OpenBSD 的出路!永远不要寻求有关自定义内核的帮助,无论如何你都不了解技术细节:)

答案2

您必须构建一个缺少 INET6 选项的自定义内核。但 OpenBSD 维护者似乎建议不要这样做

答案3

如何在 OpenBSD 上禁用 IPv6?

# uname -a
OpenBSD cacti-i386.my.domain 5.0 GENERIC.MP#59 i386

1)。步

# ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 33196
        priority: 0
        groups: lo
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet 127.0.0.1 netmask 0xff000000
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        lladdr xx:xx:xx:xx:xx:xx
        priority: 0
        groups: egress
        media: Ethernet autoselect (1000baseT full-duplex,master)
        status: active
        inet 10.0.0.100 netmask 0xffffff00 broadcast 10.0.0.255
        inet6 fe80::20c:29ff:fe35:b831%em0 prefixlen 64 scopeid 0x1
enc0: flags=0<>
        priority: 0
        groups: enc
        status: active
pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33196
        priority: 0
        groups: pflog

2)。步

# ifconfig em0 inet6 fe80::20c:29ff:fe35:b831  delete

3)。步骤编辑 /etc/rc.local 添加此行

# vi /etc/rc.local
#       $OpenBSD: rc.local,v 1.44 2011/04/22 06:08:14 ajacoutot Exp $

# Site-specific startup actions, daemons, and other things which
# can be done AFTER your system goes into securemode.  For actions
# which should be done BEFORE your system has gone into securemode
# please see /etc/rc.securelevel.

ifconfig em0 inet6 fe80::20c:29ff:fe35:b831  delete

相关内容