Container with lan interface outgoing connection problem

andreadragotta

New Member
Jul 16, 2019
4
0
1
28
Hi,

I have an installation of Proxmox on my server and my idea is the following:
5 container without public ip and with LAN interface
1 container with LAN interface and public IP

My problem is when i try to download some packages with yum for example in the containers without public ip.
How can i fix mi problem with outgoing networking?
 
Solved, thank you so much!

My CT os is centos 7 and the network interface config is a little bit different, instead of "post-up" and "post-down" in /etc/network/interfaces i've created two files in /sbin/

The first one is "ifup-local" and the content is:
Code:
#!/bin/bash
if [[ "$1" == "eth1" ]]
  then
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o eth0 -j MASQUERADE
fi

The second one is "ifup-down" and the content is:
Code:
#!/bin/bash
if [[ "$1" == "eth1" ]]
  then
    iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o eth0 -j MASQUERADE
fi
 
Last edited:
you can also set up forwarding directly on your proxmox host, and create a private sub network for your containers and use port forwarding to reach them from outside