สมัครสมาชิก เข้าสู่ระบบ
n/vps · 2024-07-07 · แก้ไขแล้ว · เข้าชม 527 ครั้ง
u/James💯ตำนาน
n/vpsu/James · 2024-07-07

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

0
12
เข้าสู่ระบบเพื่อร่วมพูดคุย

12 การตอบกลับ

การเรียงลำดับ
  1. James 💯 ตำนาน เจ้าของกระทู้ ผู้จัดการ 2024-07-07

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

    0
  2. james01 เงิน 2024-07-08

    不错,顶下!

    0
  3. fsai เงิน 2024-07-08

    @"James"#p43148
    开的 NAT,IPV6 小鸡,这个配置是必须的还是可选的?

    0
  4. zhiwenwang เงิน 2024-07-08

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

    0
  5. newbeeplus8910 ทอง ไม่ทอดทิ้งกัน 2024-07-08

    好文当顶

    0
  6. huxubo เพชร 2024-07-08

    学习了。。。

    0
  7. yixunn ทอง 2 ปี 2024-07-08

    学习一下

    0
  8. lsytt เงิน 2024-10-05

    [upl-image-preview url=https://www.nodeloc.com/uploads/default/2024-10-04/1728056378-603573-pveip.png]
    @James
    请问只要ipv6小鸡的话 网关怎么填
    ip是填2a01:4f9:1a:bb6f::2/64吗

    0
  9. James 💯 ตำนาน เจ้าของกระทู้ ผู้จัดการ 2024-10-05

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

    0
  10. lsytt เงิน 2024-10-09

    @"James"#p104239 [upl-image-preview url=https://www.nodeloc.com/uploads/default/2024-10-09/1728458660-430753-pveip3.png]
    设定好了
    ping google.com可以通 ssh也连得上
    但是ping 8.8.8.8无法ping通

    0
  11. James 💯 ตำนาน เจ้าของกระทู้ ผู้จัดการ 2024-10-11

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

    0
  12. lsytt เงิน 2024-10-12

    .

    0