change /etc/hosts and services with location

spb

Registered
Hi,

I'm using a powerbook G4. I have three different network locations: home, work, and public.

At home and work I have several machines all connected via routers.

I want to be able to change the /etc/hosts file when I move from home to work.

I'd also like to know how to turn on and off services with location. There are some services that I don't necessarily feel safe running in public, such as, such as NFS and SMB.

Do I need a script to change the /etc/hosts and services or is there a way to connect this to the network-location switch?

Thanks,
sb
 
I thought all these things did get changed if you set up a location in the system prefs/network?

edit: btw, welcome to the boards.
 
When I switch between home and public I don't see a change in the /etc/hosts file.

Thanks for the welcome. I'm coming to Macintosh from Linux. Much of the Mac stuff I don't find very intuitive, so perhaps I'm not changing the hosts list properly.

I go into prefs, select "home", select apply, check that the network status is correct. Then I use emacs to edit /etc/hosts.

I then select "public", select apply, check the network status, and re-edit the /etc/hosts file.

When I go back to the "home" configuration the /etc/hosts has the changes I made to the public version.

Is there a Macintosh way to do this?

sb
 
Actually I don't think that the hosts file is synced with the location stuff. Is it even consulted by default or is all that stuff in netinfo? Could be it is in panther. What do you have in there anyway there may be a better solution in you present situation?
 
OS X will use NetInfo first. Not sure if there's a way to make it switch when chaning locations. I don't really know why you would want that either. When you are at home you can turn on the firewall to block everything, which may be easier than trying to change services.
 
I think that I need to read about NetInfo before I continue this discussion.

Thank you for your suggestions.
 
Back
Top