I purchased a domain on namecheap (lets just use www.example.com). I have a CentOS virtual machine with a bridged adapter on my LAN. I'd my domain to resolve to that CentOS machine, but I don't know how to do that since it's behind a router. So far, the best I've been able to do, is to setup a Type A Record to point to my router, and then port-forward port 80 on my router to my CentOS VM. That doesn't seem like the right way to do this. Also, if I do that, then I can no longer get into my router to make changes.

All help is appreciated, thanks!

up vote 0 down vote accepted

Stephen Hartzell,

You have your DNS A record pointing to the public IP of your router and your router is forwarding TCP 80 traffic to the internal IP of your CentOS web server? You're doing it right!

A few thoughts though, you mentioned you cannot access your router (from the public IP assigned to the WAN port I must assume?) with TCP 80 being port forwarded to your CentOS web server. What make and model router do you have? Several routers let you change the management port so if you change the router management port from 80 to 8080, then you could access your router by public IP assigned to the WAN port by opening your web browser and pointing it to http://routerpublicip:8080 or http://yourdomain.tld:8080.

Ideally remote router management is disabled, but I understand you may want to have that enabled.

Do you have a static or dynamic public IP? If you have a static IP address then there is not a problem.

If you have a dynamic public IP, then when your public IP changes the IP that your DNS A record for your domain points to will not be the new IP address. In that case, you will want to setup dynamic DNS with namecheap (https://www.namecheap.com/support/knowledgebase/category.aspx/11/dynamic-dns, https://www.namecheap.com/support/knowledgebase/article.aspx/595/11/how-do-i-enable-dynamic-dns-for-a-domain). You will then either need to configure your router or a computer in your network to login to namecheap and update your A record any time your public IP address changes.

  • I have a static IP on my router. Thanks for your advice with regard to remote management. I found the area where I can do that on my router. It seems that I can only enable remote management on another port for machines outside my LAN. I'd like to be able to connect to my router's admin page on say: 192.168.1.1:8080 – Stephen Hartzell Feb 5 '16 at 3:07
  • Your port forwarding of external traffic entering the WAN port should not effect your ability to access your router at 192.168.1.1 from a computer connected to your routers LAN port, but that would not be remote administration. It would be internal. :) – user5870571 Feb 5 '16 at 3:10
  • Oh wow, your right. I feel dumb : P. Thanks! – Stephen Hartzell Feb 5 '16 at 3:21

So far, the best I've been able to do, is to setup a Type A Record to point to my router, and then port-forward port 80 on my router to my CentOS VM. - That's exactly how you do it.

if I do that, then I can no longer get into my router to make changes - You shouldn't have web access enabled for your router on the WAN/Public interface anyway. You should only allow web access to your router from your internal network.

  • Thanks! The issue is that I don't have any machine in range to hard-wire to my router. All my devices are wireless. – Stephen Hartzell Feb 5 '16 at 3:08
  • You don't need to be hard wired to the router. Your wireless clients are on the same network as your router. They're just connected wirelessly instead of wired. You should be able to connect to the internal ip address of your router from any of your wireless devices. – joeqwerty Feb 5 '16 at 3:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.