LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-01-2013, 10:44 AM   #1
teapottwo
Member
 
Registered: Sep 2013
Posts: 52

Rep: Reputation: Disabled
Local Test Network


Hey,

I'm after setting up various names for machines on my LAN (my side of router), its so I can test and play with virtual hosts on various servers httpd, lighttpd, nginx...

I have 3 machines, one will be running a server and i'd like the other machine(s) to be able to access it using 3 different names.


I've tried using "/etc/hosts" file by putting in:
Code:
192.168.1.5   tester   test
It works locally on the server but not on another machine (even with same hosts file entry), then I tried doing the same in "/etc/networks", also no joy. In addition i've altered a line in "/etc/hosts.conf" to
Code:
order hosts
each time using "/etc/rc.d/init.d/network restart" to restart the network (just to make sure???)

Any help appreciated



EDIT:
Running Fedora14 64 on all machines.

Last edited by teapottwo; 09-01-2013 at 10:50 AM.
 
Old 09-01-2013, 11:07 AM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Hey there,

This is your first day here! Welcome

I've got something pretty similar here, never used the hosts file. The server has a static IP address, as well as all the others...I do have a list (for reference) what IP is what. Give it a whack without the hosts file in the mix, just to see what that tastes like
If security is what you're after, config a firewall instead, UFW (Uncomplicated Fire Wall) is a great choice!

Thor
 
Old 09-01-2013, 11:12 AM   #3
teapottwo
Member
 
Registered: Sep 2013
Posts: 52

Original Poster
Rep: Reputation: Disabled
Exclamation

Quote:
Originally Posted by Thor_2.0 View Post
Hey there,

This is your first day here! Welcome

I've got something pretty similar here, never used the hosts file. The server has a static IP address, as well as all the others...I do have a list (for reference) what IP is what. Give it a whack without the hosts file in the mix, just to see what that tastes like
If security is what you're after, config a firewall instead, UFW (Uncomplicated Fire Wall) is a great choice!

Thor
Really? What about the virtual hosts bit? Your solution doesn't consider that!

And on your side note i'm fine with iptables thanks...
 
Old 09-01-2013, 12:33 PM   #4
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
Really? What about the virtual hosts bit? Your solution doesn't consider that!

And on your side note i'm fine with iptables thanks...
okay...
 
Old 09-04-2013, 03:06 AM   #5
teapottwo
Member
 
Registered: Sep 2013
Posts: 52

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Thor_2.0 View Post
okay...
Thanks Thor, a pointless ill thought out answer and therefore no other qualified responses, typical!
 
Old 09-04-2013, 03:31 AM   #6
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
Quote:
I've tried using "/etc/hosts" file by putting in:
Code:
192.168.1.5 tester test
/\
|
Just to be clear is that the way you have entries in your all three servers ?

how are you tying to use these names to access the other servers ?
 
Old 09-04-2013, 03:46 AM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Disclaimer: I run Slackware and know nothing Fedora specific...

But, I run a fairly extensive LAN just that way, with all machines in /etc/hosts and multiple virtual hosts for most machines on the LAN. In fact...

Code:
 wc -l /etc/hosts
180 /etc/hosts
I maintain a central hosts database and manually copy the hosts file around when something changes.

In my vhosts.conf I have a fairly basic definition for each one.

Other than restarting httpd for vhost changes, adding to my hosts file does not require any restarts.

You do not say, but have you tested reachability other than httpd request - ping if your firewall does not block them, ssh, etc? Just to separate the hosts address reachability from the vhosts config which is a mostly separate thing.

I would also guess that each machine is internet connected meaning they do all have network access, default routes and can see each other...?

[EDIT]
You should also set up the vhosts with the machine name, not just an arbitrary name.

For example, if the machine name were megabrain, then maybe something like this:

Code:
192.168.1.42 test.megabrain
And of course the address must be the actual network address of the machine.

Then in your vhosts.conf you would need two entries (simplified),

Code:
<VirtualHost *:80>
ServerName megabrain
DocumentRoot /srv/html
</VirtualHost>

<VirtualHost *:80>
ServerName test.megabrain
DocumentRoot /srv/html/test
</VirtualHost>
And of course the basic httpd.conf set up for localhost with vhosts.conf included.
[/EDIT]

Last edited by astrogeek; 09-04-2013 at 03:59 AM.
 
Old 09-04-2013, 11:05 AM   #8
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Quote:
Thanks Thor, a pointless ill thought out answer and therefore no other qualified responses, typical!
Well, it was the apt response to your pretty sharp reply...
Excusing myself from this pointless thread with these apt remarks: google is your friens, and a little honey goes a long way...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up tunnelling in local test environment ? your_shadow03 Linux - Newbie 0 02-02-2010 01:39 AM
What does [if test "/usr/local/bin/php" = '@'php_bin'@'; then] test for zhjim Programming 3 11-02-2009 02:33 AM
how to test DNS as local only packets Linux - Server 2 05-09-2007 10:21 PM
VSFTPD Local Test Palula Linux - Software 19 10-26-2005 08:58 PM
adding a domain to my local linux test pc? kane hart Linux - Newbie 3 10-14-2003 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration