OpenVZ Forum


Home » General » Support » Containers as Gateways? Can't make it work
Containers as Gateways? Can't make it work [message #51491] Wed, 25 June 2014 18:26
boaventura is currently offline  boaventura
Messages: 1
Registered: June 2014
Junior Member
Hello

I'm trying to create containers to be used as gateways. Let me explain:

  
               HN (192.168.0.1)
/--------------------------------------------\
|                                            |
|          VE                     VE         | 
|     .---------.            .---------.     |
|     |   100   |            |   101   |     |
|     '---------'            '---------'     |
|          ^                      ^          |
|          |                      |          | 
\----------|----------------------|----------/
           |                      |
           |                      |
           V                      V
      .---------.            .---------.  
      |   200   |            |   201   |
      '---------'            '---------'
        Notebook               Notebook


The numbers represent the IP addr (192.168.0.X)


My HN has 2 NICs, one has an external (real) IP, the other is in the 192.168.0.0 range. Every VE and computer are in the same ip range.

I want to use separates gateways to get to the internet, each notebook connecting to a different gw. My DHCPD is assigning everything correctly, no problems there.

When I use

iptables -t nat -A POSTROUTING -j SNAT -s 192.168.0.0/16 -o eth1 --to-source $EXTERNAL_IP


everyone has Internet access, including the notebooks BUT they are not using the gateways! What should I do to ensure that each notebook just exits the network through it's assigned gateway? I know I'll need a lot o iptables-magic but I just don't know where to start!

Thanks in advance

Previous Topic: OpenVZ old Centos templates
Next Topic: Caches on 32 kernel
Goto Forum:
  


Current Time: Mon May 06 00:31:58 GMT 2024

Total time taken to generate the page: 0.01867 seconds