OpenVZ Forum


Home » General » Support » VEs sharing an IP address?
VEs sharing an IP address? [message #31551] Thu, 03 July 2008 14:06 Go to next message
mperkel is currently offline  mperkel
Messages: 253
Registered: December 2006
Senior Member
Can I make VEs share an IP where each VE services different ports?

Re: VEs sharing an IP address? [message #31553 is a reply to message #31551] Thu, 03 July 2008 14:43 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

what about this ways (unfortunately I haven't tried them Smile )

1. Using venet it's impossible to assign the same IP addresses to your VEs. But your can assign IP address you want to share to your HN, assign any different IP addresses to your VEs and then for example via iptables distribute the traffic.

2. Using veth try to assign the IP address you want to share to your VEs and then set appropriate iptables rules on the HN to sort the traffic.
Re: VEs sharing an IP address? [message #31560 is a reply to message #31551] Thu, 03 July 2008 14:49 Go to previous messageGo to next message
mperkel is currently offline  mperkel
Messages: 253
Registered: December 2006
Senior Member
Could I do a fake net 10.0.0.2 for the IP than then use iptables in the HE and redirect the traffic for a particular port to 10.0.0.2?

Re: VEs sharing an IP address? [message #31562 is a reply to message #31560] Thu, 03 July 2008 14:52 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

that I had in mind. (using fake IP for your VEs).

P.S. don't forget to set appropriate routes to your VEs.
Re: VEs sharing an IP address? [message #31563 is a reply to message #31551] Thu, 03 July 2008 15:01 Go to previous messageGo to next message
mperkel is currently offline  mperkel
Messages: 253
Registered: December 2006
Senior Member
Would you have an example of how to do this? Lets say the HE had an IP of 1.2.3.4 and the VE had IP of 10.0.0.2 and I wanted to service TCP port 80. What whould I do?


Re: VEs sharing an IP address? [message #31565 is a reply to message #31563] Thu, 03 July 2008 15:13 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Hi,

I think there is a little misunderstanding between us.
Quote:


HE had an IP of 1.2.3.4 and the VE had IP of 10.0.0.2


this way should help you http://wiki.openvz.org/Using_NAT_for_container_with_private_ IPs#How_to_provide_access_from_Internet_to_a_container

I mean something different
Let's assume we have a HN and two VEs (VE1 and VE2).
Let's assume we have an IP address - IP1.
We have some services inside VE1 and inside VE2 that are using different ports.
We want to use IP1 for both of our VEs and sort the traffic using ports numbers.

1. we assign IP1 to HN (for example with alias to net interface or using additional net card).
Then we assign fake IPs (IP_fake_1, IP_fake_2) to VEs. Put appropriate routes to our VEs.
Then we set appropriate iptables rules on the HN to sort traffic using destination port.

2. Using veth. We assign IP1 to our VEs. And then we set appropriate iptables rules on the HN to sort traffic using destination port.
Re: VEs sharing an IP address? [message #34501 is a reply to message #31565] Mon, 12 January 2009 21:05 Go to previous message
msl7868 is currently offline  msl7868
Messages: 7
Registered: January 2009
Junior Member
Can you tell me how you solve this problem. I looked every where and still cannot find how to make services available from the internet to a VE
Previous Topic: Network Interfaces Configuration
Next Topic: Moving VEs with IP-Addresses
Goto Forum:
  


Current Time: Sun Aug 11 14:20:30 GMT 2024

Total time taken to generate the page: 0.02883 seconds