0

I know this is a common questions asked by many people, but since I am really really a newbie in this area, I really need a very detailed steps on what I have to do.

This is my situations:

I set up a clean local server at my university using Ubuntu server, set up OpenSSH and LAMP server(Apache2, PHP, MySQL) - nothing else, and created a simple drupal website in the /var/www and then I could take a look at my website in the local network at my university through this ip, the ip is 172.21.45.108. Certainly, I think this IP is not usable at all if users accessed outside the network, and through many googling, people have suggested that we need to get some "static IP" and "A domain". Through my newbie effort, I got a domain name registered and paid through Enom via Google, in addition, I ask my university to provide me a static IP which they did, however, I have no idea at all what these information is for, the information includes:

  1. Network name
  2. IP address
  3. Subnet Mask
  4. Gateway
  5. DNS Server (primary)
  6. DNS Server (secondary)

Again, through my newbie effort through crazy googling, i was found that I need to change the local network interfaces to this IP, so what I did is:

sudo vi /etc/network/interfaces

and change it to

auto eth0
iface eth0 inet static
address xxx.xxx.x.xxx (provided by the university)
netmask 255.255.255.0 ('---')
gateway xxx.xxx.x.x    ('---')

and then restart

sudo /etc/init.d/networking restart

After that, i use ifconfig to confirm that my eth0 change to that IP, then I first try to access it from the local network, but it can't not be accessed anymore! The chrome says the connection to xxx.xxx.x.xxx is interrupted.

Now I am guessing I need to set the dns server somewhere, after my newbie effort once again, I found that I need to add my dns server into the /etc/resolv.conf, so i did

nameserver xxx.xxx.x.xxx
nameserver xxx.xxx.x.xxx
search web-server

also, I went to /etc/hosts and fix it to

127.0.0.1  localhost
my-static-ip web-server

and i save it and restart the whole networking. Still, I can't even access the Ip via my local network, and when I try to ping google from the server, it can't reach, it's as if the server has no internet. I can confirm there is internet because when switch back to dhcp, the google ping works just fine. so I guess I must miss something important, but I feel the university has already given me enough information to set up, maybe I need to direct the domain name to this IP? which i think it's not necessary because even the IP cannot be accessed.

Please enligten me! anyone! :) Thank you in advance.

UPDATE

I call them and they give me a new IP which works now...(so frustrated with them), using the static IP,

  1. now I can ping the gateway and get responses
  2. I try ping google using its IP 74.125.224.72 and it works too
  3. next I try ping www.google.com and its say "unknown hosts"
  4. I try access the static IP via browser in the local network, and it works too, but when I try browser in the internet, it does not work.

I guess my DNS server is not set right, what you guys think?

UPDATE 2

Oh right, everyone, I just notice that the /etc/resolv.conf is wiped after restart, so after filling in, now the pinging www.google.com works fine. However, the webpage still cannot be access via internet.

UPDATE 3

Also, I make sure my university did not block port 80 by changing the /etc/apache2/ports.conf to 8080, and as well as in the virtualhost file, still it can't be accessed through the internet, but only via local network. I found one good website for testing the internet visibility http://canyouseeme.org/. OH noo...I must miss something very little....

15
  • 1
    You're trying to do too many things at once. The result is that you'll break things that are working. For example, after you set up the IP address and gateway, you should have tested if the machine had connectivity, not if the web site was working. You get the web site working after you make sure the machine has connectivity. Likely everything was fine, the web server just wasn't bound to the new IP address. (And don't worry about the domain and DNS until after the web site is working by IP.) May 22, 2012 at 12:09
  • yah, sorry for not mentioning that @DavidSchwartz. After setting up the IP address and gateway at the very first start, I have try ping google or even my own gateway, but it says "Destination Host Unreachable", and i guess that means the server has no connectivity to the outside. But when I switch back to dhcp mode, the ping works fine with google and even my own gateway.
    – chaky
    May 22, 2012 at 12:14
  • When you ping (by IP) sites on the Internet, do you get an ARP reply from the gateway? (You have to do this methodically. Find the simplest case that doesn't work, then figure out the first thing that doesn't happen in that case.) May 22, 2012 at 12:25
  • No, I ping sites by ip like 74.125.224.72 and it says "Destination Hose Unreachable"
    – chaky
    May 22, 2012 at 12:33
  • Right, and do you get an ARP reply from the gateway? Please test precisely one thing at a time. A lot of things have to work for the ping as a whole to work. May 22, 2012 at 13:09

1 Answer 1

0

I think you've gone much too far with this and are getting lost, it definitely doesn't require you to set up a DNS server on your own!

First try connecting to http://127.0.0.1/ in your browser on the server. If this is working then your web server is definitely up and running on your server.

Now you need to set up port forwarding (Wikipedia). Port forwarding tells the router where to send incoming TCP/UDP packets of a defined port. For example, if, on your local network, your server's IP address was 192.168.0.5 and it was running a web server, you could tell your router to make a new port forwarding rule that redirects any TCP packets connecting to port 80 (http) to 192.168.0.5.

This is essential to allow people outside of your LAN to connect, as when you connect to a WAN like the Internet you are exposed principally via the router you are connected to. The router needs you to tell it where to send those incoming packets, depending on the TCP/UDP port of the packet received.

I know very little about university networking, and I assume you either connect through a router in your room, or straight into their network (more likely).

In the first case, you can just go directly to your routers homepage and log in as an administrator and add a port forwarding rule to send port 80 packets to your server's IP.

In the second case, you may need to talk to the network administrator.

After port forwarding is set up, you should be able to connect to the server from anywhere using the external IP with no problem.

Domain names are pretty simple, you just basically need to log in to the website of the domain name registrar that you bought the domain name from. They will have a section that talks about "Advanced DNS" or "DNS setup". You just need to go in there and point the A record for @ and www to your server's IP. This literally just maps www.yourdomain.com and yourdomain.com to your external IP address.

12
  • 1
    Thank you for your detailed step. Yah, I check with 127.0.0.1 and it works perfectly fine. The router is taken care by the university network admin, and I ask them to forward my port, but rather, they said no and give me a bunch of static ip, subnet mask, gateway, dns(primary,secondary). As for the domain names, really thanks for that info as that would really save my time in the future. Anyway, let me try talk to the network admin once again.
    – chaky
    May 22, 2012 at 12:19
  • @chaky, it sounds like you just haven't set up your server to bind to the static IP. It won't automatically do this, you have to set this up yourself. What network daemon do you use? Wicd has a really nice ncurses client and should be very easy to use to enter all that information you have. If you want any more information about anything, don't hesitate to ask! May 22, 2012 at 12:22
  • i am not sure binding the server to the static IP or not, but what I did is go to /etc/network/interfaces and change it to static and put my ip address, subnet, gateway and then restart the networking. Typing ifconfig also shows that the IP now changes to the static IP the university gave me. However, after changing to static, the connecitivity to the internet is gone.
    – chaky
    May 22, 2012 at 12:26
  • @chaky what are you putting in place of the xxx.xxx.xxx.xxx? May 22, 2012 at 12:27
  • if you mean the static ip, it's 222.229.72.114
    – chaky
    May 22, 2012 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .