考虑我有一台带有公共网络的无业游民的机器。
ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::af55:3360:45cc:13ea prefixlen 64 scopeid 0x20<link>
ether 08:00:27:37:f8:46 txqueuelen 1000 (Ethernet)
RX packets 12596 bytes 4067678 (3.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7706 bytes 4041830 (3.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.100.1.27 netmask 255.255.255.0 broadcast 192.100.1.255
inet6 fe80::a00:27ff:fe40:a0d0 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:40:a0:d0 txqueuelen 1000 (Ethernet)
RX packets 20 bytes 6840 (6.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19 bytes 2550 (2.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我想将ipv6 ip添加到公共网络接口。这在流浪汉中有可能吗?
最终预期配置:
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1450
inet 192.100.1.27 netmask 255.255.255.0 broadcast 192.100.1.255
inet6 fe80::6f09:6698:1cc8:acab prefixlen 64 scopeid 0x20<link>
inet6 2a00:81c0:6001:141::a prefixlen 64 scopeid 0x0<global>
ether fa:16:3e:19:aa:f4 txqueuelen 1000 (Ethernet)
RX packets 1053729 bytes 358588297 (341.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 272053 bytes 62702710 (59.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
答案 0 :(得分:1)
我找不到可以设置的配置来实现此目的。因此,我创建了一个脚本,该脚本在vagrant设置期间运行,该脚本使用nmcli
将ip添加到接口中。我不确定这是否是最好的方法,但是它有效。
echo "Setting network config for this node"
nmcli con add type ethernet ifname enp0s8 con-name public
nmcli con modify public ipv4.method manual +ipv4.addresses 192.100.1.27
nmcli con modify public connection.autoconnect "yes"
nmcli con modify public +802-3-ethernet.mtu 1450
nmcli con modify public ipv6.method manual +ipv6.addresses 2a00:81c0:6001:141::a/64
nmcli con up public
我必须将其添加到Vagrantfile中。
c.vm.provision :shell, path: "path_to_script"