Internet access from container using a virtual mac

peter1

New Member
Nov 8, 2016
3
0
1
62
We have a proxmox server hosted at online.net. It has two external IPs 62.x.x.17 on eth0 and 212.y.y.155 connected to a virtual mac, provided by online.net also on eth0.

I followed this guide https://goo.gl/aykcAS to set the server up, which I found very helpful.
My configuration is that I have all my vms sitting on vmbr10 in a private subnet, 10,100,100.x. One server running nginx acts as a reverse proxy for 80,443. All the vms on that private subnet can access the internet.

I want to connect a container directly to 212.y.y.155, ie so that it is connected directly to the net. I have set the container to use the mac address of the virtual mac and the ip 212.y.y.155/32 and the gateway provided by online.net. I can ping say google.com, however I cannot access anything on port 80, so for example wget google.com resolves the domain, but just hangs when downloading on port 80. We plan to run an application on this server that will access files on amazon s3 on port 80 so I need to get this to work.

Thomas from Proxmox said that "It looks like you have prerouting rules setup in the /etc/network/interfaces file which NAT the traffic from all TCP traffic on ports 80, 443, 9001 to the vmbr10, you should exclude the IP address from the CT 106 from this as else it will me routed to the vmbr10 network before it can hit any other rules."

I have therefore set my configuration as below (note prerouting excludes 212.y.y.155). However it still does not work. Any suggestions would be hugely appreciated as I have been trying many different option and seem to be getting nowhere.

Many thanks.

/etc/network/interfaces
===================
auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual

auto vmbr0
iface vmbr0 inet static
address 62.x.x.17
netmask 255.255.255.0
gateway 62.x.x.1
bridge_ports eth0
bridge_stp off
bridge_fd 0

auto vmbr10
iface vmbr10 inet static
address 10.100.100.254
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 -o vmbr0 -s 10.100.100.0/24 ! -d 10.100.100.0/24 -j SNAT --to 62.x.x.17
post-down iptables -t nat -D POSTROUTING -o vmbr0 -s 10.100.100.0/24 ! -d 10.100.100.0/24 -j SNAT --to 62.x.x.17
post-up iptables -t nat -A PREROUTING -i vmbr0 ! -d 212.y.y.155/32 -p tcp --dport 80 -j DNAT --to 10.100.100.1:80
post-down iptables -t nat -D PREROUTING -i vmbr0 ! -d 212.y.y.155/32 -p tcp --dport 80 -j DNAT --to 10.100.100.1:80
post-up iptables -t nat -A PREROUTING -i vmbr0 ! -d 212.y.y.155/32 -p tcp --dport 443 -j DNAT --to 10.100.100.1:443
post-down iptables -t nat -D PREROUTING -i vmbr0 ! -d 212.y.y.155/32 -p tcp --dport 443 -j DNAT --to 10.100.100.1:443


Container Configuration
===================
nameserver: 8.8.8.8
net0: name=eth0,bridge=vmbr0,gw=62.x.x.1,hwaddr=00:16:3e:00:15:21,ip=212.y.y.155/32,type=veth

hwaddr=00:16:3e:00:15:21 is the virtual mac
 
Last edited:
Hi Peter
I have seen you have set your extra container on the right bridge (vmbr0).

For debugging try to temporarly disable firewalling on the host ( you didn't specify if you used it) and temporarly disable the vmbr10 interface.
Then you will know if your iptables rules are causing the problem or not.

You can switch on and off the vmbr10 interface with

ifdown vmbr10
ifup vmbr10

If your hoster is OVF, did you have a look at https://pve.proxmox.com/wiki/OVH#IPv4 ?
 
Many thanks for the suggestion. I will give it a try. I think I have seen the article before, I followed that to set up the container.
 
Hello,

I wanted to point out that your ip is in the post, and that the management console is open for everyone! please hide that with firewall rules!
Your ip: 62.XXXXXX.17:8006
 
Last edited:
Many thanks for pointing that out! Do you mean restrict access to my own ip for the management console? So in the firewall rule for 8006 set the source to my own ip?
 

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!