0

I have Windows 8 host and I have installed Ubuntu 14.10 server as a virtual machine in vmware. I have installed LAMP server and I am trying to host a website from it. I have created a virtual host. my website is accessible in the host machine when I go to the address 192.168.0.106.

I have connected the internet through a wifi router. I don't have a static ip. when I go to my router info, I get this:

LAN

  • MAC Address :B0:C5:54:83:90:FA
  • IP Address :192.168.0.1
  • Subnet Mask :255.255.255.0
  • DHCP Server :Enabled

Internet

  • MAC Address :B0:C5:54:83:90:FB
  • IP Address :10.30.195.241
  • Subnet Mask :255.255.224.0
  • Default Gateway :10.30.192.1
  • DNS :113.193.5.23, 113.193.12.14

When I search for "what is my ip" in google, I get this: 113.193.56.198, both in host and guest os.

Now, my issue is that how do I access my site from the internet? I know that I will have to edit hosts file and virtual host config file in ubuntu, but which ip address do I have to use? do I need to set up a dns server? I have a domain registered in godaddy, I want to know which ip address should I put in "points to" in the domain setting page.

Basically, I want to know which ip address should I type in address bar to go to my site, even if it works for only one day, and how do I edit the hosts file and configuration file in ubuntu to use that ip. I have tried searching in many forums and have not found the kind of clarity I need.

  • 1
    Use a dynamic DNS service like dyn.com – Barmar Jan 21 '15 at 17:56
  • can it be done without using a DNS service? i just want to know the details of hosting so i want to do everything myself... – vikrant Jan 21 '15 at 17:58
  • 3
    @Ramhound You need a static IP to run a public DNS service. Otherwise, how will the rest of the Internet know how to get to your DNS server? – Barmar Jan 21 '15 at 18:02
  • 1
    @Barmar "It sounds like your ISP is doing server-grade NAT. This may make running a public server impossible" so even if i use a dns service i cannot host a site? – vikrant Jan 21 '15 at 18:05
  • 1
    @Barmar - You don't need a static IP address to run a DNS service. You would have to use your networking equipment to handle the changes but I have done it before. – Ramhound Jan 21 '15 at 18:05
1

In the end, it is fairly simple.

  1. Note your external IP address.
  2. Update your DNS records as needed to point your domain to your IP address.
  3. Port Forward port 80 and 443 to the webserver.
  4. Make sure nothing else such as a firewall is blocking traffic.

If your ISP allows port 80 traffic, and your web server is serving the site correctly, then it should work.

The trick is this:

Use a proxy site such as this to try to access your site if you are trying to access your site from behind the same router as your webserver. Or use a cell phone or someother mobile device connected to another network.

Point is you cannot access your site from the same network as your webserver using the internet address without further configuration; but that further configuration usually circumvents the packets from ever leaving your network which would defeat the purpose of trying to use the web address to see if it works from anywhere on the internet.

2

Assuming you can get to your gateway from the Internet, you'll need to setup port forwarding on your router to send traffic to your vm. This only answers the second half of the question.

If you're really behind a NAT by your isp, you'll need to contact them to find out if they will let you access your computer externally like you want. If you can, they should give you the ip you need to point to.

The steps vary by router, but there is a port forwarding function, unless the router is cheap then it might not support this, somewhere in the routers setup. You would need to log into your router and find it. Then you need to forward traffic on port 80 and 443, for http and https respectively, to the vm. You forward it to the internal ip. Thus when traffic from the web reaches your router, it knows where on the network to send it.

  • Can you explain how to do this and how this would address the problem? – bwDraco Jan 22 '15 at 2:27
  • The steps vary by router, but there is a port forwarding function, unless the router is cheap then it might not support this, somewhere in the routers setup. You would need to log into your router and find it. Then you need to forward traffic on port 80 and 443, for http and https respectively, to the vm. You forward it to the internal ip. Thus when traffic from the web reaches your router, it knows where on the network to send it. – Doug Watkins Jan 22 '15 at 2:33
  • You can edit this into the answer. – bwDraco Jan 22 '15 at 2:33

protected by Community Nov 26 '18 at 20:04

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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