如何使用IPv6/64段内任意一个IPv6地址而非默认地址:修订间差异
来自md5.pw
更多语言
更多操作
创建页面,内容为“== 概述 == 本教程介绍如何在搬瓦工的 Linux 系统中通过配置虚拟网卡(v4tunnel),从分配的 IPv6 /64 段中自由指定并使用任意一个 IPv6 地址。 == 操作步骤 == === 1. 清理现有网络设备 === 在开始配置前,先尝试关闭并删除可能冲突的旧设备: <nowiki> ifdown ipv6net 2>/dev/null ip link delete ipv6net 2>/dev/null </nowiki> === 2. 修改网络配置文件 === 编辑网络配置文件 '''/e…” |
修正与补充 |
||
| 第5行: | 第5行: | ||
=== 1. 清理现有网络设备 === | === 1. 清理现有网络设备 === | ||
在开始配置前,先尝试关闭并删除可能冲突的旧设备: | 在开始配置前,先尝试关闭并删除可能冲突的旧设备:<syntaxhighlight>ifdown ipv6net 2>/dev/null | ||
ip link delete ipv6net 2>/dev/null</syntaxhighlight> | |||
=== 2. 修改网络配置文件 === | === 2. 修改网络配置文件 === | ||
编辑网络配置文件 | 编辑网络配置文件 <code>/etc/network/interfaces</code>,添加以下配置段。<syntaxhighlight> | ||
nano /etc/network/interfaces | nano /etc/network/interfaces | ||
</syntaxhighlight><syntaxhighlight>auto ipv6net | |||
iface ipv6net inet6 v4tunnel | iface ipv6net inet6 v4tunnel | ||
#输入你要指定的IPv6地址 | #输入你要指定的IPv6地址 | ||
| 第28行: | 第21行: | ||
ttl 255 | ttl 255 | ||
gateway 2607:8700:5501:xxxx::1 | gateway 2607:8700:5501:xxxx::1 | ||
mtu 1480 | mtu 1480</syntaxhighlight> | ||
=== 3. 启用并验证 === | === 3. 启用并验证 === | ||
执行以下命令启用网卡并检查状态: | 执行以下命令启用网卡并检查状态:<syntaxhighlight># 启动接口 | ||
ifup ipv6net | |||
# 查看接口状态 | |||
ip link show ipv6net | |||
# 验证 IPv6 | |||
curl -6 ifconfig.me</syntaxhighlight> | |||
=== 4. 关闭IPv6地址自动配置 === | |||
<syntaxhighlight> | |||
systemctl stop ipv6net.service | |||
systemctl disable ipv6net.service | |||
</syntaxhighlight> | |||
[[Category:300 VPS 设置与管理 — VPS Setup and Management]] | == 注意事项 == | ||
VPS在进行迁移或快照恢复的时候, 会重置<code>ipv6net</code>, 需要重新按照此教程进行配置 | |||
[[index.php?title=Category:300 VPS 设置与管理 — VPS Setup and Management]] | |||
2026年2月18日 (三) 07:53的版本
概述
本教程介绍如何在搬瓦工的 Linux 系统中通过配置虚拟网卡(v4tunnel),从分配的 IPv6 /64 段中自由指定并使用任意一个 IPv6 地址。
操作步骤
1. 清理现有网络设备
在开始配置前,先尝试关闭并删除可能冲突的旧设备:
ifdown ipv6net 2>/dev/null
ip link delete ipv6net 2>/dev/null2. 修改网络配置文件
编辑网络配置文件 /etc/network/interfaces,添加以下配置段。
nano /etc/network/interfacesauto ipv6net
iface ipv6net inet6 v4tunnel
#输入你要指定的IPv6地址
address 2607:8700:5501:xxxx:xxxx:xxxx:xxxx:xxxx
netmask 64
endpoint 207.246.106.118
#输入IPv4地址
local xxx.xxx.xxx.xxx
ttl 255
gateway 2607:8700:5501:xxxx::1
mtu 14803. 启用并验证
执行以下命令启用网卡并检查状态:
# 启动接口
ifup ipv6net
# 查看接口状态
ip link show ipv6net
# 验证 IPv6
curl -6 ifconfig.me4. 关闭IPv6地址自动配置
systemctl stop ipv6net.service
systemctl disable ipv6net.service注意事项
VPS在进行迁移或快照恢复的时候, 会重置ipv6net, 需要重新按照此教程进行配置
index.php?title=Category:300 VPS 设置与管理 — VPS Setup and Management