Can it be done?

shoelesscraig

Member
Join Date
Apr 2009
Location
LA
Posts
382
I had an idea but I'm not sure if it can be done. Input is welcome.

The laptop I use at work sits in a cradle on the network, and it uses DHCP so the IP address is assigned to it. When I take it out into the plant to use it on a PLC that uses ethernet to communicate I have to change the IP address in the "network settings" to something that allows me to talk to the machines. Then I have to set it back when I'm done. I was wondering, is there a way to create a batch file that will change the address for me so I do not have to go into the "network settings" every time to do this? And then maybe have another to send it back to automatically detecting the address?

Or if someone has a better idea, I'm up for that too! And if this is not possible, its no big deal. Just thought I would ask!
 
Do a search here, there are a number of threads that deal with this problem. Also, what Operating System are you using? The answer to that question makes a difference. The TCP/IP Stack operates differently on different Operating Systems.

Stu......
 
I use a simple batch file with the following:
For DHCP
netsh interface ip set address name="Local" source=dhcp
netsh interface ip set dns name="Local" source=dhcp

netsh interface ip set address name="wireless" source=dhcp
netsh interface ip set dns name="wireless" source=dhcp
And for Static:
netsh interface ip set address name="Local" static 10.1.1.90 255.255.255.0 10.1.1.254 1
netsh interface ip set dns name="Local" source=static addr=10.1.1.254 register=PRIMARY
netsh interface ip add dns name="Local" addr=10.1.1.215 index=2

netsh interface ip set address name="Wireless" static 10.1.1.91 255.255.255.0 10.1.1.254 1
netsh interface ip set dns name="Wireless" source=static addr=10.1.1.254 register=PRIMARY
netsh interface ip add dns name="Wireless" addr=10.1.1.215 index=2
I actually have a bunch of 'static' files, for different customers sites & configuration.

This method does depend on your adaptor having the same name, but that is just a formality...
 
I'm going to presume Windows XP for now.

The really simple way that I handle this is to stick with DHCP automatic configuration for your TCP/IP protocol, but to click the "Alternate Configuration" and put in a static IP address configuration that works with the automation network.

When you plug into the automation network, the computer will try to get a DHCP address just like when you plug into the enterprise network. But after about 45 seconds, it will give up and go to the Alternate Configuration address.

Sometimes that timeout is an annoyance, but not enough to make me take the time to learn how to do this with a batch file. If that's something you'd like to make part of your skill set, do some searching here on the Forum for the excellent examples that have been given by members over the past few years.
 
nice procedures and ideas.

I did it completely different.

Use an USB-Ethernet adapter for INTRANET and connect with the built-in one to the PLC.

Works without any troubles ....

br
bb
 
I use the NETSH method. Easy and does not require any additional software.

However, on a colleagues PC which is supposedly the same as mine, NETSH does not work. Both are Win XP Pro.
 
Here are the batch files I use. I have shortcuts to each one on my desktop.

This one sets my computer to a fixed IP
Code:
@echo off
Echo Setting IP address to static 192.168.10.109
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.10.109 mask=255.255.255.0 
ipconfig
pause


This one sets it back to DHCP
Code:
@echo off
echo Setting IPaddress to DHCP
netsh interface ip set address name="Local Area Connection" source=dhcp
ipconfig
pause

However I am finding that I'm not using those much any more. I have a small Netgear wireless router that I plug it into the PLC and it issues the IP address to my laptop. Its really quite handy to be able to roam about the machinery with my laptop in hand and not be tethered to a cord.
 
Here are the batch files I use. I have shortcuts to each one on my desktop.

This one sets my computer to a fixed IP
Code:
@echo off
Echo Setting IP address to static 192.168.10.109
netsh interface ip set address name="Local Area Connection" source=static addr=192.168.10.109 mask=255.255.255.0 
ipconfig
pause
This one sets it back to DHCP
Code:
@echo off
echo Setting IPaddress to DHCP
netsh interface ip set address name="Local Area Connection" source=dhcp
ipconfig
pause
However I am finding that I'm not using those much any more. I have a small Netgear wireless router that I plug it into the PLC and it issues the IP address to my laptop. Its really quite handy to be able to roam about the machinery with my laptop in hand and not be tethered to a cord.

Thanks for the responses everyone! Alaric, thank you for this code. That is exactly what I am looking for.

I hear what you are saying about the wireless, but unfortunately, that is STRICTLY forbidden in my workplace. I guess they are scared someone will try and steal our "top secret" info...(trust me, its anything but impressive!)
 
I'm going to presume Windows XP for now.

The really simple way that I handle this is to stick with DHCP automatic configuration for your TCP/IP protocol, but to click the "Alternate Configuration" and put in a static IP address configuration that works with the automation network.

When you plug into the automation network, the computer will try to get a DHCP address just like when you plug into the enterprise network. But after about 45 seconds, it will give up and go to the Alternate Configuration address.

Sometimes that timeout is an annoyance, but not enough to make me take the time to learn how to do this with a batch file. If that's something you'd like to make part of your skill set, do some searching here on the Forum for the excellent examples that have been given by members over the past few years.

I use this method but I'll go you one step further.

First, use DHCP to obtain network access. Then at a command prompt (Start - Run - cmd) type the following:
ipconfig /all

Write down what it gives you for IP, DHCP & DNS.

Then I change to a static IP that matches the DHCP format (or just use the one DHCP gave me) and configure the DHCP & DNS servers appropriately. Now I'm static but can access the company network. (I realize this might eventually conflict, but has worked for me for several years.)

This eliminates the delay when using an alternate configuration at the PLC.
 
Cable to the machine, wireless to the office. Now you can be connected to everything you want at the same time. I also keep a Wireless N Router for Commissioning, so I can do the opposite and play with machines in the workshop while I'm in the office.
 

Similar Topics

Just a small rant incase nobody downloaded or noticed yet.... but working on a new project in the latest version so I could test out FT Echo...
Replies
7
Views
1,156
See the attached image. The Datalog should be created when I press Report_Button_Pressed on the HMI. This image is taken when I pressed the...
Replies
13
Views
1,072
Hey guys! I'm a newbie in the control area, so I'm gonna drop some thoughts here... We want to control the opening of big silos (about 1900...
Replies
6
Views
1,484
Apparently, they are not compatible and i was hoping there was a work around.
Replies
0
Views
684
Hi, I'm currently working with a Telesis Scriber and I have not figured out how to have its Done output be turned off automatically after each...
Replies
1
Views
728
Back
Top Bottom