Port forwarding is an easy way to access CLICK PLCs that on their own network behind a router,
BUT it’s not a very secure way to access those CLICK PLCs. So if network security is
a concern for you, then you’ll want to use a Virtual Private Network or VPN to access
your CLICK PLCs. We’ll cover VPN’s in a separate video.
In this port forwarding demo we’ll be using a PC at IP address 172.31.51.60 going to a
router on the same subnet at dot 57. The CLICK PLCs will be behind that router on their own
local 192 dot 168 network at these addresses. To communicate the CLICK PLCs, we’ll send
all of our messages to the router over this 172.31 network, but we’ll append a unique
port number to the routers IP Address to tell the router which CLICK we want to talk to.
Inside the router, we’ll setup a table to cross reference those port numbers to the
local network IP Addresses where the CLICKs are. So the router will take messages sent
to it and use the appended port numbers to figure out which CLICK to forward the message
to – hence the name “port forwarding.” We’re using a Cisco Linksys E1000 router
and it has a dedicated port to connect to the external network and four ports for the
local area network – or LAN. Let’s connect the external network port on the router to
the PC using this USB to Ethernet Adapter. I’ve already set up the adapters IP address
to 172.31.51.60 – that we’ll be using in this demo – your network will probably
have a different IP Address, of course. That takes care of this connection. I we’ll connect
a laptop PC to one of the LAN ports on the router and set it to this IP address so we
can configure the router using it’s default 192.168.1.1 IP Address and access it’s built-in
configuration utility. Do you have to use two PC’s like this? No, you could use one,
but then you have to keep swapping cables and network adapter configurations and IP
Addresses and it is real easy to get things mixed up and confused and when you do that
and it just creates unnecessary frustration. Keeping them separate like this makes it really
easy to play with the router settings from the LAN side while you are tweaking your PLC
network on the external side of the router. So having two PCs like this just keeps things
clean and simple. Let’s also add the CLICK Ethernet connections
to the LAN Side of the router. Now I’ve already setup the CLICK Ethernet IP Addresses
before I started this video. If you need to see how to do that check out the CLICK Ethernet
PLC Quick Start Video. OK, we’re all wired up and the networking
around the router is configured so now we need to setup the router. That’s over on
the laptop, so you can’t see it on this video, so I’m going to just show you screen
shots of what that looks like. From the laptop, I logged into the router using its default
LAN IP Address which for this router is 192.168.1.1. There was a login screen which for this router
was admin, admin. In the Basic Setup Menu this router was setup
for DHCP so it would get its IP address automatically from the network. I changed it to a static
IP and mask to ensure it’s on the same subnet as the PC with the CLICK software which was
at 172.31.51 dot 60. So I just set the router at dot 57 so it would be different than the
dot 60. And even though we don’t have a gateway in our simple little demo here, this
router required I enter something so I used this. If you ARE going through another router
then you will want to add its IP Address here as the gateway. I also had to go over to the
security page and turn off this filter internet requests so I could ping the router and test
my connection. OK, that takes care of the external PC connection
to the router. If I ping the router from the PC, sure enough I see a response. Perfect.
This side of the router is ready to go. Now let’s do the LAN side of the Router.
Back on the Basic Setup Menu, we’re using the routers default LAN IP Address here with
this subnet mask and we don’t need the DCHP since we are only talking to our CLICK PLC’s
which all have fixed IP Addresses. I did a ping from the laptop and sure enough
I could reach both CLICK PLCs. So all the networking on this side of the router seems
to be working. Perfect. I should mention I also turned off the wireless
functionality of this router. The IT guys here hate it when we bring up extraneous Wi-Fi
signals … OK, and Finally, if we go over to Port Forwarding
- which on this router is under Applications and Gaming – you can see I gave each CLICK
a name, specified the port numbers that will come from the CLICK Development Software on
the PC, the local IP address of each CLICK PLC and the CLICKs Port Number. That’s the
same fixed port number on every CLICK PLC – which by the way corresponds to C L I
C K on a telephone keypad. So any messages that come into the router on this port number
will be forwarded to this IP Address and this port number. Any message that comes in with
this port number will be set to this port number and IP Address. Here’s a key point
– the router you use has to have the ability to specify the CLICK PLCs port number like
this. Some of the routers I tested wouldn’t let me specify the CLICK’s port number so
I couldn’t use them for port forwarding to a CLICK PLC. This Netgear router’s port
forwarding is a good example – I can specify a range of external ports coming into the
router, but there is no place to put the CLICK Port number or what some routers call the
“internal port number” - so watch out for that.
And while I spent a lot of time explaining things, all we really did was wire the PC
and CLICK PLCs to the router, setup our network addressing and configure the router to talk
to the PC and the clicks and to forward messages. That’s it.
The bottom line is all this stuff we have done so far is stuff you need to do with your
network you’re your router and your IT guys. And while your router and your network will
be different from this, hopefully you now have a better idea of what to look for and
what you need to do. OK, well, enough router stuff, let’s setup
the CLICK PLCs for port forwarding. The good news is, once you have all of your networking
setup, connecting to the CLICK PLCs on the LAN side of the router is easy.
Start the Click Software and just like always we want to CONNECT TO a PLC – except these
PLCs are on the other side of a router – right? We want to connect via Ethernet and we want
to do it using the PC’s Ethernet Adapter that’s connected to the Router. Select OUTSIDE
this LAN and that graphic changes to show us we are now trying to connect to a PLC that
is behind a router. The CLICK software can’t see the CLICK PLCs behind the router so we
have to tell it how to find them by adding them to this list. Hit the ADD button. We’ll
give this connection a name, and specify the IP Address of the router the CLICKs are behind.
And here’s that port number again. This is the port number the router will use to
forward the message to the CLICK. If we go back and look at the Port forwarding table
we put in the Router, we see CLICK number 1 is on this port 5555, so we put that here.
And let’s go ahead and create the other CLICK PLC’s connection too. Add. Give it
a name, the routers IP Address, and the port number the router is expecting for CLICK number
2’s messages. Notice that you can’t blink the LEDs to
test the connection when working through a router, so we’ll just have to try the connection
and see what happens. So we’ll select the first CLICK PLC and hit CONNECT.
And sure enough we get the expected dialog. Perfect.
If I choose to read the current project from the PLC I’ll get all of it’s ladder code
and settings – including the settings for the Ethernet port on the click.
Instead I’m going to choose DON’T read the project – because I want to show you
something. Great we’re connected. That was easy – we
just setup the connection table so the ports matched what we did in the router and we are
up and running. Here’s the thing I wanted to show you. Because
we didn’t read the project out of the CLICK PLC, the com port settings didn’t get brought
into this project. You can see this project has the com port set for dot 99 right now.
If I write this project to the PLC, the software sees the difference and says are you sure
you want to change the IP address of the CLICK PLC? The PLC says his IP Address is currently
this. You’re trying to change it to this. Are you sure?
Well, no, I really want this IP Address so I hit this button and everything continues
as planned. Well, how cool is that? The CLICK PLC software
is watching your back and is doing everything it can to keep you straight. I love that.
Let’s disconnect from CLICK number 1 and connect to CLICK number 2. This time let’s
read the project from the PLC. Give it a few seconds to sync everything up … and if we
go back to that Com port settings dialog we see CLICK number 2’s comport settings were
read into the project along with the ladder code. Perfect.
So once you get your network setup to do port forwarding, implementing it on the CLICK PLC
is just filling in a table in the connection dialog – isn’t it? Not bad at all?
If you need any help with the CLICK PLC or any of AutomationDirect’s ten’s of thousands
of parts please contact AutomationDirect’s Free Award Winning Tech Support during regular
business hours. They will be happy to help. But please, don’t call them looking for
help on your router or your network setup – they aren’t setup or trained to do that.
And of course, don’t forget the forums – there are lots of folks there that love to share
their years of experience.