DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 19th May 2008
vitiate vitiate is offline
New User
 
Join Date: May 2008
Posts: 2
Thanked 0 Times in 0 Posts
Default Hostname / web hosting issues

Hi there,

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.

Questions,

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.

Many thanks.

PS:

etc/hosts

# $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
# machine.
#
# 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.
#
#
::1 localhost
127.0.0.1 localhost
192.168.2.10 phobos
#
# 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.)
#

etc/rc.conf


# -- 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.
keymap="uk.iso"
# -- sysinstall generated deltas -- # Sat May 17 15:20:35 2008
moused_enable="YES"
# -- sysinstall generated deltas -- # Sat May 17 15:24:39 2008
ifconfig_rl0="inet 192.168.2.10 netmask 255.255.255.0"
defaultrouter="192.168.2.1"
ipv6_enable="YES"
hostname="phobos"
# -- sysinstall generated deltas -- # Sat May 17 14:34:14 2008
sshd_enable="YES"
gnome_enable="YES"
apache22_enable="YES"

and nsswitch.conf:

#
# nsswitch.conf(5) - name service switch configuration file
# $FreeBSD: src/etc/nsswitch.conf,v 1.1 2006/05/03 15:14:47 ume Exp $
#
group: compat
group_compat: nis
hosts: files dns
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files


Running FreeBSD 7.

Last edited by vitiate; 19th May 2008 at 12:12 PM.
Reply With Quote
  #2   (View Single Post)  
Old 19th May 2008
cajunman4life cajunman4life is offline
Real Name: Aaron Graves
Package Pilot
 
Join Date: May 2008
Location: Coolidge, Arizona
Posts: 203
Thanked 16 Times in 14 Posts
Default

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!
Reply With Quote
  #3   (View Single Post)  
Old 20th May 2008
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Thanked 112 Times in 104 Posts
Default

The hosts file on Windows XP is: %WinDir%\System32\Drivers\etc\
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.
Reply With Quote
  #4   (View Single Post)  
Old 20th May 2008
vitiate vitiate is offline
New User
 
Join Date: May 2008
Posts: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by cajunman4life View Post
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.
Thanks for this solution which appears as sound advice. Unfortunately my router doesn't have an option to set aliases, however, my router does list phobos and its IP address.

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?
Reply With Quote
  #5   (View Single Post)  
Old 20th May 2008
windependence's Avatar
windependence windependence is offline
Real Name: Tim
Shell Scout
 
Join Date: May 2008
Location: Phoenix, Arizona
Posts: 116
Thanked 4 Times in 3 Posts
Default

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.

-Tim
__________________
www.windependence.org
Get your Windependence today!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
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


All times are GMT. The time now is 11:42 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick