![KVM 虚拟机自动分配 IPv6 - centos](https://linux22.com/image/749576/KVM%20%E8%99%9A%E6%8B%9F%E6%9C%BA%E8%87%AA%E5%8A%A8%E5%88%86%E9%85%8D%20IPv6%20-%20centos.png)
目前,我的节点上有 KVM VM,并且启用了 ipv6。我想手动将 ipv6 分配给 VM,但是我发现启动 VM 时似乎会自动为其分配 IPv6(我的 /64 子网中的随机 IP)。我不想这样。我遇到了无法重新启动网络的额外麻烦,因为这将需要重新启动 VM。有什么想法可以解决这个问题吗?
这是其中一个虚拟机中 /sbin/ifconfig -a 的输出示例
[root@thisisanothertestvps ~]# /sbin/ifconfig -a
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet xxx.xxx.xxx.xxx netmask 255.255.255.224 broadcast xxx.xxx.xxx.xxx
inet6 2001:1b40:xx:xx:xx:xx:xx:xx prefixlen 64 scopeid 0x0<global> <---- this one
inet6 2001:1b40:xx:xx::10 prefixlen 64 scopeid 0x0<global> <---- this one was assigned manually
inet6 fe80::216:3eff:fe20:e46f prefixlen 64 scopeid 0x20<link>
ether 00:16:3e:20:e4:6f txqueuelen 1000 (Ethernet)
RX packets 89 bytes 10309 (10.0 KiB)
RX errors 0 dropped 15 overruns 0 frame 0
TX packets 77 bytes 10553 (10.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
VM 使用主机节点上的接口 viifbr0,它是来自 eth0 的桥。我认为要阻止这种情况发生,我需要禁用 slaac,但我不知道该怎么做。
谢谢你!
编辑:
这是我的 /etc/sysctl.conf 文件
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.eth0.forwarding = 1
net.ipv6.conf.viifbr0.forwarding = 1
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.all.accept_ra=0
net.ipv6.conf.eth0.accept_ra=0
net.ipv6.conf.viifbr0.accept_ra=0
这是“sysctl -a | grep ipv6”的输出,被截断为可接受的长度
sysctl: reading key "net.ipv6.conf.all.stable_secret"
net.ipv6.anycast_src_echo_reply = 0
net.ipv6.bindv6only = 0
net.ipv6.conf.all.accept_dad = 0
net.ipv6.conf.all.accept_ra = 0
net.ipv6.conf.all.accept_ra_defrtr = 1
net.ipv6.conf.all.accept_ra_pinfo = 1
net.ipv6.conf.all.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.all.accept_ra_rtr_pref = 1
net.ipv6.conf.all.accept_redirects = 1
net.ipv6.conf.all.accept_source_route = 0
net.ipv6.conf.all.autoconf = 0
net.ipv6.conf.all.dad_transmits = 1
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.all.enhanced_dad = 1
net.ipv6.conf.all.force_mld_version = 0
net.ipv6.conf.all.force_tllao = 0
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.all.hop_limit = 64
net.ipv6.conf.all.keep_addr_on_down = 0
net.ipv6.conf.all.max_addresses = 16
net.ipv6.conf.all.max_desync_factor = 600
net.ipv6.conf.all.mc_forwarding = 0
net.ipv6.conf.all.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.all.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.all.mtu = 1280
net.ipv6.conf.all.ndisc_notify = 0
net.ipv6.conf.all.optimistic_dad = 0
net.ipv6.conf.all.proxy_ndp = 0
net.ipv6.conf.all.regen_max_retry = 3
net.ipv6.conf.all.router_probe_interval = 60
net.ipv6.conf.all.router_solicitation_delay = 1
net.ipv6.conf.all.router_solicitation_interval = 4
net.ipv6.conf.all.router_solicitations = 1
sysctl: reading key "net.ipv6.conf.default.stable_secret"net.ipv6.conf.all.temp_prefered_lft = 86400
net.ipv6.conf.all.temp_valid_lft = 604800
net.ipv6.conf.all.use_optimistic = 0
net.ipv6.conf.all.use_tempaddr = 0
net.ipv6.conf.default.accept_dad = 1
net.ipv6.conf.default.accept_ra = 0
net.ipv6.conf.default.accept_ra_defrtr = 1
net.ipv6.conf.default.accept_ra_pinfo = 1
net.ipv6.conf.default.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.default.accept_ra_rtr_pref = 1
net.ipv6.conf.default.accept_redirects = 1
net.ipv6.conf.default.accept_source_route = 0
net.ipv6.conf.default.autoconf = 0
net.ipv6.conf.default.dad_transmits = 1
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.default.enhanced_dad = 1
net.ipv6.conf.default.force_mld_version = 0
net.ipv6.conf.default.force_tllao = 0
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.default.hop_limit = 64
net.ipv6.conf.default.keep_addr_on_down = 0
net.ipv6.conf.default.max_addresses = 16
net.ipv6.conf.default.max_desync_factor = 600
net.ipv6.conf.default.mc_forwarding = 0
net.ipv6.conf.default.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.default.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.default.mtu = 1280
net.ipv6.conf.default.ndisc_notify = 0
net.ipv6.conf.default.optimistic_dad = 0
net.ipv6.conf.default.proxy_ndp = 0
net.ipv6.conf.default.regen_max_retry = 3
net.ipv6.conf.default.router_probe_interval = 60
net.ipv6.conf.default.router_solicitation_delay = 1
net.ipv6.conf.default.router_solicitation_interval = 4
net.ipv6.conf.default.router_solicitations = 1
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
net.ipv6.conf.default.temp_prefered_lft = 86400
net.ipv6.conf.default.temp_valid_lft = 604800
net.ipv6.conf.default.use_optimistic = 0
net.ipv6.conf.default.use_tempaddr = 0
net.ipv6.conf.eth0.accept_dad = 1
net.ipv6.conf.eth0.accept_ra = 0
net.ipv6.conf.eth0.accept_ra_defrtr = 1
net.ipv6.conf.eth0.accept_ra_pinfo = 1
net.ipv6.conf.eth0.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.eth0.accept_ra_rtr_pref = 1
net.ipv6.conf.eth0.accept_redirects = 1
net.ipv6.conf.eth0.accept_source_route = 0
net.ipv6.conf.eth0.autoconf = 0
net.ipv6.conf.eth0.dad_transmits = 1
net.ipv6.conf.eth0.disable_ipv6 = 0
net.ipv6.conf.eth0.enhanced_dad = 1
net.ipv6.conf.eth0.force_mld_version = 0
net.ipv6.conf.eth0.force_tllao = 0
net.ipv6.conf.eth0.forwarding = 1
net.ipv6.conf.eth0.hop_limit = 64
net.ipv6.conf.eth0.keep_addr_on_down = 0
net.ipv6.conf.eth0.max_addresses = 16
net.ipv6.conf.eth0.max_desync_factor = 600
net.ipv6.conf.eth0.mc_forwarding = 0
net.ipv6.conf.eth0.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.eth0.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.eth0.mtu = 1500
net.ipv6.conf.eth0.ndisc_notify = 0
net.ipv6.conf.eth0.optimistic_dad = 0
net.ipv6.conf.eth0.proxy_ndp = 0
net.ipv6.conf.eth0.regen_max_retry = 3
net.ipv6.conf.eth0.router_probe_interval = 60
net.ipv6.conf.eth0.router_solicitation_delay = 1
net.ipv6.conf.eth0.router_solicitation_interval = 4
net.ipv6.conf.eth0.router_solicitations = 1
sysctl: reading key "net.ipv6.conf.eth1.stable_secret"net.ipv6.conf.eth0.temp_prefered_lft = 86400
net.ipv6.conf.eth0.temp_valid_lft = 604800
net.ipv6.conf.eth0.use_optimistic = 0
net.ipv6.conf.eth0.use_tempaddr = 0
net.ipv6.conf.eth1.accept_dad = 1
net.ipv6.conf.eth1.accept_ra = 1
net.ipv6.conf.eth1.accept_ra_defrtr = 0
net.ipv6.conf.eth1.accept_ra_pinfo = 0
net.ipv6.conf.eth1.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.eth1.accept_ra_rtr_pref = 0
net.ipv6.conf.eth1.accept_redirects = 1
net.ipv6.conf.eth1.accept_source_route = 0
net.ipv6.conf.eth1.autoconf = 1
net.ipv6.conf.eth1.dad_transmits = 1
net.ipv6.conf.eth1.disable_ipv6 = 0
net.ipv6.conf.eth1.enhanced_dad = 1
net.ipv6.conf.eth1.force_mld_version = 0
net.ipv6.conf.eth1.force_tllao = 0
net.ipv6.conf.eth1.forwarding = 1
net.ipv6.conf.eth1.hop_limit = 64
net.ipv6.conf.eth1.keep_addr_on_down = 0
net.ipv6.conf.eth1.max_addresses = 16
net.ipv6.conf.eth1.max_desync_factor = 600
net.ipv6.conf.eth1.mc_forwarding = 0
net.ipv6.conf.eth1.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.eth1.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.eth1.mtu = 1500
net.ipv6.conf.eth1.ndisc_notify = 0
net.ipv6.conf.eth1.optimistic_dad = 0
net.ipv6.conf.eth1.proxy_ndp = 0
net.ipv6.conf.eth1.regen_max_retry = 3
net.ipv6.conf.eth1.router_probe_interval = 60
net.ipv6.conf.eth1.router_solicitation_delay = 1
net.ipv6.conf.eth1.router_solicitation_interval = 4
net.ipv6.conf.eth1.router_solicitations = 3
sysctl: reading key "net.ipv6.conf.eth2.stable_secret"
net.ipv6.conf.eth1.temp_prefered_lft = 86400
net.ipv6.conf.eth1.temp_valid_lft = 604800
net.ipv6.conf.eth1.use_optimistic = 0
net.ipv6.conf.eth1.use_tempaddr = 0
net.ipv6.conf.eth2.accept_dad = 1
net.ipv6.conf.eth2.accept_ra = 1
net.ipv6.conf.eth2.accept_ra_defrtr = 0
net.ipv6.conf.eth2.accept_ra_pinfo = 0
net.ipv6.conf.eth2.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.eth2.accept_ra_rtr_pref = 0
net.ipv6.conf.eth2.accept_redirects = 1
net.ipv6.conf.eth2.accept_source_route = 0
net.ipv6.conf.eth2.autoconf = 1
net.ipv6.conf.eth2.dad_transmits = 1
net.ipv6.conf.eth2.disable_ipv6 = 0
net.ipv6.conf.eth2.enhanced_dad = 1
net.ipv6.conf.eth2.force_mld_version = 0
net.ipv6.conf.eth2.force_tllao = 0
net.ipv6.conf.eth2.forwarding = 1
net.ipv6.conf.eth2.hop_limit = 64
net.ipv6.conf.eth2.keep_addr_on_down = 0
net.ipv6.conf.eth2.max_addresses = 16
net.ipv6.conf.eth2.max_desync_factor = 600
net.ipv6.conf.eth2.mc_forwarding = 0
net.ipv6.conf.eth2.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.eth2.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.eth2.mtu = 1500
net.ipv6.conf.eth2.ndisc_notify = 0
net.ipv6.conf.eth2.optimistic_dad = 0
net.ipv6.conf.eth2.proxy_ndp = 0
net.ipv6.conf.eth2.regen_max_retry = 3
net.ipv6.conf.eth2.router_probe_interval = 60
net.ipv6.conf.eth2.router_solicitation_delay = 1
net.ipv6.conf.eth2.router_solicitation_interval = 4
net.ipv6.conf.eth2.router_solicitations = 3
sysctl: reading key "net.ipv6.conf.eth3.stable_secret"
net.ipv6.conf.eth2.temp_prefered_lft = 86400
net.ipv6.conf.eth2.temp_valid_lft = 604800
net.ipv6.conf.eth2.use_optimistic = 0
net.ipv6.conf.eth2.use_tempaddr = 0
net.ipv6.conf.eth3.accept_dad = 1
net.ipv6.conf.eth3.accept_ra = 1
net.ipv6.conf.eth3.accept_ra_defrtr = 0
net.ipv6.conf.eth3.accept_ra_pinfo = 0
net.ipv6.conf.eth3.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.eth3.accept_ra_rtr_pref = 0
net.ipv6.conf.eth3.accept_redirects = 1
net.ipv6.conf.eth3.accept_source_route = 0
net.ipv6.conf.eth3.autoconf = 1
net.ipv6.conf.eth3.dad_transmits = 1
net.ipv6.conf.eth3.disable_ipv6 = 0
net.ipv6.conf.eth3.enhanced_dad = 1
net.ipv6.conf.eth3.force_mld_version = 0
net.ipv6.conf.eth3.force_tllao = 0
net.ipv6.conf.eth3.forwarding = 1
net.ipv6.conf.eth3.hop_limit = 64
net.ipv6.conf.eth3.keep_addr_on_down = 0
net.ipv6.conf.eth3.max_addresses = 16
net.ipv6.conf.eth3.max_desync_factor = 600
net.ipv6.conf.eth3.mc_forwarding = 0
net.ipv6.conf.eth3.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.eth3.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.eth3.mtu = 1500
net.ipv6.conf.eth3.ndisc_notify = 0
net.ipv6.conf.eth3.optimistic_dad = 0
net.ipv6.conf.eth3.proxy_ndp = 0
net.ipv6.conf.eth3.regen_max_retry = 3
net.ipv6.conf.eth3.router_probe_interval = 60
net.ipv6.conf.eth3.router_solicitation_delay = 1
net.ipv6.conf.eth3.router_solicitation_interval = 4
net.ipv6.conf.eth3.router_solicitations = 3
sysctl: reading key "net.ipv6.conf.lo.stable_secret"net.ipv6.conf.eth3.temp_prefered_lft = 86400
net.ipv6.conf.eth3.temp_valid_lft = 604800
net.ipv6.conf.eth3.use_optimistic = 0
net.ipv6.conf.eth3.use_tempaddr = 0
net.ipv6.conf.lo.accept_dad = -1
net.ipv6.conf.lo.accept_ra = 0
net.ipv6.conf.lo.accept_ra_defrtr = 1
net.ipv6.conf.lo.accept_ra_pinfo = 1
net.ipv6.conf.lo.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.lo.accept_ra_rtr_pref = 1
net.ipv6.conf.lo.accept_redirects = 1
net.ipv6.conf.lo.accept_source_route = 0
net.ipv6.conf.lo.autoconf = 0
net.ipv6.conf.lo.dad_transmits = 1
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.lo.enhanced_dad = 1
net.ipv6.conf.lo.force_mld_version = 0
net.ipv6.conf.lo.force_tllao = 0
net.ipv6.conf.lo.forwarding = 1
net.ipv6.conf.lo.hop_limit = 64
net.ipv6.conf.lo.keep_addr_on_down = 0
net.ipv6.conf.lo.max_addresses = 16
net.ipv6.conf.lo.max_desync_factor = 600
net.ipv6.conf.lo.mc_forwarding = 0
net.ipv6.conf.lo.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.lo.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.lo.mtu = 65536
net.ipv6.conf.lo.ndisc_notify = 0
net.ipv6.conf.lo.optimistic_dad = 0
net.ipv6.conf.lo.proxy_ndp = 0
net.ipv6.conf.lo.regen_max_retry = 3
net.ipv6.conf.lo.router_probe_interval = 60
net.ipv6.conf.lo.router_solicitation_delay = 1
net.ipv6.conf.lo.router_solicitation_interval = 4
net.ipv6.conf.lo.router_solicitations = 3
sysctl: reading key "net.ipv6.conf.viifbr0.stable_secret"
net.ipv6.conf.lo.temp_prefered_lft = 86400
net.ipv6.conf.lo.temp_valid_lft = 604800
net.ipv6.conf.lo.use_optimistic = 0
net.ipv6.conf.lo.use_tempaddr = -1
net.ipv6.conf.viifbr0.accept_dad = 1
net.ipv6.conf.viifbr0.accept_ra = 0
net.ipv6.conf.viifbr0.accept_ra_defrtr = 1
net.ipv6.conf.viifbr0.accept_ra_pinfo = 1
net.ipv6.conf.viifbr0.accept_ra_rt_info_max_plen = 0
net.ipv6.conf.viifbr0.accept_ra_rtr_pref = 1
net.ipv6.conf.viifbr0.accept_redirects = 1
net.ipv6.conf.viifbr0.accept_source_route = 0
net.ipv6.conf.viifbr0.autoconf = 0
net.ipv6.conf.viifbr0.dad_transmits = 1
net.ipv6.conf.viifbr0.disable_ipv6 = 0
net.ipv6.conf.viifbr0.enhanced_dad = 1
net.ipv6.conf.viifbr0.force_mld_version = 0
net.ipv6.conf.viifbr0.force_tllao = 0
net.ipv6.conf.viifbr0.forwarding = 1
net.ipv6.conf.viifbr0.hop_limit = 64
net.ipv6.conf.viifbr0.keep_addr_on_down = 0
net.ipv6.conf.viifbr0.max_addresses = 16
net.ipv6.conf.viifbr0.max_desync_factor = 600
net.ipv6.conf.viifbr0.mc_forwarding = 0
net.ipv6.conf.viifbr0.mldv1_unsolicited_report_interval = 10000
net.ipv6.conf.viifbr0.mldv2_unsolicited_report_interval = 1000
net.ipv6.conf.viifbr0.mtu = 1500
net.ipv6.conf.viifbr0.ndisc_notify = 0
net.ipv6.conf.viifbr0.optimistic_dad = 0
net.ipv6.conf.viifbr0.proxy_ndp = 0
net.ipv6.conf.viifbr0.regen_max_retry = 3
net.ipv6.conf.viifbr0.router_probe_interval = 60
net.ipv6.conf.viifbr0.router_solicitation_delay = 1
net.ipv6.conf.viifbr0.router_solicitation_interval = 4
net.ipv6.conf.viifbr0.router_solicitations = 1
希望这有帮助?