Proxmox 将公共 IP 地址分配给容器

Proxmox 将公共 IP 地址分配给容器

我想在 Proxmox 上为我的容器分配一个单独的公共 IP 地址。我的网络接口如下所示:

auto lo
iface lo inet loopback

auto ens3
iface ens3 inet manual

auto vmbr1
iface vmbr1 inet static

    #Main public ip-address assigned to proxmox host
    address 91.xxx.xxx.xxx

    #Gateway from the SCP
    netmask 255.255.252.0
    gateway 91.xxx.xxx.1

    bridge_ports ens3
    bridge_stp off
    bridge_fd 1

    #Same as the gateway
    pointopoint 91.xxx.xxx.1

    #My additional ip-address
    #Gateway is set to my Proxmox host public ip-address
    up route add -net 188.xx.xx.xx.xxx netmask 255.255.255.255 gw 91.xxx.xxx.xxx vmbr1

#Used by my lxfc container on proxmox
auto vmbr2
iface vmbr2 inet static

    address 192.168.0.1
    netmask 255.255.255.0

    bridge_ports none
    bridge_stp off
    bridge_fd 0

    post-up echo 1 > /proc/sys/net/ipv4/ip_forward

    #NAT
    iptables -t nat -A POSTROUTING -s '192.168.0.1/24' -o vmbr1 -j MASQUERADE
    iptables -t nat -D POSTROUTING -s '192.168.0.1/24' -o vmbr1 -j MASQUERADE

我的容器配置为:

IPv4: 192.168.0.2/24
GW: 192.168.0.1

但当我尝试 ping google.com 时,它说

ping: google.com: Temporary failure in name resolution

相关内容