PVE设置IPv6虚拟机
侧边栏壁纸
  • 累计撰写 2 篇文章
  • 累计收到 1 条评论

PVE设置IPv6虚拟机

Vinny
2025-05-18 / 0 评论 / 3 阅读 / 正在检测是否收录...

网络重启 systemctl restart networking.service
dns echo "nameserver 2001:4860:4860::8888" | tee -a /etc/resolv.conf
改网卡 nano /etc/network/interfaces

配置v6

echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf && sysctl -p
apt -y install ndppd
nano /etc/ndppd.conf

proxy vmbr0 {
  rule 2001:41d0:x:xxxx::/64 {
    static
  }
}

systemctl restart ndppd.service
systemctl enable ndppd.service

网卡设置一

auto lo
iface lo inet loopback
auto vmbr0
iface vmbr0 inet static
    address 202.194.15.228/24
    gateway 202.194.15.254
    bridge_ports ens33
    bridge_stp off
    bridge_fd 0

iface vmbr0 inet6 static
    address 2001:da8:7000:15:20c:29ff:feff:e247/128
    gateway fe80::5298:b8ff:fed2:3001

auto vmbr1
iface vmbr1 inet static
    address 172.16.1.1/24
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up echo 1 > /proc/sys/net/ipv4/conf/vmbr1/proxy_arp
    post-up iptables -t nat -A POSTROUTING -s '172.16.1.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '172.16.1.0/24' -o vmbr0 -j MASQUERADE

iface vmbr1 inet6 static
    address 2001:db8:1::1/64
    post-up sysctl -w net.ipv6.conf.all.forwarding=1
    post-up ip6tables -t nat -A POSTROUTING -s 2001:db8:1::/64 -o vmbr0 -j MASQUERADE
    post-down sysctl -w net.ipv6.conf.all.forwarding=0
    post-down ip6tables -t nat -D POSTROUTING -s 2001:db8:1::/64 -o vmbr0 -j MASQUERADE

auto vmbr2
iface vmbr2 inet6 static
    address 2001:da8:7000:15:20c:29ff:feff:e247/64
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    # 虚拟机网关为母鸡v6地址

网卡设置二

auto lo
iface lo inet loopback

iface eth0 inet manual

auto vmbr0
iface vmbr0 inet static
    address xx.xx.xx.xx/24
    gateway xx.xx.xx.xx
    bridge-ports eth0
    bridge-stp off
    bridge-fd 0

iface vmbr0 inet6 static
        address 2001:41d0:x:xxxx::1/64
        gateway 2001:41d0:x:xxxx:ff:ff:ff:ff

auto vmbr1
iface vmbr1 inet static
        address 192.168.0.1
        netmask 255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
0

评论

博主关闭了所有页面的评论