Go to Post FIRST has a funny way of connecting people... - Jaine Perotti [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-12-2012, 21:30
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Tool to Manage Static Computer IP

I made a script to toggle between a set static IP and using DHCP in Windows. I hope it's useful to someone.

You can always find the latest version at manitourobotics/tools/windows/

To setup:
  • Download and extract attached zip to this post
  • Install python2 if you don't have it
  • Copy config.example.txt to config.txt and configure static_ip and interface_type
  • Create a shortcut to net-connect.bat by right-clicking on the file and clicking "Create Shortcut"
  • After creating the shortcut, right click on it and click properties. In the shortcut tab, click advanced... and check run as administrator(this program always needs to be run as admin). Click ok * 2
  • Drag shortcut to your start menu for fast switching

Changelog:
1.2:
  • Rename config.txt.example to config.example.txt for easier renaming
  • Add Windows line endings to config.example.txt, so notepad doens't display the file in one line
1.1:
  • Add config file
  • Less arcane output
  • Better error handling
Attached Files
File Type: zip toggle-interface-1.2.zip (2.6 KB, 16 views)

Last edited by Azrathud : 31-12-2012 at 17:08.
  #2   Spotlight this post!  
Unread 30-12-2012, 21:33
nathan_hui nathan_hui is offline
Registered User
AKA: Nathan Hui
FRC #2473 (CHS Robotics)
Team Role: Alumni
 
Join Date: Feb 2012
Rookie Year: 2009
Location: Cupertino, CA
Posts: 228
nathan_hui will become famous soon enoughnathan_hui will become famous soon enough
Send a message via AIM to nathan_hui
Re: Tool to Manage Static Computer IP

Oh yea! This will be great. I've had too many problems with our programmers forgetting to reset the IP settings, and too many noobs forget how to do it.
  #3   Spotlight this post!  
Unread 30-12-2012, 21:48
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,044
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Tool to Manage Static Computer IP


http://www.chiefdelphi.com/forums/sh...ad.php?t=72308

http://www.chiefdelphi.com/forums/sh...ad.php?t=75780


  #4   Spotlight this post!  
Unread 30-12-2012, 22:36
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Re: Tool to Manage Static Computer IP

I did see those posts. I wanted something more flexible, and something requiring me to only click on one file(as in a toggle).
  #5   Spotlight this post!  
Unread 31-12-2012, 23:30
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Re: Tool to Manage Static Computer IP

For some reason I can't edit my posts. I made another tool that just shows network interface information.(I hate manually checking the Network adapter every time I'm curious about my current IP status)
Attached Files
File Type: zip interface-information-1.zip (1.5 KB, 11 views)

Last edited by Azrathud : 31-12-2012 at 23:46.
  #6   Spotlight this post!  
Unread 31-12-2012, 23:52
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Tool to Manage Static Computer IP

You could just go Start->Run->type 'cmd' (usually already typed in since I almost certainly used it last) -> ipconfig /all

Same thing for the config. I used to write Batch and Perl scripts to do it, then I got lazy and just remembered the command to type ('netsh interface ipv4 set address "Local Area Connection" static 10.0.33.217 255.0.0.0'). Roughly the same number of mouse strokes (which are highly more time-consuming than keystrokes), especially if I don't have the folder with the batch file open or I'm not on my computer.

My best solution is to just use WiFi only for real networks, and use wired Ethernet only for robot networks. But, in case I have to break this, then I can just type netsh and be done.

But, if you do still want to do it this way, it should be possible to do entirely in a shell script, reducing dependencies on a foreign machine to zero.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #7   Spotlight this post!  
Unread 01-01-2013, 00:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,044
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Tool to Manage Static Computer IP

Quote:
Originally Posted by Azrathud View Post
For some reason I can't edit my posts.
You have a 24-hour window after posting to edit or delete. Think of it as a 24-hour-cure epoxy.



Last edited by Ether : 01-01-2013 at 00:19.
  #8   Spotlight this post!  
Unread 01-01-2013, 00:26
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 945
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: Tool to Manage Static Computer IP

Along with Andrew's info you should be able to achieve a toggling script by using an environment variable.
  #9   Spotlight this post!  
Unread 01-01-2013, 01:19
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Re: Tool to Manage Static Computer IP

Quote:
Originally Posted by apalrd View Post
You could just go Start->Run->type 'cmd' (usually already typed in since I almost certainly used it last) -> ipconfig /all
ipconfig /all shows interfaces I don't care about. I really wanted a way to just show basic interface information that doesn't make me hunt for the information.

Quote:
Originally Posted by apalrd View Post
Same thing for the config. I used to write Batch and Perl scripts to do it, then I got lazy and just remembered the command to type ('netsh interface ipv4 set address "Local Area Connection" static 10.0.33.217 255.0.0.0'). Roughly the same number of mouse strokes (which are highly more time-consuming than keystrokes), especially if I don't have the folder with the batch file open or I'm not on my computer.
With using script to toggle between static and DHCP, I remove any errors that I may make with signaling what static IP I want(which avoids IP address conflicts), and it saves time and patience for me.



Quote:
Originally Posted by apalrd View Post
My best solution is to just use WiFi only for real networks, and use wired Ethernet only for robot networks. But, in case I have to break this, then I can just type netsh and be done.
Sometimes my team needs the robot to be using the wireless network for increased mobility(although I do generally use wired for the static internet-lacking network and wireless for internet access), and I use my personal computer to work on the robot, so, at the end of the day, I don't want my wired interface to be set to a static IP.

Quote:
Originally Posted by apalrd View Post
But, if you do still want to do it this way, it should be possible to do entirely in a shell script, reducing dependencies on a foreign machine to zero.
I opted for python over solely batch(thus not reducing the dependencies to zero) because batch makes simple things like storing the output of a program into a variable painful. I honestly tried to use only batch, but I couldn't bear using it after a point.

Quote:
Originally Posted by BigJ View Post
Along with Andrew's info you should be able to achieve a toggling script by using an environment variable.
Using an environment variable sounds kind of hackish; the only way I could imagine being able to make a toggle of sorts would be to stuff practically a batch script into a variable that I execute. I really don't want to use the command-line directly to execute my program because then I would have to worry about editing the path variable to where I store the batch files, and I would need to run the prompt as administrator to change my IP, and I would need to type in the program name, as to apposed to just hitting the windows key once, the down arrow key, and then enter as I have it now.

The work is done; feel free to use it or not.
  #10   Spotlight this post!  
Unread 07-01-2013, 16:26
DjScribbles DjScribbles is offline
Programming Mentor
AKA: Joe S
FRC #2474 (Team Excel)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Niles MI
Posts: 284
DjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to beholdDjScribbles is a splendid one to behold
Re: Tool to Manage Static Computer IP

Been a little curious about this, but haven't gotten around to trying it yet, but can you simply enable DHCP and make reservations for the CRIO MAC address (and camera(s) if needed)?

Seems like an even nicer solution than the batch/script files (which are a huge improvement over manually switching). The only downside is lost learning opportunity for the kids doing it.

Save the router config once you do it, and reload the config after each match
  #11   Spotlight this post!  
Unread 07-01-2013, 19:46
Lightfoot26's Avatar
Lightfoot26 Lightfoot26 is offline
Just Out For A Rip, Bud...
AKA: Seth Lightfoot
FRC #1625 (Winnovation)
Team Role: Mentor
 
Join Date: Dec 2009
Rookie Year: 2010
Location: Winnebago, IL
Posts: 120
Lightfoot26 is just really niceLightfoot26 is just really niceLightfoot26 is just really niceLightfoot26 is just really niceLightfoot26 is just really nice
Re: Tool to Manage Static Computer IP

also... http://www.chiefdelphi.com/forums/sh...16#post1089016
__________________
Winnovation Team 1625 (2010-??)
  • Electrical/Programming Captain (2011-2013)
  • Auxiliary Driver (2012-2013)
  • Team Captain (2013)
  • Alumni (Graduated May 2013)
  • Electrical and Programming Mentor (2014-??)
  #12   Spotlight this post!  
Unread 07-01-2013, 19:51
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Tool to Manage Static Computer IP

The driver station program should automatically set your computer's IP for you when you start it up, as long as you've properly configured the team number and NIC. I don't see the need for a different program to set the IP...
  #13   Spotlight this post!  
Unread 07-01-2013, 20:19
computerish computerish is offline
Registered User
FRC #0619
 
Join Date: Nov 2008
Location: va
Posts: 45
computerish is an unknown quantity at this point
Re: Tool to Manage Static Computer IP

Our team decided it was easier to just have two network interfaces. We picked up cheap network cards (you can find them for ~$10 each) and simply added a second interface card to our lab computers. Set the static IP on the robot interface and DHCP on the other one.

Bonus tip: You can buy a short ethernet cable and a straight-through double female RJ45 connector to extend your ethernet jack out to the edge of our desk. Helps a lot if your computer sits back under the desk.
  #14   Spotlight this post!  
Unread 07-01-2013, 22:38
Mike Copioli's Avatar
Mike Copioli Mike Copioli is offline
You make it pretty We make it dance
no team (Retired(3539, 217))
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2001
Location: Romeo
Posts: 453
Mike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond reputeMike Copioli has a reputation beyond repute
Re: Tool to Manage Static Computer IP

This is great.

Also you may use the 2CAN firmware utility to change ip's and switch between static and DHCP.

http://www.crosstheroadelectronics.c...tility_1_4.zip
__________________
Mike Copioli
CTRE Hardware Engineer
http://www.ctr-electronics.com

Team 3539 The Byting Bull Dogs
2013 Michigan State Champions
Team 217 The Thunder Chickens
2006 World Champions
2008 World Champions
2009 Michigan State Champions
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:39.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi