0

Here is my setup.

  • Host Machine-[Ubuntu 16.04][185.82.xx.xx]
    • Container1 [10.0.8.9]
    • Container2 [10.0.8.100]
    • Container3 [10.0.8.101]
    • Container4 [10.0.8.102]

All are working great.

Now, I purchased another dedicated IP for my server. I have required information for my new IP [ip_address, gateway and netmask]

I want to assign my new dedicated IP to Container 4. I tried to set the required information in Centos' related networking files, but it did not work. Container has no access to internet right now.

This is the /etc/sysconfig/network-scripts/ifcfg-eth0 file:

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=185.82.x.x
NETMASK=255.255.255.0
HOSTNAME=LXC_NAME
NM_CONTROLLED=yes
TYPE=Ethernet
DHCP_HOSTNAME=`hostname`

And this is the /etc/sysconfig/network file:

NETWORKING=yes
HOSTNAME=LXC_NAME
GATEWAY=185.82.x.1

What can I do to make this work?

Thanks

Will Humphreys
  • 1,673
  • 1
  • 9
  • 10
alioguzhan
  • 103
  • 4

1 Answers1

2

Create a bridge on eth0 and add this single VM to the brigde. You will then be able to setup public ip in the container.

The second option is to configure 1:1 NAT and assign the IP to the host itself.

Update

Before you start, please ensure you have bridge-utils package installed on your system. Feel free to follow this guide in order to create a bridge: http://www.itechlounge.net/2013/01/linux-how-to-create-a-bridge-interface-on-rhel-centos/

Yarik Dot
  • 1,583
  • 12
  • 26