add single public ip to vm

achirkov

Member
Nov 26, 2020
30
1
13
31
Hi! I have 2 public ip on hetzner. One for host and one for container.
I have vmbr0 where hosted vm behind NAT host ip. And i create vmbr1 for second public ip.
But i not have ping from container to host and host cant ping container.
How i can add ip to CT?
In container configuration:
ip: 156.XXX.XXX.109/26
gateway: 156.XXX.XXX.65
sudo cat /etc/network/interfaces
Code:
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback

iface lo inet6 loopback

auto enp5s0
iface enp5s0 inet static
    address 156.XXX.XXX.106/26
    gateway 156.XXX.XXX.65
    up route add -net 156.XXX.XXX.64 netmask 255.255.255.192 gw 156.XXX.XXX.65 dev enp5s0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up echo 1 > /proc/sys/net/ipv4/conf/enp5s0/proxy_arp

auto vmbr0
iface vmbr0 inet static
    address 10.16.1.1/24
    bridge-ports none
    bridge-stp off
    bridge-fd 0
#Local br

auto vmbr1
iface vmbr1 inet static
    bridge-ports none
    bridge-stp off
    bridge-fd 0
 
Last edited:
Hi,

is the container can ping google or 8.8.8.8? please post the container config as well pct config {CTID}
 
Hi,

is the container can ping google or 8.8.8.8? please post the container config as well pct config {CTID}
Container cant ping to 8.8.8.8.

Config:
Code:
arch: amd64
cores: 1
hostname: test-ip
memory: 1024
net0: name=eth0,bridge=vmbr1,gw=157.XXX.XXX.65,hwaddr=00:50:56:00:81:86,ip=157.XXX.XXX.109/26,type=veth
ostype: ubuntu
rootfs: pve-twin:vm-108-disk-0,size=8G
swap: 512
unprivileged: 1
 
Hi,

You should add an address to vmbr1 bridge

Code:
auto vmbr1
iface vmbr1 inet static
    bridge-ports none
    bridge-stp off
    bridge-fd 0
 
Hi,

You should add an address to vmbr1 bridge

Code:
auto vmbr1
iface vmbr1 inet static
    bridge-ports none
    bridge-stp off
    bridge-fd 0
After add ip to vmbr1 nothing changes.
But if i add route in proxmox and no set ip to vmbr1 i can ping proxmox host and host can ping container. But no ping to 8.8.8.8. Maybe need add something to iptables?
sudo ip route add 157.XXX.XXX.109/32 dev vmbr1
 
Check the output of iptables -t -nat -L and post please. On my new install iptables nat commands on vmbr1 do not fail but they don't register in iptables either. It might be what's happening to you too.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!