Unfortunately, the answer is no. The hosts file is a static lookup file, and because of this it has no concept of multiple-address per name failover, round-robin, or other features baked into the name resolver.
You can specify multiple names for a given IP address, but not multiple IP addresses mapping back to a single name.
Dare I ask, why can't you access the external interface of the mailserver while internal to your office? We configure all of our clients to use Mail/Jabber externally so they never run into this issue.
Despite conventional wisdom, using the external interface when internally does not "pull all the way across the internet", if configured correctly, of course.
A friend of mine provided the answer via email....
Almost.
The purpose of the hosts file is to serve as a local supplement to a dns lookup (on linux, you can actually specify whether it asks DNS or the file first). As such, it is only used to return IP addresses. You need to use this in combination with Apache VirtualHosts to make apache respond to a host using a specific directory.
So... you hosts file should look like
127.0.0.1 local.wys
127.0.0.1 local.les
Find your apache configuration directory. Under XAMPP this is c:\xampp\apache\conf (yours might be ‘conf.d’)
In conf you’ll have a folder called ‘extra’ and it that a file called ‘http-vhosts.conf’. Open that file.
Make sure that the following line is uncommented
NameVirtualHost *:80
You’ll need a default entry, and then any specific ones for each hostname you want to use.
The default one...
<VirtualHost *:80>
ServerAdmin technical@satellite
DocumentRoot "c:/webroot"
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" combined
</VirtualHost>
The custom ones should look like this, replace ‘airbase.local’ with ‘local.wys’ and the value of document root to where you want it to start serving files from.
<VirtualHost *:80>
ServerName airbase.local
ServerAdmin technical@satellite
DocumentRoot "D:/webroot/airbase/magento"
ErrorLog "logs/airbase-error.log"
CustomLog "logs/airbase-access.log" combined
</VirtualHost>
Restart apache and it should all be working nicely!
Best Answer
/etc/hosts can't be used for that:
You can make
ssh alias
equivalent tossh host.no-ip.biz
orssh username@host.no-ip.biz
by adding lines like this to~/.ssh/config
: