Assigning a Public IP to one of my Containers

FrankB

Active Member
Mar 17, 2016
53
2
28
54
Zapopan, Jalisco, Mexico
hospemex.com
I have a dedicated server with 5 ips.
The first one assigned to eth0.
I created a bridge vmbr0 with the same IP as eth0.
Then gave on of my openvz containers one of my available static IPS, but I'm getting no ping.

Is there a guide I can follow for assigning static ips to containers? Is there something I'm not inserting into the BRIDGED PORTS text box that I should be?

With Virtualbox I used to bridge the interface and apply the IP directly to VM.

Using Proxmox 4.1.
Code:
auto lo
iface lo inet loopback

allow-hotplug eth0

auto eth0
iface eth0 inet static
   address  x.x.x.138
   netmask  255.255.255.248
   gateway  x.x.x.137
   broadcast  x.x.x.143
   network x.x.x.136
   dns-nameservers 127.0.0.1
   dns-search hospemex.com
# dns-* options are implemented by the resolvconf package, if installed

auto vmbr0
iface vmbr0 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
  post-up  iptables -t nat -A POSTROUTING -s '192.168.0.1/24' -o eth0 -j MASQUERADE
  post-down iptables -t nat -D POSTROUTING -s '192.168.0.1/24' -o eth0 -j MASQUERADE


auto vmbr1
iface vmbr1 inet static
  address  x.x.x.138
  netmask  255.255.255.248
  bridge_ports none
  bridge_stp off
  bridge_fd 0

  up ip route add x.x.x.139/29 dev vmbr1
  up ip route add x.x.x.140/29 dev vmbr1
  up ip route add x.x.x.141/29 dev vmbr1
   up ip route add x.x.x.142/29 dev vmbr1
I'm putting a public IP on the VM interface and using x.x.x.138 as the gateway.
 
Last edited:
Problem resolved in the meantime?

If not: there are some contradictions in your description:

- if you assign an IP address to eth0 you must not assign the same to vmbr0

- Proxmox 4.1 does not support openvz
 
Bump! I've got the exact same question. I just can't figure out how to get internet in the container
 
  • Like
Reactions: FrankB
here's /etc/network/interfaces too

edit: yes, with LXC
 

Attachments

  • etcnetworkinterfaces.png
    etcnetworkinterfaces.png
    56.9 KB · Views: 26

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!