使用NDPPD分配IPv6地址
本文最后更新于 307 天前,其中的信息可能已经有所发展或是发生改变。

前言

本文章没有使用原版ndppd,使用了其他版本 [1],因此理论上可以在KVM使用,仅在LXC(Proxmox VE)测试

vmbr0根据自己需求替换

网络配置

Debian

iface vmbr0 inet6 static
       address [宿主机想要的IPv6地址]/128
       post-up sleep 5; /sbin/ip -6 route add [宿主机网关] dev vmbr0
       post-up sleep 5; /sbin/ip -6 route add default via [宿主机网关]
       pre-down /sbin/ip -6 route del defatlt via [宿主机网关]
       pre-down /sbin/ip -6 route del [宿主机网关] dev vmbr0

iface vmbr1 inet6 static
   address [IPv6前缀::1]/64

e.g

示例的环境如下

# 以下IP和MAC均为瞎编
# ip -6 a s
49: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2a13:c007:8016:1145:14::/128 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:fe88:b5ba/64 scope link 
       valid_lft forever preferred_lft forever
50: vmbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2a13:c007:8016:1145:14::1/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::884e:74ff:fef9:c305/64 scope link 
       valid_lft forever preferred_lft forever

# ip -6 r

::1 dev lo proto kernel metric 256 pref medium
2a13:c007:8015::1 dev vmbr0 metric 1024 pref medium
2a13:c007:8016:1145:14:: dev vmbr0 proto kernel metric 256 pref medium
2a13:c007:8016:1145:14::/64 dev vmbr1 proto kernel metric 256 pref medium
fe80::/64 dev vmbr0 proto kernel metric 256 pref medium
fe80::/64 dev vmbr1 proto kernel metric 256 pref medium
default via 2a13:c007:8015::1 dev vmbr0 metric 1024 pref medium
iface vmbr0 inet6 static
       address 2a13:c007:8016:1145:14::/128
       post-up sysctl -w net.ipv6.conf.all.proxy_ndp=1
       post-up sysctl -w net.ipv6.conf.vmbr0.proxy_ndp=1
       post-up sysctl -w net.ipv6.conf.vmbr1.proxy_ndp=1
       post-up sysctl -w net.ipv6.conf.all.forwarding=1
       post-up /sbin/ip -6 route add 2a13:c007:8015::1 dev vmbr0
       post-up /sbin/ip -6 route add default via 2a13:c007:8015::1
       pre-down /sbin/ip -6 route del default via 2a13:c007:8015::1
       pre-down /sbin/ip -6 route del 2a13:c007:8015::1 dev vmbr0

iface vmbr1 inet6 static
   address 2a13:c007:8016:1145:14::1/64

NDPPD配置

./ndpresponder -i vmbr0 -n [IPv6前缀] 一句启动ndppd,可以自行使用守护程序来启动,下面示例一个systemd守护程序

e.g

./ndpresponder -i vmbr0 -n 2a13:c007:8016:1145:14::/64

Systemd

# /usr/lib/systemd/system/ndpresponder.service

[Unit]
Description=NDPPD Daemon
After=network.target

[Service]
ExecStart=/usr/bin/ndpresponder -i vmbr0 -n [IPv6前缀]
Restart=on-failure
RestartSec=2

[Install]
WantedBy=multi-user.target

启动虚拟机

e.g

参考文献

1、yoursunny/ndpresponder

2、https://yoursunny.com/t/2021/ndpresponder/

文件下载

暂无评论

发送评论 编辑评论


|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇