【问题标题】:Creating several Proxmox containers/VM behind one public IP在一个公共 IP 后面创建多个 Proxmox 容器/VM
【发布时间】:2022-07-01 04:51:43
【问题描述】:

我最近购买了一个 Kimsufi 实例(一个 Proxmox 发行版,带有一个公共 IP 和一个物理网络接口)。 我希望能够实例化几个可以从 Internet 访问的容器/VM。 鉴于一些在线研究,我认为拥有 NAT 配置将适合我的使用。 设置完成后,我可以 ping 直接 IP,但无法解析容器/VM 中的 DNS。 我尝试添加与主机不同的 DNS 服务器,但仍然无法正常工作。

这是下面的配置,有人熟悉这种方法吗?任何形式的建议/答案将不胜感激。

主机(Proxmox)

/etc/network/interfaces

auto lo
iface lo inet loopback

iface eth0 inet manual

auto vmbr0
iface vmbr0 inet static
    address  MY.PUB.IP.XXX/24         # anonymized on purpose
    gateway  MY.PUB.IP.1              # anonymized on purpose
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0

auto vmbr1
iface vmbr1 inet static
    address 10.10.10.1/24
    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 '10.10.10.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE

容器

/etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 10.10.10.2/24
        gateway 10.10.10.1
        dns-nameservers 8.8.8.8

/etc/resolv.conf

# --- BEGIN PVE ---
nameserver 8.8.8.8
# --- END PVE ---

Output when trying to update machine

root@container:~# apt update     
Err:1 http://security.debian.org bullseye-security InRelease         `
  Temporary failure resolving 'security.debian.org'
Err:2 http://ftp.debian.org/debian bullseye InRelease                
  Temporary failure resolving 'ftp.debian.org'
Err:3 http://ftp.debian.org/debian bullseye-updates InRelease
  Temporary failure resolving 'ftp.debian.org'
Reading package lists... Done    
Building dependency tree... Done
All packages are up to date.
W: Failed to fetch http://ftp.debian.org/debian/dists/bullseye/InRelease  Temporary failure resolving 'ftp.debian.org'
W: Failed to fetch http://ftp.debian.org/debian/dists/bullseye-updates/InRelease  Temporary failure resolving 'ftp.debian.org'
W: Failed to fetch http://security.debian.org/dists/bullseye-security/InRelease  Temporary failure resolving 'security.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

【问题讨论】:

  • 遇到了同样的问题。有更新吗?

标签: linux networking dns nat proxmox


【解决方案1】:

尝试将此添加到您的/etc/network/interfaces

post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1

更多信息在这里:https://pve.proxmox.com/wiki/Network_Configuration#_masquerading_nat_with_tt_span_class_monospaced_iptables_span_tt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-01
    • 2021-05-02
    相关资源
    最近更新 更多