Dynamic DNS on your own server - apache

I have a server in at a hoster (which has a static IP) and want to run a server at home too and don't want to buy the dyndns package from dyndns.com
I would either like to find a program that does this without costing money and using my own server and domain so I can have myclient.domain.com or I would like to write this myself. Would I be able to do that with a custom apache conf?
EDIT:
I have 1 Server with a static ip and I want to run a server at home (dynamic IP) I want to use the server with the static ip to run as the dyndns managing server

I use zoneedit.com for my DNS servers, and they have a free dynamic service that works fine for my home box. (On the other hand, my home box changes IP about twice a year, so it's not like I stress it.)
On my home box, I have a script that polls a tiny little cgi on my colo box to return what my current IP is (because I can't get it from the router), and if it's changed, it does a "curl" to update my zoneedit settings. When I get home, I'll try to remember to post the script.

Per your revisions: Ah, then you can theoretically do that, yes. (As noted elsewhere, apache.conf is irrelevant.) Your hosted server needs to be the nameserver of record for your dynamic DNS; you should probably use a subdomain. This would be a record in your main domain's zone file of IN NS server.ip.number.here. Then you configure a DNS server on your hosted server for the dynamic namespace; you'll have to get deep into the configuration to set up the records so that they advise client nameservers not to cache them, or to cache them only very briefly. Then you write some sort of systemry where the home machine, when a connection is established, talks to the hosted server and tells it to change the DNS for the dynamic hostname to point to its currently assigned IP.

You cannot do it with a custom Apache conf. Apache handles web serving, not DNS.

Maybe I´m wrong but I think what you want is:
create a dynamic host in a free DNS service, like dyndns.org (Or you can even manager a entire domain using editdns.com which has dynamic dns also). For example: server-at-home.dyndns.org.
Create a static IP host for the desired address (ex. www2) pointing to the same IP address of the www server.
Create a virtual host in the httpd.conf in the static ip server and put a reverseproxy using the dynamic host create on item 1.
P.S.: You said that the main goal is to void to buy for this service but i use dyndns.com and i dont pay for it. And i have 4 hosts in my account.

I have a server at home with a Static IP address, and I do exactly what you are looking to do with a free dyndns account. I just have to renew it every month or two - they send me an email and I just click the link to let them know I'm still here and alive.

I am not exactly sure, but it sounds like you want to redirect to your "server" at your house from your webserver at the hosted site?
You will need to periodically send some notification to your static IP server to let it know your dynamic ip.
You can do this is some cron/scheduled job - just create a redirect html page every day and ftp it (automagically) to your static ip host.
There are probably other ways to do this. But that should work.

Related

Protect home (webserver's) dynamic ip from reverse DNS issue

this is my first question here =)
I'm setting my webserver at home (trying both apache and nginx) and I've found that you can easily get and use free dynamic dns (sub) domain to make your server available not only with your home ip that would be changed next time after disconnect and connect to the internet. Actually I've made it working and it's great..
But the problem is that my personal unique data (account id/machine name) could be retrieved with reverse dns look up and I can not hide my real ip that is attached to server.
You can use proxy while browsing the internet, but how to proxy your web server (apache) that have free dyn dns (sub) domain?
I've already tried to create VirtualHost configurations, also with the use of proxy modules (mod_proxy, mod_proxy_http, mod_proxy_html) and additionally with proxifier tool, but no luck.
Some people say that it is possible to hide ip with nginx, but I never used to work with nginx. Still believe it is also possible with Apache, just can't figure it out.
I'm using private proxy in format [proxyip:port]. I must attach it everytime to my home ip to make it work. Maybe it's better to get login/password auth proxy, but at first I should find the way how to use it with web server.
Is there anyone who have luck with it? Can you explain, please, the proper config for apache? Currently I'm using version 2.4.
Many thanks and have a good day!

How to check if DynDNS is working

Newbie programmer here. I'm building an app for an API that requires an IP address for authentication. Basically, users have to send the API management their IPs and then each time a computer makes a request to their server, it verifies whether it's coming from a registered IP.
Since I work in a number of different places and thus end up with different IPs, I thought it would be easiest to use DynDNS to establish a URL that points to whatever my current IP is and then send that URL to the API management. So my first question is if this approach would in fact work?
Secondly, assuming this would work, I set up ben.dynalias.com and downloaded the DynDNS Updater client. It appears to be working: the updater says status: OK and displays my current IP. However, when I navigate to the URL (ben.dynalias.com) there's no response. Should this be the case? How can I tell if it's working?
I don't see any reason it shouldn't work as long as your updaters aren't overwriting each other by running at the same time automatically from different locations.
You can ping ben.dynalias.com and see if your current ip matches.
I just hosted ben.dynalias.com and it gave me your IP.
Since there is no web server running on that IP, then your browser will not be able to show you a page result.
You can use http://www.kloth.net/services/nslookup.php
to check and see if you get the correct IP from a host lookup.
Depending on how often your IP changes this might not be a great solution as the DNS will cache your hostname and will not try and resolve it again until the TTL expires normally minimum 1 hour.
whether the API management accepts a hostname instead of an IP address is a question only they can answer. Some will, many won't as it's "easier" to hijack a domain name than to hijack an ip address.
trying to browse to you-address.dynalias.com that points to your own public address rarely works, even if you opened up the right ports because your router will be highly confused. The best way to test such a setup is by using a phone or tablet with 3g/GPRS internet - of course after you set up port forwarding in the router to point the appropriate port to your computer.

How do I redirect a specific port for my subdomain to another IP address

Ok so I have a domain registered, for these purposes I will refer to it as mydomain.com.
I also have Shared Hosting (just fyi) so I may be restricted in doing what I am planning.
So basically I have a sub-domain, gserver.mydomain.com, which points to a directory on the Host server showing basically a seperate website for this subdomain displaying information about it's corresponding gameserver.
Since it's about a gameserver, naturally I would want gserver.mydomain.com to also direct users to the gameserver's IP but I can't have it both to the Web Server and Game Server in the zone record as they are seperate IPs.
If the gameserver listens on.. let's say port 2400, then is it possible to have gserver.mydomain.com:2400 point to another IP (the gameserver's IP) while still retaining the Web Hosts IP on port 80.
I have a general idea of how to go about it but with the current Hosting Plan, restrictions may be preventing me.
Talking about DNS, it's not possible to use port (tcp or udp) information, as it handles only name/ip's (basicaly).
So, gserver.mydomain.com will always be resolved to the IP in the DNS database, regardless of the :port. Actualy, the :port is not part of the DNS name.
If all of your server will be HTTP servers and you have access to an Apache web servers, you can use something like proxy_pass.
You can take a look at this link http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass

getting router confuguration page instead of my web home page of my website

I am trying to host a website from my local pc. For that i have installed apache server, registered a domain name and done the necessary settings.The problem is that when I am trying to access my homepage I am getting the router configuration page, same is happening when I am trying to access the website from other computer.Please help.
When hosting a website from a local PC behind a router you need to be careful to use the public IP that your service provider has given you. Beware this is often not a static address and may change frequently. To address this you can use some type of DynDNS service if your router supports it.
Second, you will need to add a rule in your router's firewall to allow the traffic from the public internet to reach the computer behind the router. This can be done either with a DMZ (less secure) or a port forwarding.
When you are trying to access the web page, type in the local ip of the computer you have setup the server on. This should take you to the apache server. You are likely just typing in the wrong IP. Try something like http://127.0.0.1/ (127.0.0.1 is the same as localhost) to make sure you get the apache server from the computer that is running the server.

how to make apache server public

I want to convert my pc to a web server. I installed centos server and apache server.
How I can make apache server public? I want to everyone access my web site on my pc via browser.
Thank you..
You have 2 ways, you can buy a domain and a static IP address for your computer (usually through the service provider) and configure your router and FW to allow access to the machine for port 80.
The other way is to use some sort of dynamic dns service like DynDNS to be able to bind a DNS to a dynamic IP address (you will need to run a daemon to update the account once in a while because your IP may change). The FW and router rules are still needed in this case as well.
After you do one of the these steps everyone should be able to access your apache server on your computer as long as it's on.