Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I intent to develop a centos server with lamp. What I want is connect the server to any kind of home network and access it by http://myserver. I have already successfully set a static ip but I can't seem to ping it by name.

If you had to develop a solution with the intent to plug in the box by Ethernet to a router and access it with a browser using the server name what would you do? That's basically what I'd like to know.

Thanks in advance

share|improve this question
    
if you set a static ip and this is not in the subnet that the home user has then it wont work –  JamesRyan Dec 21 '10 at 14:33
add comment

5 Answers

up vote 1 down vote accepted

It sounds like you might want a Windows PC to be able to find the server. To accomplish this without setting an entry in each Windows PC's hosts file, you'd just install and configure Samba:

http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-samba.html

Samba will automatically publish the server's (short) hostname using WINS to the workgroup you specify in Samba's configuration. And then on any Windows PC in the network you should be able to use http://servername/

share|improve this answer
    
That was simply amazing. It was exactly what I was trying to find for two days and you simply put it as simple and as right as possible. Thanks so much –  doubter Dec 21 '10 at 19:51
add comment

A home router that includes DNSMasq for DHCP/DNS will let you set a static lease and local DNS zone. I use a Linksys WRT-54GL with Tomato firmware to do this.

Barring that, the quick and dirty way to do what you want is to set a static IP address and create a hosts file entry on your workstation that maps the static address to a name.

share|improve this answer
add comment

I've never been able to get this to work with DHCP. I've always used static ips for the servers for internal purposes. You will also need to have an internal DNS server that you have set to check on your windows box. For my internal servers, I make our DNS on each windows machine first check the internal DNS server, then check external servers. :)

http://studyhat.blogspot.com/2010/02/setting-dns-server-with-bind.html

share|improve this answer
    
But I don't need it to be accessible from the outside. I simply want a web server which I can access from inside my network. I can set it with static ip, as I have already done, but I want to access by name not ip with firefox. And thanks very much for the response –  doubter Dec 21 '10 at 12:49
add comment

Just taking duffbeer's answer a little further - dnsmasq is a very useful tool - though not necessarily what every router uses. Its not exactly clear whether you're just trying to get your own setup working or create a packaged solution for use by other people.

If you want to hold the DNS info on the server, then that implies that you also need to either reconfigure every client to use the server for DNS, or provide DHCP from the server. The latter implies that you'd need to disable (or restrict) DHCP on any pre-existing router.

Either approach entails that you need to provide information to the installers of how to configure any router!

Given that most sensible Operating Systems (including Centos) can provide all the services of a router, and that in some cases, users may be using a cable modem or other such device which is not a router, it would perhaps be more sensible to make the default setup of the server as an internet gateway, with an option of running a DHCP server - and if the user already has a router, then provide a couple of simple programs downloadable to USB/CD which add the device to the client hosts file.

If you just want to get it up and running on your own network, then the solution would be to run DNSMasq on the server or use the facilities of the router or add an entry to the hosts files on the clients.

share|improve this answer
add comment

You could get a standard public dns server and point the domain to your static ip. Then it will work anywhere even though it would be actually pointing to several individual servers locally.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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