Linux 添加链接本地地址

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9496531/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:54:37  来源:igfitidea点击:

Adding link local address

linuxnetworkinglinux-kernelipv6link-local

提问by Maddy

If the IPv6 link-local address is manually deleted on an interface, is there a way to obtain the link-local address back without bringing the interface down? The requirement stems from the need to hold onto (IPv4) existing connections on the interface, but also obtain the link-local address on it.

如果在接口上手动删除 IPv6 链路本地地址,是否有办法在不关闭接口的情况下获取链路本地地址?该要求源于需要保持接口上的 (IPv4) 现有连接,而且还需要获取其上的链路本地地址。

采纳答案by sleinen

GNU/Linux systems typically use "ip" (from the "iproute" package) to configure addresses. A link-local address would be added using something like

GNU/Linux 系统通常使用“ip”(来自“iproute”包)来配置地址。将使用类似的方法添加链接本地地址

ip address add dev eth4 scope link fe80::21b:21ff:febb:5db0/64

Did you try that?

你试过吗?

If your problem is that you don't know what exact address you should use as the link-local address: These addresses are typically derived from the hardware (MAC) address of the interface.

如果您的问题是您不知道应该使用哪个确切地址作为链接本地地址:这些地址通常来自接口的硬件 (MAC) 地址。

Take the MAC address of the interface (the "link/ether" field in the result of "ip link show dev ..."), and convert it to Modified EUI-64 according to this procedure.

获取接口的MAC地址(“ip link show dev ...”结果中的“link/ether”字段),并按照此过程将其转换为Modified EUI-64 。

Then add "fe80::" (standard link-local prefix) to the left and "/64" (as the subnet prefix length) to the right.

然后在左侧添加“fe80::”(标准链路本地前缀),在右侧添加“/64”(作为子网前缀长度)。