全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 1066|回复: 7
打印 上一主题 下一主题

麻了,hetzner pve nat4+公网6一直配置不好

[复制链接]
跳转到指定楼层
1#
发表于 2022-4-8 14:01:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式



我人都傻了


按照这个弄https://mjj.022333.xyz/thread-891159-1-1.html,只有ipv4,ipv6是不通的


还有这个https://blog.csdn.net/jsdtwyk/article/details/89061758,也不行,win鸡可以连进RDP,但是小鸡里没网,v4v6都没网,不知道要改什么


还有就是加两块网卡可以,一块v4一块v6,但是还是没那么好用


2#
发表于 2022-4-8 14:46:58 来自手机 | 只看该作者
https://mjj.022333.xyz/thread-891159-1-1.html 这个是亲测可行的,装完之后手动去配置ipv4 和ipv6 注意网关和dns服务必须要填对。
3#
 楼主| 发表于 2022-4-8 15:26:10 | 只看该作者
uset 发表于 2022-4-8 14:46
https://mjj.022333.xyz/thread-891159-1-1.html 这个是亲测可行的,装完之后手动去配置ipv4 和ipv6 注意网关 ...

试过了,直接用这个会失联欸

4#
发表于 2022-4-8 16:14:04 | 只看该作者
跟你学学,我也想弄
5#
发表于 2022-4-8 16:32:05 | 只看该作者
好鸭 发表于 2022-4-8 15:26
试过了,直接用这个会失联欸

你的网卡那些 应该填错了,还有 mac 地址 子网掩码这些。失联是 那个配置文件配错了,你得好好检查下
6#
发表于 2022-4-8 16:33:24 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
7#
发表于 2022-4-8 16:35:00 | 只看该作者
With a routed setup the vmbr0 is not connected with the physical interface. IP forwarding needs to be activated on the host system. This can be done automatically through /etc/sysctl.conf at boot time. (Please note that forwarding is disabled for the default Hetzner installation. This setting can be found in either /etc/sysctl.conf or in /etc/sysctl.d/99-hetzner.conf)

sysctl -w net.ipv4.ip_forward=1

Forwarding for IPv6 needs to be activated as well. This is also available in the Hetzner standard installation and only needs to be activated:

sysctl -w net.ipv6.conf.all.forwarding=1

After a successful installation the virtual machines can be administered at https://server-IP:8006.


以下是官方给出的建议配置
  1. # /etc/network/interfaces
  2. ### Hetzner Online GmbH - installimage
  3. # Loopback device:
  4. auto lo
  5. iface lo inet loopback

  6. # device: enp1s0
  7. auto enp1s0
  8. iface enp1s0 inet static
  9.   address <main IP>
  10.   netmask 255.255.255.255
  11.   pointopoint <gateway IP>
  12.   gateway <gateway IP>

  13. iface enp1s0 inet6 static
  14.   address <address from the IPv6 subnet> #e.g. 2001:db8::2
  15.   netmask 128
  16.   gateway fe80::1
  17.   up sysctl -p

  18. # for single IPs
  19. auto vmbr0
  20. iface vmbr0 inet static
  21.   address <main IP>
  22.   netmask 255.255.255.255
  23.   bridge_ports none
  24.   bridge_stp off
  25.   bridge_fd 0
  26.   up ip route add <first additional IP>/32 dev vmbr0
  27.   up ip route add <second additional IP>/32 dev vmbr0

  28. iface vmbr0 inet6 static
  29.   address <address from the IPv6 subnet>
  30.   #e.g. 2001:db8::3, should not be the same as on enp1s0/eth0
  31.   netmask 64
  32.   up ip -6 route add 2001:db8::/64 dev vmbr0

  33. # for an additional IPv4 subnet
  34. auto vmbr1
  35. iface vmbr1 inet static
  36.   address <a usable subnet IP>
  37.   netmask <netmask of the subnet>
  38.   bridge_ports none
  39.   bridge_stp off
  40.   bridge_fd 0
复制代码
8#
发表于 2022-4-8 16:43:43 | 只看该作者
我的 配置如下,也是hetzner 的机器
注意 enp41s0  是物理网卡名称要改成和你使用的一致
IPV4 设置 10.10.X.X/16 好大一段内网使用
  1. ### Hetzner Online GmbH installimage

  2. source /etc/network/interfaces.d/*

  3. auto lo
  4. iface lo inet loopback
  5. iface lo inet6 loopback

  6. auto enp41s0
  7. iface enp41s0 inet static
  8.         address 65.****/26
  9.         pointopoint 65.****
  10.   gateway 65.***

  11. iface enp41s0 inet6 static
  12.   address 2a01:****::2
  13.   netmask 128
  14.   gateway fe80::1
  15.   up sysctl -p
  16.   
  17. auto vmbr0
  18. iface vmbr0 inet static
  19.   address 10.10.0.1
  20.   netmask 255.255.0.0
  21.   bridge_ports none
  22.   bridge_stp off
  23.   bridge_fd 0
  24.   
  25. iface vmbr0 inet6 static
  26.   address 2a01:****::3
  27.   netmask 64
复制代码

关于IPV4端口转发
  1. iptables -t nat -A POSTROUTING -s '10.10.0.0/16' -o 物理网卡名称 -j MASQUERADE
复制代码

  1. apt-get install iptables-persistent
  2. iptables-save > /etc/iptables/rules.v4
  3. iptables-restore < /etc/iptables/rules.v4
  4. touch /etc/network/if-pre-up.d/iptables
  5. chmod +x /etc/network/if-pre-up.d/iptables
  6. vi /etc/network/if-pre-up.d/iptables
复制代码

在编辑器里面输出以下
  1. #!/bin/sh
  2. /sbin/iptables-restore < /etc/iptables/rules.v4
复制代码


重启网卡,再重启小鸡
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2026-1-15 22:53 , Processed in 0.064552 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表