• 本帖最后由 eqblog 于 2018-10-3 15:27 编辑 *

结果谷歌一系列的查找资料,最后还是到了hetzner的wiki找到了解决办法。

另外如果配置完成后,在小鸡仍然出现ping不通ipv6的情况请执行以下步骤:
在/etc/sysctl.conf中添加:net.ipv6.conf.all.proxy_ndp=1
然后执行sysctl -p
关闭ip6tables等操作

1.proxmox桥接网卡配置:

  • # /etc/network/interfaces
  • ### Hetzner Online GmbH - installimage
  • # Loopback device:
  • auto lo
  • iface lo inet loopback
  • #
  • # device: eth0
  • auto eth0
  • iface eth0 inet static
  • address
  • netmask 255.255.255.255
  • pointopoint
  • gateway
  • #
  • iface eth0 inet6 static
  • address #eg: 2001:db8::2
  • netmask 128
  • gateway fe80::1
  • up sysctl -p
  • # for single IPs
  • auto vmbr0
  • iface vmbr0 inet static
  • address 10.0.1.1
  • netmask 255.255.255.0
  • bridge_ports none
  • bridge_stp off
  • bridge_fd 0
  • #
  • iface vmbr0 inet6 static
  • address #eg: 2001:db8::2
  • netmask 64
  • 复制代码

关于Nat链接网络请使用iptables实现。

solusvm下网卡配置:
主网卡中默认配置请不要修改,仅需将IPV6ADDR的/64换为/128
例如:IPV6ADDR= 2001:db8::2/128
然后将桥接网卡更改为:

  • - DEVICE=br0
  • ONBOOT=yes
  • TYPE=Bridge
  • BOOTPROTO=static
  • IPADDR=10.0.1.1
  • NETMASK=255.255.255.0
  • IPV6ADDR=2001:db8::2/64复制代码

关于联网与端口映射请使用iptables

关于虚拟机(kvm)的配置:
这里拿2001:db8::此ipv6做示范
Debian or Ubuntu:
iface eth0 inet6 static
address 2001:db8::f001
netmask 64
gateway 2001:db8::2

Centos:

IPV6INIT=yes
IPV6ADDR=2001:db8::f001/64
IPV6_DEFAULTGW=2001:db8::2

发表自我的小博客:https://eqblog.com/hetzner-proxmox-solusvm-nat-kvm-ipv6.html

关于iptables的设置:
端口映射:
iptables -t nat -A PREROUTING -d main_ip -p tcp -m tcp --dport ssh_port -j DNAT --to-destination user_ip:22
main_ip为你公网Ip ssh_port为公网映射端口 user_ip为你nat分配的IP
联网:
iptables -t nat -A POSTROUTING -s 10.0.1.0/24 -j SNAT --to-source main_ip
10.0.1.0/24为你分配的内网IP段 main_ip为公网IP