# Hosts file editing



## jgunning (Nov 26, 2013)

Hey guys,

So I work for a school and to this date we have supplied computers to all on campus, now the way we have been operating is we have an "Internet @home" and a "Internet @School" on the desktop. These shortcuts then do an xcopy a hosts file which over rights the one in C:\windows\system32\drives\etc\hosts
which allows them to use the  school or home internet. It also adds a reg key that puts in all the settings required in IE. so that all has been good. You just run the appropriate shortcut it does its thing and away you go.
NOW we have started a BYOD program and MAC's have appeared. Is it possible to do this same thing on a mac? Because we run a proxy and obviously this would stop them getting on the internet at home if it had a proxy in it for school internet.

Your thoughts and ideas are most appreciated!!

JG


----------



## kn00tcn (Nov 26, 2013)

OSX has a hosts file yes, unfortunately i dont know its location

this system sounds ghetto though, hosts/dns entries should be controlled at the router level unless this is for the clients to be able to use it all over the place (not in the same building/internet pipe)

what are the IE settings for?


----------



## jgunning (Nov 26, 2013)

We would be better off using the MAC address's of each machine to deermine the IP each time? so that each machine can be given a reservation on the network then be paired an IP to their MAC address. Yea? I definitely agree that this way is pretty ghetto at the moment.

Like this:
http://www.smallbusinesscomputing.c...9551/Networking-With-Address-Reservations.htm


The IE settings are just the standard, no popups, homepage, don't ask for location etc.


----------



## freaksavior (Nov 26, 2013)

kn00tcn said:


> OSX has a hosts file yes, unfortunately i dont know its location
> 
> this system sounds ghetto though, hosts/dns entries should be controlled at the router level unless this is for the clients to be able to use it all over the place (not in the same building/internet pipe)
> 
> what are the IE settings for?



Mac is Unix based so it's in /etc/hosts


----------



## Easy Rhino (Nov 27, 2013)

I am sorry but I have to say you are doing this all wrong. What is the point having separate hosts files? You are trying to control a network level thing using OS software. You need to setup a VPN for those you want to allow to connect to your network remotely. Then you need a domain controller so that those employees who want local access to your network have to login to the domain. Finally, you need a nameserver that each desktop points to. Yikes, if there was a security breach at your place of business I would not want to be the guy responsible for sorting it out!!


----------



## jgunning (Nov 27, 2013)

They are not accessing our system remotely at all. I am just talking about a hosts file for their home internet and a hosts file for their school internet. So when they go home their internet at home still works, otherwise with the proxy in for the school internet it would obviously not work! =P
But thank you, I know their are MUCH better ways out there.


----------



## kn00tcn (Nov 28, 2013)

so wait, how are they connecting at school for a hosts file to even be needed?

wired for example, connect to home ethernet that goes into router that goes into the world, just plug in & go.... at school, plug in to outlet... goes to router.. school network... how can it just not work?

i find it strange since the hosts file simply points domains to ips, so that's only useful for blocking things or enabling a private domain that you opt-in to have access to (well anyone would have access anyway if you directly use the ip without the domain)


----------



## Mindweaver (Nov 30, 2013)

I have to jump in and say I use, and have used the host file for years. It's an easy way to take stress off of old name servers. I don't add everything, but major shares I do add to the host file. I've used the host file for some tunneling as well. I try to optimize my network as much as possible and I have a solid network. But Easy Rhino is right as well, you'll want to have everything he suggested as well.


----------



## Easy Rhino (Nov 30, 2013)

What happens if you have to add a new server or the IP of a server changes? Do you ask for everyone to return their laptops for a day while you painstakingly update each individual one?


----------



## Solaris17 (Nov 30, 2013)

Easy Rhino said:


> What happens if you have to add a new server or the IP of a server changes? Do you ask for everyone to return their laptops for a day while you painstakingly update each individual one?



you can xcopy from unc paths. so technically only those addresses need to be static and you would only need to update the amount of original hostfiles you wish to use. in this case 2


----------



## Mindweaver (Nov 30, 2013)

Easy Rhino said:


> What happens if you have to add a new server or the IP of a server changes? Do you ask for everyone to return their laptops for a day while you painstakingly update each individual one?



Naw, just change the login script to run a bat file that changes it on startup.  easy pesy 
*
EDIT: Solaris17 you beat me.. My 1 year old is wide awake and wants to press every button on the key board.. lol*


----------



## Easy Rhino (Nov 30, 2013)

Mindweaver said:


> Naw, just change the login script to run a bat file that changes it on startup.  easy pesy



How is he going to change the login script? He doesn't have domain access to the machines.


----------



## Mindweaver (Nov 30, 2013)

Easy Rhino said:


> What happens if you have to add a new server or the IP of a server changes? Do you ask for everyone to return their laptops for a day while you painstakingly update each individual one?





Easy Rhino said:


> How is he going to change the login script? He doesn't have domain access to the machines.



He who? The end user never see's it or even knows what a host file is or what it does. The login script is at the PDC level where I have control over it. I have a primary host file in a shared location (_*Now this host file does nothing in the shared location.*_) I wrote in the startup script to check that file if the last time it was updated has changed (*In the event I add or changed something on the network.*) then the old host file on the computer connecting's would be updated.   That's as short and simple as I can put it buddy. It's all smoke, and mirrors .  or some would say magic.. lol  It's just one of the simple low cost methods I've used where the IT department has no money.. hehehe

*EDIT: I'm half asleep.. Just got up from a short nap. I think I know where you are not under standing me buddy. These are local network pc's that are on the domain.*


----------



## Easy Rhino (Nov 30, 2013)

But you have to have direct access to the machine to edit its startup script. So you still need to manually edit files for each machine.


----------



## Mindweaver (Dec 1, 2013)

Easy Rhino said:


> But you have to have direct access to the machine to edit its startup script. So you still need to manually edit files for each machine.



Nope your wrong buddy. I've been doing this for years. You set the Login script for each user when you create their account on the Domain controller _*(Example : PDC = Primary Domain Controller)*_.  You can have as many scripts as you want or one for each user, but if you do that then your looking for a lot of work down the road. I usually create Office, floor, etc.. scripts and just update those scripts as needed.


----------



## kn00tcn (Dec 1, 2013)

(as an aside, i dont think telling your users to download an updated script from an email/news post & having them run it is a problem, that way you crowdsource the access to the individual clients)


----------



## Mindweaver (Dec 1, 2013)

kn00tcn said:


> (as an aside, i dont think telling your users to download an updated script from an email/news post & having them run it is a problem, that way you crowdsource the access to the individual clients)



I don't know if I understand, "_Who is tell who to down load what?_". Nobody even see's the script or even know what the login script is used for.. It's something set at the DC level and when the user logs into a pc it reads the script. I've lost you guys or something.. Maybe it's me that's lost who knows.. I can't be the only person in the world that uses login scripts in the active directory for users, which is on the directory controller. And all I wanted to do is add that I use the host file at times as well.  I'm a sucker for the gift of sharing.


----------

