Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Tutorial setup 1 ip dedicated server for multi VPS
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Tutorial setup 1 ip dedicated server for multi VPS

Hi all... can someone teach me how to set 1 IP from dedicated server to the VPS created in the dedicated ? i got some NAT port forward but got mess up around. And after that NAT port forward success, how to point our domain to that VM/VPS ?

Thank you

«1

Comments

  • Just let your VPS Control Panel do it for you?

  • jarjar Patron Provider, Top Host, Veteran

    If you already have the NAT port forward set, you just need the vps to be listening on the port.

  • @Jeffrey said:
    Just let your VPS Control Panel do it for you?

    i was using proxmox as the virtualization, can you recommend any VPS control panel ?
    i just got 1 ip but wanna use it for 2-3 vps in that dedicated server

    @jarland said:
    If you already have the NAT port forward set, you just need the vps to be listening on the port.

    that was the point, i dunno how to set that
    i try google it and try everything but it was mess up.

  • jarjar Patron Provider, Top Host, Veteran

    Here's a piece of my recent LXC tutorial. Nat instructions will be the same for any condition.

    [one] – Port to forward to the container.

    [two] – Your primary network interface. Usually eth0 or eth1.

    [three] – The IP of the container.

    [four] – The port you want to send the traffic to on the container.

    To replace the correct parts of the following iptables command:

    iptables -t nat -A PREROUTING -m tcp -p tcp –dport [one] -j DNAT -i [two] –to-destination [three]:[four]

    Thanked by 1iSky
  • @iSky Let me get this straight, you want to load multiple VPS servers on 1 IPv4 Address?

  • Haven't tried this myself yet, but someone once suggested here on LET that you can use NAT and iptables. You can create containers with private IP's that use ports to connect to the containers from the main (external) IP. Next, point your domain in the DNS to the main (external) IP address. I think the website should be reachable at the following URL: http://domainname.com:port# (e.g. http://domainname.com:101).

    Not a very elegant way, to be sure, but only way that I see offhand... unless BIND supports creating A records pointing to an IP and port number (e.g. 198.198.198.198:101) maybe...?

    Thanked by 1iSky
  • jarjar Patron Provider, Top Host, Veteran
    edited November 2013

    You could probably use mod_proxy if you wanted multiple containers on the same port with different direction based on virtual host. I'm just guessing I haven't tried that.

  • FrankZFrankZ Veteran
    edited November 2013

    EDIT: said better by others...

  • in order to access the CT you would need to specify the port..

    so say you assigned port 102 to CT @ port 80 then to access the http of the said port you would http://YourServerIP:102

    or if you wanted to connect putty to the CT you would assign a different port like 103 to connect to CT@ port 22, which then in putty you would use port 103 to connect to the CT.

  • @jarland said:
    Here's a piece of my recent LXC tutorial. Nat instructions will be the same for any condition.

    [one] – Port to forward to the container.

    [two] – Your primary network interface. Usually eth0 or eth1.

    [three] – The IP of the container.

    [four] – The port you want to send the traffic to on the container.

    To replace the correct parts of the following iptables command:

    iptables -t nat -A PREROUTING -m tcp -p tcp –dport [one] -j DNAT -i [two] –to-destination [three]:[four]

    just type that in the proxmox console ?

    @Jeffrey said:
    iSky Let me get this straight, you want to load multiple VPS servers on 1 IPv4 Address?

    YUP thats right
    so, the domain was pointing to the multi container
    and i can access the container using SSH with that domain and setup the container like we do in vps

    @earl said:
    in order to access the CT you would need to specify the port..

    so say you assigned port 102 to CT @ port 80 then to access the http of the said port you would http://YourServerIP:102

    or if you wanted to connect putty to the CT you would assign a different port like 103 to connect to CT@ port 22, which then in putty you would use port 103 to connect to the CT.

    got some article that can help me sir ?
    what about the domain pointing ?

    all @jarland @Jeffrey @earl and other

    thank you so much for answer this req

  • jarjar Patron Provider, Top Host, Veteran

    Yeah just in terminal, fill in the relevant variables.

  • what about pointing the domain into that VM ?
    if i point the domain only to the ip, it will login to the proxmox right ?
    can i point it like 192.168.1.1:102
    example ip with the port that i was pointed from nat

  • jarjar Patron Provider, Top Host, Veteran

    @iSky said:
    example ip with the port that i was pointed from nat

    You would set the vm web server to listen on port 80 and forward port 80 from the public ip to port 80 on the private ip. I think proxmox listens on port 8006.

  • earlearl Member
    edited November 2013

    @iSky said:

    you cannot point a domain to a port.. you would have to specify the port so if you have mydomain.com:102 would point to 192.168.1.1:80 if you set up the iptables with the corresponding ports..

  • agentmishraagentmishra Member, Host Rep
    Thanked by 1iSky
  • @earl said:

    so how to point the ip with the port that we already set to the domain we have ?
    example we set the ip was 10.0.0.1 port to the ipv4 server, with port 7000
    how can we set the domain was open the web server from that ?

  • earlearl Member
    edited November 2013

    ok take for example a CT with private IP 192.168.0.2 and you want access to http which is on port 80.. so you would pick a port for the external IP say 102 so..

    that is if your interface is called eth0 check "/etc/network/interface" could be vmbr0

    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 102 -j DNAT --to 192.168.0.2:80

    so now if you setup a domain to point to your servers ip.. mydomainname.com:8006 will take you to proxmox and mydomainname.com:102 will take you to http on CT 192.168.0.2

    you might need this as well to give CT acces to the internet..

    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j SNAT --to <serversIP>

    Thanked by 2iSky aglodek
  • Is there any way to point to an IP with a specified port in the DNS?

  • @aglodek said:
    Is there any way to point to an IP with a specified port in the DNS?

    nope.

  • aglodekaglodek Member
    edited November 2013

    Too bad... sure would save on them scarce IPv4 addresses...

    Thanks for the mini-tutorial how to do this @earl. However, a website address with a port number - say http://www.domainname.com:101/some-topic-here - isn't very elegant. But better than nothing, of course ;)

    Thanked by 1earl
  • earlearl Member
    edited November 2013

    @aglodek

    No Prob.. yeah it's pretty much only good for testing. Maybe someone has a work around on how to point your domain to to a specific port..

  • Not ideal and far from perfect but once you have set the Iptables as earl has shown, could you not have a web server listening for port 80 and have the web server issue a redirect to port 102 etc?

  • you can use nginx as proxy to forward trafic from public IPv4 to local IPv4.
    Just added tutorial for this http://www.boxcontrol.net/nginx-as-front-end-proxy.html

    Thanked by 1aglodek
  • aglodekaglodek Member
    edited November 2013

    @5n1p said: you can use nginx as proxy to forward trafic from public IPv4 to local IPv4. Just added tutorial for this...

    Very interesting, thanks :) Scanning through your tutorial, this kind of setup should also work using Nginx on the node, forwarding to an Apache webserver inside the container - am I right?

  • yes apache, nginx, lighthttpd, etc, this is only for front end nginx server you can have any webserver back. ;)

    Thanked by 1aglodek
  • My input: haproxy, Headers,

    Thats all i dont know how...

  • earlearl Member
    edited November 2013

    Ok so I found something interesting.. with a service like dyn dns or freedns you can use a webredirect or redirect URL to forward the domain to a port!

    http://dyn.com/support/record-types-standard-dns/

    so you don't need to install a proxy which may take up more resources..

    Not sure if you can do this at the domain registar? which would be free instead of using a DNS service.

  • @earl said: Ok so I found something interesting.. with a service like dyn dns or freedns you can use a webredirect or redirect URL to forward the domain to a port!

    Right, thanks for pointing this out. Many domain registrars offer this service. Basically, it's what @5n1p described in his tutorial, coupled into one control panel with DNS service. I think I prefer to run the proxy myself. Nginx proxy makes for very little overhead and any domain will work, no matter what DNS it is pointed to.

  • Ok I just tested with internet.bs, URL Forwarding does work sending the domain to a port, if you don't use stealh then the URL of the browser changes to the IP but if you select stealth in the setting, it keeps the domain name in the address bar.

Sign In or Register to comment.