Hostname / web hosting issues
I've just delved into FreeBSD from the Linux world over the past week, and I've set up an Apache2 server. The server sits behind a router on my home network, and serves the internet through port forwarding. My router is set up as a DCHP server, and serves the home clients with dynamic IP addresses.
I've set a static IP address for the server, and from a web browser on my server machine (Phobos) I can access the web content through the host name, and server IP (http://phobos and http://192.168.2.10). HOWEVER, from other computers on the network, I can only access the web content through my servers IP.
Obviously, I think this is related to resolving hostnames from my XP machines so my attension is currently drawn to the /etc/hosts file on the FreeBSD server. The problem is also present when using any other piece of software (Such as PuTTy) on the the clients to access the server through the host name, and is not a browser related issue.
1) Am I doing something that shouts out as being obviously wrong?
2) My network has no domain, in hosts file listed as "phobos" not "phobos.my.domain" = same in rc.conf. Is the relevant/good practice Or am I doing something wrong/looking in the wrong direction?
Please help guys! I'm happy to provide file information, but currently unable todo so whilst posting.
# $FreeBSD: src/etc/hosts,v 1.16 2003/01/28 21:29:23 dbaker Exp $
# Host Database
# This file should contain the addresses and aliases for local hosts that
# share this file. Replace 'my.domain' below with the domainname of your
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
# Imaginary network.
#10.0.0.2 myname.my.domain myname
#10.0.0.3 myfriend.my.domain myfriend
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
# 10.0.0.0 - 10.255.255.255
# 172.16.0.0 - 172.31.255.255
# 192.168.0.0 - 192.168.255.255
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers. Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
# -- sysinstall generated deltas -- # Sat May 17 14:17:48 2008
# Created: Sat May 17 14:17:48 2008
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
# -- sysinstall generated deltas -- # Sat May 17 15:20:35 2008
# -- sysinstall generated deltas -- # Sat May 17 15:24:39 2008
ifconfig_rl0="inet 192.168.2.10 netmask 255.255.255.0"
# -- sysinstall generated deltas -- # Sat May 17 14:34:14 2008
# nsswitch.conf(5) - name service switch configuration file
# $FreeBSD: src/etc/nsswitch.conf,v 1.1 2006/05/03 15:14:47 ume Exp $
hosts: files dns
Running FreeBSD 7.
Last edited by vitiate; 19th May 2008 at 12:12 PM.
The other machines on your network cannot read the /etc/hosts on your web server. The only way you can access the system via hostname is:
1) On your windows machine, add an entry to the hosts file (I don't recall right now where that file is, someone with Windows may be able to help you).
2) On your router, depending on what it is, set an alias for 192.168.2.10 to phobos, and on your other systems make sure 192.168.2.1 (or whatever your router's IP is) is set as your nameserver.
I use a pfSense system as my router/firewall, and this is how I set up my network to resolve hostnames of all my systems.
I just saved a bunch of money on my car insurance by fleeing the scene of the accident!
The hosts file on Windows XP is: %WinDir%\System32\Drivers\etc\
Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Does anybody have any idea what I haven't configured correctly in FreeBSD? and, would turning my FreeBSD box into a WINS server fix the problem?
Your problem is only within your LAN. This is how routing works, it won't route out and then back in to the network, therefore you just need to put an entry in the hosts table of every machine on your network to access them within your local network. There is nothing wrong, this is how it is supposed to work. Everything should be fine from outside your LAN. Setting up a WINS server won't fix your problem.
Get your Windependence today!
|Thread||Thread Starter||Forum||Replies||Last Post|
|DNS Hosting||DraconianTimes||Off-Topic||3||29th September 2009 11:01 PM|
|Hosting a webpage for free in internet.||bsdnewbie999||Off-Topic||7||12th April 2009 02:38 PM|
|open source web hosting control panel's||crayoxide||General software and network||2||28th September 2008 11:42 PM|
|Hostname problem, and others||gaeilgeboy||FreeBSD General||3||7th July 2008 11:30 PM|
|KVM issues||lil_elvis2000||FreeBSD General||5||9th June 2008 07:55 PM|