OpenVZ Forum


Home » General » Support » Redirect traffic from a specific hostame to a specific VE ?
icon5.gif  Redirect traffic from a specific hostame to a specific VE ? [message #32362] Sat, 02 August 2008 07:24 Go to next message
int64 is currently offline  int64
Messages: 2
Registered: August 2008
Location: Toronto
Junior Member

Hello, I am new to using openVZ and need some help already Razz

I have installed openVZ on a CentOS 5.2 host machine and created a CentOS VE.

I have a dynamic DNS domain name from dyndns.org, is there any way that I can route that hostname to the specific VE?

I set the FQDN and hostname to that of the dyndns.org domain name but when I try to connect to SSH on that FQDN it will login to the host system and not the specific VE :S

I have been searching Google about iptables but I am not sure it they work with hostnames :S

To explain things easier :

This is what I am trying to do :

[HOST BOX : 192.168.1.100]
- |_vm1 (192.168.1.101)_| <------ host1.dyndns.org
- |_vm2 (192.168.1.102)_| <------ host2.dyndns.org
- |_vm3 (192.168.1.103)_| <------ host3.dyndns.org
- |_vm4 (192.168.1.104)_| <------ host4.dyndns.org
- |_vm5 (192.168.1.105)_| <------ host5.dyndns.org


This is what happens :

|------ host1.dyndns.org
|------ host2.dyndns.org
|------ host3.dyndns.org
|------ host4.dyndns.org
|------ host5.dyndns.org
|
\
.V
[HOST BOX : 192.168.1.100]
- |_vm1 (192.168.1.101)_|
- |_vm2 (192.168.1.102)_|
- |_vm3 (192.168.1.103)_|
- |_vm4 (192.168.1.104)_|
- |_vm5 (192.168.1.105)_|



host1.dyndns.org though host5.dyndns.org all have the same external ip of the host (x.x.x.x).

I was wondering if there was a way for the host machine to redirect traffic to the appropriate VE's according to the hostname?

Thanks for any help!! I am very confused about this Laughing .

[Updated on: Sun, 03 August 2008 03:05]

Report message to a moderator

Re: Redirect traffic from a specific hostame to a specific VE ? [message #32396 is a reply to message #32362] Tue, 05 August 2008 09:50 Go to previous message
int64 is currently offline  int64
Messages: 2
Registered: August 2008
Location: Toronto
Junior Member

hmm it seems that not all protocols (ftp/ssh/ etc..) are "hostname aware" with the exception of HTTP/S. Thus, to overcome this, I simply modified the ports that services run on so all the VE's are happy.


>> [FOR OTHER SERVICES (SSH/FTP/etc) ]

I set SSH for VE1 to listen on port 2222.

Below is simple DNAT iptable to route the traffic

# iptables -t nat -A PREROUTING -p tcp -d 192.168.1.100 --dport 2222 \
-i eth0 -j DNAT --to-destination 192.168.1.101:2222

let,
HN ip = 192.168.1.100
dport = HN port (public port)
VE destination = 192.168.1.101
VE Destination Port = 2222

this isn't that fun to do, but if you have only one public IP its the only thing you can do.

>> [FOR HTTP/S]

HTTP protocol is different, you can set up a reverse proxy on the HN to sort traffic to appropriate VE.

some reverse proxies I've heard of are pound or pen , but I'm sure you can find more online!

good luck!
Previous Topic: [Solved]Can't install yum on container.
Next Topic: How create a backup
Goto Forum:
  


Current Time: Wed Nov 13 17:09:37 GMT 2024

Total time taken to generate the page: 0.02909 seconds