Home▸
Forums▸
what's the Mac equivalent of the "hosts" file in Windows?▸
what's the Mac equivalent of the "hosts" file in Windows?
Thread
what's the Mac equivalent of the "hosts" file in Windows?
Hi All,
I've received some advice from some well meaning gurus in another forum that will solve a problem of mine, but it requires me to edit my "hosts" file, in Windows. They don't know I'm running Macs (and I'd prefer to keep it that way).
The problem: I'm running a LAN behind a firewall, have just registered a domain name pointing at the router (which forwards http requests to the webserver which is also behind the firewall on the LAN) and want to be able to enter my domain name in my web browsers/email clients/etc instead of having to enter the internal LAN IP address (which I have to do now).
Problem: this isn't working (firewall probs), and my guru friends have pointed out that I can remap requests to this domain name by adding a line to my "hosts" file that will point to the internal server on the LAN.
So, what's the equivalent of the "hosts" file on the Mac? (one machine is running OSX 10.15, the other OS9.2.2). Help?
Chas
I've received some advice from some well meaning gurus in another forum that will solve a problem of mine, but it requires me to edit my "hosts" file, in Windows. They don't know I'm running Macs (and I'd prefer to keep it that way).
The problem: I'm running a LAN behind a firewall, have just registered a domain name pointing at the router (which forwards http requests to the webserver which is also behind the firewall on the LAN) and want to be able to enter my domain name in my web browsers/email clients/etc instead of having to enter the internal LAN IP address (which I have to do now).
Problem: this isn't working (firewall probs), and my guru friends have pointed out that I can remap requests to this domain name by adding a line to my "hosts" file that will point to the internal server on the LAN.
So, what's the equivalent of the "hosts" file on the Mac? (one machine is running OSX 10.15, the other OS9.2.2). Help?
Chas
I don't know for OS X, off the top of my head, but in Mac OS 9, you can create a standard UNIX-format hosts file and save it somewhere on your hard drive. Then open the TCP/IP control panel, set it to Advanced user mode, after which a "Select Hosts File..." button will appear. Click it and choose your hosts file. Voila!
tooki
tooki
Just edit /etc/hosts using an admin user.
This problably won't help though as your name resolution is done through netinfo.
You need to add the hosts file to you netinfo db.
If your hosts file is in the format
xxx.xxx.xxx.xxx some_machine_name
Then you can login as root (not admin but root)
$ niload hosts / < your_hosts_file
You have now added you hosts file to the netinfo db.
you can use things like nicl to look around it.
You can take a backup by copying /var/db/netinfo/*.nidb to another dir.
Hope this has helped.
Dobby.
This problably won't help though as your name resolution is done through netinfo.
You need to add the hosts file to you netinfo db.
If your hosts file is in the format
xxx.xxx.xxx.xxx some_machine_name
Then you can login as root (not admin but root)
$ niload hosts / < your_hosts_file
You have now added you hosts file to the netinfo db.
you can use things like nicl to look around it.
You can take a backup by copying /var/db/netinfo/*.nidb to another dir.
Hope this has helped.
Dobby.
dobby and tooki,
just the replies I was looking for guys, thanks! How'd you know I was running some machines on 9 and some on X?
btw tooki, I've wondered what that "select hosts" button was for _ages_, mystery now solved!
Can always trust the MacNN community to come through :-)
Chas
just the replies I was looking for guys, thanks! How'd you know I was running some machines on 9 and some on X?
btw tooki, I've wondered what that "select hosts" button was for _ages_, mystery now solved!
Can always trust the MacNN community to come through :-)
Chas
No need to load them into netinfo in 10.2. As I understand it, lookupd will now search for your hosts files before searching netinfo and other data sources. It's BSD-like now, just edit your hosts files and they will function properly.
Y
Y
Quote:
|
Originally posted by dobby: Just edit /etc/hosts using an admin user. This problably won't help though as your name resolution is done through netinfo. You need to add the hosts file to you netinfo db....(snip) Dobby. |
Quote:
|
Originally posted by yuriwho: No need to load them into netinfo in 10.2. As I understand it, lookupd will now search for your hosts files before searching netinfo and other data sources. It's BSD-like now, just edit your hosts files and they will function properly. Y |
Only if you run /Utilities/Directory Access and enable BSD Configuration Files. Then /etc/hosts is consulted. Solved some problems for my LAN...
--Josh