Hosting Script

mrayfield
New Contributor II

Does anyone have a bash script that will allow adding a networking host during imaging? Essentially we want to make sure all of our machines point to our server IP address. If you need an example type:

sudo vi /private/etc/hosts

to see your hosting file.

8 REPLIES 8

gachowski
Valued Contributor II

Not even remotely sure, but I have read somewhere that "/etc/hosts" is deprecated...

C

mrayfield
New Contributor II

@gachowski any good ideas on ways to change a server IP and ensure all of the machines can still see it?

davidacland
Honored Contributor II

Can you not do this with a DNS server?

mm2270
Legendary Contributor III

^ Same thought as @davidacland If the server has had its IP changed, making sure clients can still connect is typically done with DNS these days. Get the server using an FQDN instead of an IP and there shouldn't be any issues. Trying to do this with a local hosts file is kludgy at best.

gachowski
Valued Contributor II

Myles, I don't sorry and I really don't understand what you are trying to do... I would also not trust my "/etc/hosts is deprecated" it still might do what you want it too....

http://apple.stackexchange.com/questions/158117/os-x-10-10-1-etc-hosts-private-etc-hosts-file-is-being-ignored-and-not-resol

C

calumhunter
Valued Contributor

DNS does this, its a cool new service thats been around for a couple of years now

mrayfield
New Contributor II

@mm2270 & @gachowski I wish it was in my hands to actually use DNS but the Network setup is not in my hands totally. So this is what I have to do until I can get the Network Engineer to use a different practice. If I'm missing something about DNS and the JSS then I will surely take the advice.

The only thing I'm looking for is a script to run on all of my machines to add a hosting file on my Macs.

jarednichols
Honored Contributor

This isn't going to help you, but I'd strongly recommend getting DNS in place and to a point where it's robust and healthy. Apple products heavily rely upon good DNS and it's not there, you're going to run into issues.