.bat file to overwrite HOSTS file


Recommended Posts

Alright, first i'd like to say Hi to everyone :)

Secondly, here we go. Im a server admin for a large LAN event here in New Mexico and i've just completed setting up our Linux/Apach2/Php/Sql server. We've got a LAN php program called ALP. Essentially id like gamers to be able and access this site through an Intranet name as opposed to having register it for a DNS name and whatnot.

As far as i know i have very little options. We're not using a doman and do not have a domain server because we have a T1 line coming in and using a router to do DHCP. So... any advice as to how I can either create a .bat file that will edit everyones HOSTS file when they obtain an IP OR!! an easy way to change everyones IP for a DNS server and create a DNS server on a linux machine as well.

We'll be having about 150 - 200 people, so... going up to each and every computer will NOT be fun.

I can always use the IP of the LAMP rig, but itd be nicer to have a name associated with it.

Link to comment
https://www.neowin.net/forum/topic/538372-bat-file-to-overwrite-hosts-file/
Share on other sites

  Unholy Moley! said:
Setting up the DNS server on the machine or setting up a dyndns.com account and using that would be the best options. I would use dyndns unless you already have a DNS server program installed on a linux box.

But i want this for intranet use. that way instead of typing www.paglan.com if they type in paglan, it will take them to the ALP web page instead of our main Internet lan page.

And if i set up a DNS server, I have to go to each computer and edit their tcp/ip and direct them to the Linux DNS box.

  Unholee said:
But i want this for intranet use. that way instead of typing www.paglan.com if they type in paglan, it will take them to the ALP web page instead of our main Internet lan page.

Yes, with the DNS you control. That's why he's saying setup your own DNS server.

  Unholee said:
And if i set up a DNS server, I have to go to each computer and edit their tcp/ip and direct them to the Linux DNS box.

Assign it in the DHCP settings of your DHCP server.

  Joel said:
Yes, with the DNS you control. That's why he's saying setup your own DNS server.

Assign it in the DHCP settings of your DHCP server.

I see, i forgot which router he uses and its a Linksys Wrt54g. Looked at it and I can set the Static DNS server. W00t, makes things a lot easier :) Forgot that the Router can set the DNS statically as opposed to doing it on each client.

So your going to be handing out dhcp using a wrt54g to a "large" event with 150 to 200 people?? Is it like 20 people per computer or something??

Please do not take this the wrong -- but how exactly does someone become the server admin for an event of that size, and not seem to have a clue on how to setup and run either a real dhcp server and or dns? Exactly what part of the servers do you "admin"? ;)

Hey a wrt54g dhcp table might be able to handle 200 leases.. To be honest never tested its limits, but come really an admin for an event that is going to have 150 to 200 people, and your dhcp is going to be a linksys router? Let me stress that again REALLY???

Maybe I am reading it wrong -- but normally with a "large" event with say 200 people -- the computer ratio to people would be somewhat close?

You got my curiosity up though -- what exactly is a "LAN php program called ALP" ??

Not sure what a domain has to do with having a machine run 2k3, so they have a server admin -- but no servers? Or for that matter any linux distro out there can provide you with dhcp and dns.

Tell you what.. here is a simple free dhcp server you can run on any windows machine

http://perso.orange.fr/philippe.jounin/tftpd32.html

As to DNS.. BIND would be the first one I would recommend - yes it will run on windows based machines XP home or pro, etc.. Instructions on setting it up on its website.. If you do not like that one, then there's powerDNS -- another FREE one, and instructions on use and setup on the website.. Or there is posadis

Better yet, here you go

http://www.simpledns.com/

Both a DHCP server and DNS.. FREE 14 day trial -- I think what woud cover the length of your event? Or if you want to buy only $80..

Have Fun and good luck -- I have a strange feeling your going to need it ;)

Large amount of people

Connecting to an unknown network

Having a script attempt to change their HOSTS file

I guess most people run some kind of security software that will report attempts to change system files. You are going to have some seriously p'ed off people.

  BudMan said:
So your going to be handing out dhcp using a wrt54g to a "large" event with 150 to 200 people?? Is it like 20 people per computer or something??

Please do not take this the wrong -- but how exactly does someone become the server admin for an event of that size, and not seem to have a clue on how to setup and run either a real dhcp server and or dns? Exactly what part of the servers do you "admin"? ;)

Hey a wrt54g dhcp table might be able to handle 200 leases.. To be honest never tested its limits, but come really an admin for an event that is going to have 150 to 200 people, and your dhcp is going to be a linksys router? Let me stress that again REALLY???

Maybe I am reading it wrong -- but normally with a "large" event with say 200 people -- the computer ratio to people would be somewhat close?

You got my curiosity up though -- what exactly is a "LAN php program called ALP" ??

Not sure what a domain has to do with having a machine run 2k3, so they have a server admin -- but no servers? Or for that matter any linux distro out there can provide you with dhcp and dns.

Tell you what.. here is a simple free dhcp server you can run on any windows machine

http://perso.orange.fr/philippe.jounin/tftpd32.html

As to DNS.. BIND would be the first one I would recommend - yes it will run on windows based machines XP home or pro, etc.. Instructions on setting it up on its website.. If you do not like that one, then there's powerDNS -- another FREE one, and instructions on use and setup on the website.. Or there is posadis

Better yet, here you go

http://www.simpledns.com/

Both a DHCP server and DNS.. FREE 14 day trial -- I think what woud cover the length of your event? Or if you want to buy only $80..

Have Fun and good luck -- I have a strange feeling your going to need it ;)

Surprisingly enough it can handle DHCP leasing very well for large amounts of people. We had about 125 last time and had 0 problems. The gaming servers are uplinked with gigabit switches and every switch to peoples computers are gigabit as well. None of the servers had any lag and definetely no bottlenecking. Only problems we encountered were people using static ip adresses in their TCP/IP settings. I've already got the DNS server running though thx ;) Using DNSmasq (which can also be a dhcp server). Got it all up last night and working just fine.

As far as having another rig doing the DHCP, i've told the main guy who runs it we should try it. He doesn't think there will be a problem for the little linksys box to push out an extra 75 clients. But considering we're not loaded and are using most of our own private machines as servers, we're a little limited. A p4 2.8ghz 1gig computer is the ALP/SQL/Apache2 and now DNS server. An AMD FX-57 2gigs and x1800 is multiple BF2 servers, Multiple CSS servers, and about 4 CS 1.6 servers. Then we have an actual server rack that may do a lot of the filesharing (patches and that sort of things) and even more gaming servers. If you want to donate a computer as opposed to trying to mock something you haven't seen, I would be very greatful.

And ALP is "Autonomous Lan Party," which is a PHP "site" that helps run LAN's more smoothly. Essentially we can put in IP's of the gaming servers and people can just connect from the web site, they can create tech help tickets that are sent to admins, see results of tournaments, download files that we upload, see any news that we've posted, and see seating charts. Its basically to help make the tournaments faster so people see who they'll be playing against in which server and be able to connect to it w/out having to come up to us and constantly asking us. And a nicer thing is we can just port the SQL data from our website into ALP that way people don't have to register or anything, they just sign on and get to see whats going on AT the lan.

  MazX_Napalm said:
Large amount of people

Connecting to an unknown network

Having a script attempt to change their HOSTS file

I guess most people run some kind of security software that will report attempts to change system files. You are going to have some seriously p'ed off people.

It's not an unknown network and we'd make sure everyone was aware if we chose to do it that way. I just completely forgot that the router can do a static DNS and as soon as it was suggested, I got it all configured and done.

Edited by Unholee
  Unholee said:
And ALP is "Autonomous Lan Party," which is a PHP "site" that helps run LAN's more smoothly.
Well I have to say -- that software looks pretty slick! ;)

Honestly I was not trying to mock anything.. I just did not understand how someone that is suppose to be an admin for something like a 200 person lan party would need to ask how to setup dns or dhcp.. After they call themselves a "server" admin ;)

And DNSmasq is a great tool to provide dhcp and dns.. As I said before - Have Fun, and good luck.. Sounds like you wont need as much luck as I had thought ;)

  BudMan said:
Well I have to say -- that software looks pretty slick! ;)

Honestly I was not trying to mock anything.. I just did not understand how someone that is suppose to be an admin for something like a 200 person lan party would need to ask how to setup dns or dhcp.. After they call themselves a "server" admin ;)

And DNSmasq is a great tool to provide dhcp and dns.. As I said before - Have Fun, and good luck.. Sounds like you wont need as much luck as I had thought ;)

I know how to set up DNS and DHCP, but was forgetting that I can create a DNS server and have the router point to it as the primary as opposed to altering HOSTS files or manually setting Static DNS on each computer. I've taken CCNA classes and have my MCSE cert, so i'm not ignorant ;) If you want to discuss subnet masking, ip schemes, active directory, etc... i'd be down :p Ive been teaching myself Linux on Ubuntu and OpenSuse 10.2. I have virtual rigs of Windows 2000 and Windows 2003, which is no problem but wanted to go the Linux route with this stuff. I just had a large brain fart the day i asked, but luckily someone brought it to my attention and i got it all done.

I'll take pictures for you guys and let you know how the LAN turns out. I'm almost thinking of piecing together all my scrap parts and buying a mobo to make the DHCP/DNS server seperate from the LAMP server.

But essentially i've already got network layed out and figured out. It's going to be a 10 class A series ip scheme of a starting DHCP of 10.0.1.6 - 1 for DNS/ 1 for DHCP server, 1 for LAMP, 1 for AMD rig, 1 for other server rig). And if do the DHCP server, i'm just going to have the T1 line going into our 24port giga-switch and then go from there.

If anyone knows of any other programs to help keep large gaming LANs under supervision and stuff let me know. (dont want people going to porn and that kinda stuff :))

Edited by Unholee
  Unholee said:
If anyone knows of any other programs to help keep large gaming LANs under supervision and stuff let me know. (dont want people going to porn and that kinda stuff :))
Just run a transparent squid proxy with squidguard and your fav blacklist.
  BudMan said:
Nope never used that one - but have used this one

http://urlblacklist.com/

And a few others.. Like I said your fav blacklist ;) Or create your own from a few of them, etc..

Heh Shall's blacklist has over 1million entries now which is pretty cool, kinda ghetto that URLblacklist only allows 1 download lol

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Yeah, I've looked at all of these. Dante is a pro and expensive program, of course. I'm just looking for simple audio/music sharing from one PC/device to another. Voicemeeter is a lovely bit of kit, but the interface is NOT user friendly to set up initially, unless you are an audio engineer who thinks the way the program does. It works though. I just didn't feel the juice was worth the squeeze on that one. The other ones you mention have problems, like no longer maintained/updated, etc. Spotify does this, but only for music played by Spotify. Multiplicity does this (but isn't free) for all audio on one PC (like you'd want) but hiccups the audio on the source PC if too much CPU is used (so you really can't use a very old PC as a music/video/youtube player). If the two machines are side by side, you can use analog line out to analog line in, but then you are getting analog noise/problems. It's the simplest and most solution, of course.
    • Well, one right off the top of my head is if you're playing music on one computer but you want it coming through another computer, which is hooked up to speakers, a TV with built-in audio, etc. If the two machines are side-by-side, then you can even just use an old analog line jack out to line jack in but that comes with analog problems, of course. But if the two computers aren't in the same room and you're using something like Multiplicity (not the best example because Multiplicity actually has this audio network feature built in) to control the other, then sending the audio across ethernet would be highest quality. Note that Spotify also already does this. If you have the app installed on multiple devices you can control not only the song playback but also which device the audio is outputting from. Like your phone telling your PC to play the audio on the PC out to speakers. Etc. So, there are solutions. But when I saw it called "Shared Audio" I hoped it was a MS standard built into the OS for just this usage case, and not just a badly named new feature being tested.
    • Apple is giving the upcoming iPad Pro a second front-facing camera by Taras Buria The M4-based iPad Pro brought a few significant changes to Apple's high-end tablet, such as tandem OLED displays, a much-thinner chassis, camera changes, and a much more powerful processor. Its successor, the M5-based iPad Pro, is rumored to retain the current form factor without major changes. However, there is one rather odd hardware update that is coming with the next iPad Pro. A new report says that a successor to the current iPad Pro lineup will offer a more powerful Apple M5 processor and more cameras on the front. While Apple experimented with a dual-camera setup on the back of the recent iPad Pros (this was killed in the M4 generation), the front of every iPad has always had a single camera, minus the original one, of course, which had none. With the M5 iPad Pro, Apple is rumored to double the number of front-facing cameras for a rather odd reason. No, Apple is not using a dual-camera setup for depth of field effects or a wider angle. According to Bloomberg's Mark Gurman, the logic is much simpler: satisfy fans of the portrait orientation. The problem is that in the 2024 iPad Pro, Apple moved the front-facing camera to the longer side of the tablet, where it makes much more sense for FaceTime calls, selfies, and everything else. However, that makes the iPad a bit awkward to use when in portrait mode, especially when it comes to FaceID. Now, it appears that Apple wants to make both camps happy by adding another front-facing camera to the shorter side of the screen. There is no information on whether we will see just one more front-facing camera or the entire FaceID module. Given Apple's nature of blaming users for some of its device shortcomings (the infamous "you are holding it wrong" line), it is quite interesting to see Apple addressing a seemingly minor concern with such an overkill solution.
    • Hello! It's default behavior. I assume that F:\ and E:\ are external drives? My local drives are under This PC. So File Explorer is showing storage from different locations: This PC (under which are local drives) Mapped Network drives External USB drives The Network (under which, my NAS) You could drag the drive to Quick access to see it all the time, but in my case when I expand This PC, the local drives remain in view even when I close and reopen the window.
    • It also lost Window Share support, so can no longer share websites from Edge to it or files from Explorer using the Share button or photos from Photos app. Mind you, not that this is impossible from a webappp since the new Outlook does support Share and that's a web app.
  • Recent Achievements

    • Rookie
      Snake Doc went up a rank
      Rookie
    • First Post
      nobody9 earned a badge
      First Post
    • One Month Later
      Ricky Chan earned a badge
      One Month Later
    • First Post
      leoniDAM earned a badge
      First Post
    • Reacting Well
      Ian_ earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      496
    2. 2
      Michael Scrip
      206
    3. 3
      ATLien_0
      201
    4. 4
      Xenon
      136
    5. 5
      +FloatingFatMan
      117
  • Tell a friend

    Love Neowin? Tell a friend!