Quote:
|
Originally Posted by diyfiesta
Yikes! yes to running httpd on both machines (although I don't really need to), the problem I had was around httpd not having a server name or some such hilarity;
|
That's OK, although in view of potential security holes - I'd personally only run httpd on a machine if its needed. Hence I have one machine which is the server and others which tap into that server. If you are using machine 1 and want to view the web server running on machine 1 you can type
http://127.0.0.1/ on your machine to view it. That's the lopop back address and should display a web page on virtually any PC anywhere in the world that's running httpd! However if you type the same address into machine2 you'll see the httpd server on machine2 - if you want to see machine1's content you either need to type
http://192.168.1.23 or a host name if one is configured. (There may be firewall rules, host.allow host.deny rules etc to open up as well.)
It may be possible with a well configured system running DHCP to type "machine1" in and it be translated to 192.168.1.23 -- I don't know?
However if you added
Code:
192.168.1.23 machine1
to the hosts file
on machine2 and then type
http://machine1/ in the browser it will display just like you typed the numbers. You could also use 192.168.1.23 linux-machine.toby.com (but that measn you have to type more in the browser!!)
HOWEVER none of that will affect the email! /etc/hosts is only read when your PC needs to know how to resolve a domain name before it tries the DNS server. It doesn't describe your local domain name!
Quote:
I tried running # hostname new.name but it didn't seem to change the /etc/hosts file. It did return the new entry though when I ran 'hostname' with no parameters. I got scared so set it back oh, it couldn't ping it either but I may be doing something wrong.
|
Don't be scared!! Penguins don't usually bite but they can sometimes give you a nasty slap with their flipper!!

#hostname new.name is the
only way you'll get the machine to believe its got a new name! That should translate into your email (but as email is already configured there may be a config file that pulled out of date info...)
Note -if you open a terminal window you see something like:
username@localhost directory$
That localhost should change to be machine1 or whatever. This sounds like a trivial thing but if you ever use SSH to connect into the other machine (you might not now, but give it a few years!) it measn you actually know which user you are logged in as on which machine... its all much clearer.
Quote:
So, in summary are you saying that if I change my /etc/hosts to something like;
127.0.0.1 localhost machine1
192.168.1.23 linux-machine.toby.com machine1
that sending mail out will result in mail addresses like
root@linux-machine.toby.com
|
NO!
/etc/hosts will only change how domain names are directed. It won't change your email. But you will probably also want to change the hosts file - otherwsie ping wont work from machine1 to machine2!
Quote:
|
? I think I need to keep the loopback in there(?) and arn't sure if having two aliases the same (machine1 above) is invalid.
|
Yes you need loopback.
Two aliases the same? not sure - probably not - but it only needs one.
Here's the suggestion:
Code:
Loginto machine 1
$ su
# hostname linux-machine1.toby.com
# vi /etc/hosts
edit it to:
127.0.0.1 localhost machine1
192.168.1.23 linux-machine1.toby.com
192.168.1.24 linux-machine2.toby.com machine2
# ping machine1
# ping linux-machine1.toby.com
# ping machine2
# exit
---
Log into machine 2
$ su
# hostname linux-machine2.toby.com
# vi /etc/hosts
edit it to:
127.0.0.1 localhost machine2
192.168.1.23 linux-machine1.toby.com machine1
192.168.1.24 linux-machine2.toby.com
# ping machine2
# ping linux-machine2.toby.com
# ping machine1
# exit
Then either use
Code:
$ mail root
(you leave the editor by putting a line with just a . on it)
or wait for logwatch to send the mail... and see what happens. It may STILL not know that the email domain has changes - but that's easy sorted with config files if we need to.. (it might be worth restarting sendmail etc first though incase it can pick them up when started.
ACTUALLY - I just looked at my LogWatch to see what it contains... the
root@localhost.localdomain still appears (will need to check why!) BUT - the subject line contains the server domain...