Hetzner 配置 NAT,IPV6 开小鸡

首先配置IP,修改 /etc/network/interfaces为如下

### Hetzner Online GmbH installimage

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback
iface lo inet6 loopback


auto enp7s0
iface enp7s0 inet static
  address 65.108.xxx.xx
  netmask 255.255.255.192
  gateway 65.108.xxx.xx
  # route 65.108.230.64/26 via 65.108.230.65
  up route add -net 65.108.230.64 netmask 255.255.255.192 gw 65.108.230.65 dev enp7s0

iface enp7s0 inet6 static
  address 2a01:4f9:1a:bb6f::192/128
  gateway fe80::1

# 配置 bridge 桥接
auto br-nat
iface br-nat inet static
        address 10.0.0.1
        netmask 255.255.255.0
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/24' -o enp7s0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o enp7s0 -j MASQUERADE

iface br-nat inet6 static
        address 2a01:4f9:1a:bb6f::1/64

配置转发,修改 /etc/sysctl.conf> 最后增加

net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1

修改完成后重启网络即可systemctl restart networking

[“Hetzner \u914d\u7f6e IPV6 \u5f00\u5c0f\u9e21”,“Hetzner \u914d\u7f6e NAT,IPV6 \u5f00\u5c0f\u9e21”]

不错,顶下!

@“James”#p43148

开的 NAT,IPV6 小鸡,这个配置是必须的还是可选的?


感谢老板,学习了.来自洪荒之尼古拉斯赵四的评论

好文当顶

学习了。。。

学习一下

[upl-image-preview url=https://s.rmimg.com/2024-10-04/1728056378-603573-pveip.png]

@James

请问只要ipv6小鸡的话 网关怎么填

ip是填2a01:4f9:1a:bb6f::2/64吗

@“lsytt”#p104105 我现在就是只要ipv6小鸡的

@“James”#p104239 [upl-image-preview url=https://s.rmimg.com/2024-10-09/1728458660-430753-pveip3.png]

设定好了

ping google.com可以通 ssh也连得上

但是ping 8.8.8.8无法ping通

@“lsytt”#p108384 这个我不懂啊,ping 域名可以ping通,ping ip怎么会ping不通。域名也是要解析成ip的啊。

.