![]() |
Batch files to switch between DHCP and Static IP
I made these batch files to switch between Static IP and DHCP in Windows. I use them because I use my laptop's Wireless at school, and wired to program our robot, but at home I use the Wired.
To use them, just paste the commands in notepad and save as a .bat (EG: "cRIO Mode.bat" or "Internet Mode.bat") cRIO / Static IP Mode: Code:
@echo offDHCP Mode: Code:
@echo offPS> If you typically use a static IP when not talking to your robot, and you need to configure DNS servers too, then use these commands: Code:
netsh interface ip set dns "Local Area Connection" static 208.67.222.222 |
Re: Batch files to switch between DHCP and Static IP
Thanks,
Been switching 4 times a day. PGR |
Re: Batch files to switch between DHCP and Static IP
No problem, glad sombody else found it useful!
~DtD |
Re: Batch files to switch between DHCP and Static IP
Helps with more than just robotics. I have to switch all the time for various reasons. This will make life so much easier. Thanks.
|
Re: Batch files to switch between DHCP and Static IP
I got tired of switching back from static to DHCP...
I found a way to set the router to hand out DHCP addresses at 10.XX.XX.6 so your laptop doesn't have to switch to static. DHCP router settings can be a problem if you have many laptops that are all trying to program and connect to the router at the same time. |
Re: Batch files to switch between DHCP and Static IP
Just a tip. If you try to do this with Windows 7 (and I believe Vista as well) the syntax will be slightly different.
Code:
netsh interface ip ....Code:
netsh interface ipv4 ....Code:
netsh /? |
Re: Batch files to switch between DHCP and Static IP
Just so you are aware, you only need to be 10.x.x.6 if you want to be the Dashboard machine.
You can download and/or run using any 10.x.x.* address. The Dashboard.VI even has a forwarding address to redirect that data to another machine. We setup our wireless router to give out 10.x.x.50 and above IP addresses, so we can still DHCP setup. 10.x.x.1 Wireless Bridge on Robot 10.x.x.2 CRIO 10.x.x.3 Reserved 10.x.x.4 Wireless Router 10.x.x.5 Driver Station/Classmate 10.x.x.6 Development System Last year a PC instead of the Classmate with an address of 10.x.x.6 could be used as a Dashboard display machine. |
Re: Batch files to switch between DHCP and Static IP
In general, I have noticed that the cRIO and friends are MUCH less finicky about what thier IPs are and such. We only used static for reimaging the cRIO. I have tested numerous network configurations, and both Windriver and the Driver Station (Updated One) seem to always find it.
EG: One of the configs I did was: cRIO <-> WiFi Brick (The black one) WiFi Router (One with the blue spoiler) <-> Internet My dev laptop and Driver Station connected to WiFi router over WiFi. (DS needs to be updated or this fails, set up WiFi network in Developer) If you do use WiFi with the Classmate, I HIGHLY advise you delete the WiFi profile before competition, the Classmate did not like it with WiFI attempting to work and connection over LAN. ~DtD |
Re: Batch files to switch between DHCP and Static IP
I use WinXP Professional at home and office. Although I have the same ISP at both, I am required to change the IP address depending on where I am.
I need one script or batch file that I can run under WinXP that will automatically change my IP from: 172.16.10.23 to 192.168.11.8 Then another script that will change it back. Hopefully a simple problem if you know how! Thanks |
Re: Batch files to switch between DHCP and Static IP
Yes, it should be simple. Just use the first command. I belive 10.23.34.6 is the ip address, and 10.23.34.4 is the gateway.
Just put in your addresses! ~DtD |
| All times are GMT -5. The time now is 03:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi