N
N
nepster-web2014-02-14 19:54:55
OpenVZ
nepster-web, 2014-02-14 19:54:55

How to implement network from openVZ container and port forwarding?

I set up openVZ containers, created two test containers 121 and 122.
Now there are two questions that I can’t figure out:
1) dns doesn’t work inside the container, that is, I can’t ping any domain
2) how can I forward ports in such a way that:
K For example, ip address of the main server: 10.0.1.0
Container address: 10.0.0.121, second container 10.0.0.122
Each container has its own folder with files (js, css, images) and node.js
Please tell me how to do it so that:
If i contact the main server:
10.0.1.0/deberc/images/1.png - i get this image from container 121
10.0.1.0/checkers/images/1.png - i get this image from container 122
And if I, for example, listen to port 8081 (socket.io), then this is our container 121
And if, for example, I listen to port 8082 (socket.io), then this is our container 122

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nepster-web, 2014-02-15
@nepster-web

IT WORKS LIKE THIS:

vzctl set ${ID} --numothersock 120 --save
vzctl set ${ID} --nameserver 8.8.8.8 --nameserver 8.8.4.4 --save

V
Vlad Zhivotnev, 2014-02-14
@inkvizitor68sl

> 1) dns does not seem to work inside the container, i.e. I cannot ping any domain
Set up NAT ( https://debian.pro/249 )
> If I am accessing the main server:
On the main server, you will need to install nginx, which will proxy requests to different virtual machines (which also use nginx or something like that). You can put nginx on one of the virtual machines and proxy requests from it to the second. And forward the port.
> And if I, for example, listen to port 8081 (socket.io), then this is our container 121
> And if, for example, I listen to port 8082 (socket.io), then this is our container 122
The easiest way is https://debian. pro/523

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question