|AutomationDirect Live Chat|
Learn how to use Port Forwarding to connect to a Do-more PLC that is behind a router in this brief step by step tutorial!
Port forwarding is an easy way to access Do-more PLCs that on their own network behind a router, BUT it's not a very secure way to access those Do-more PLCs. So if network security is a concern for you, then you'll want to use a VPN to access your Do-more PLCs. We'll cover VPN's in a separate video. In this port forwarding demo we'll be using a PC at this IP address going to a router on the same subnet but at dot 57. The Do-more PLCs will be behind that router on their own local 192 dot 168 network at these addresses. The port number the Do-more uses on its primary Ethernet Port is always 28784. If you are using a secondary Ethernet connection on the Do-more, then you can specify any port you want. We're using the primary port so we are stuck with this using this port number. To get Do-more Designer to communicate with Do-more PLCs on the other side of the router, we'll send all of our messages to the router at this IP address, but we'll append a unique port number to tell the router which Do-more we want to talk to. You can use anything you want as long as it isn't already used on your network for something else. I'll use a port number of four 5's for Do-more 1 and a port number of four 6's for Do-more 2. Nothing special about those I just made 'em up. And since I don't have any other devices on this network I don't need to worry about which numbers I use here. Inside the router, we'll setup a table to cross reference those port numbers to the local network IP Addresses where the Do-mores are. So when Do-more designer sends a message to this IP address and this port number, the router will look in the table and see that all messages wit this port number are supposed to be forwarded to this Do-more. Hence the name port forwarding. We're using a Cisco Linksys E1000 router. 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 with Do-more Designer using this USB to Ethernet Adapter. I've already set up that adapters IP address to the 172.31.51.60 that we'll be using in this demo your network will probably have a different IP Address, of course. Ok, that takes care of this connection. I'll connect a laptop PC to one of the four LAN ports on the router and set it's 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. Finally we'll add the Do-more Ethernet connections to the LAN Side of the router. I setup the Do-more Ethernet IP Addresses before I started this video. If you need to see how to configure the Ethernet port on the Do-more, check out the Do-more Ethernet Quick Start Video. It shows you several ways to configure the Do-more Ethernet Port. I do want to caution you though. Make sure you specify the gateway when setting up the Do-more's Ethernet port in our example this is the gateway the Do-more sees. If you forget that step, Do-more designer won't get the responses it needs and it will timeout. OK, we're all wired up and the networking around the router is configured so now we just need to setup the stuff inside the router. We configure the router from the laptop, which you can't see on this computers screen, 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. Yours may be different. There was a login screen which for this Linksys E1000 router was admin, admin. In the Basic Setup Menu, this router was set for DHCP so it would get its IP address automatically from the network. I changed it to this static IP address to ensure that the router is always on the same subnet as the PC that has the Do-more 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 that 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 went over to the security page and turned off this filter internet requests so I could ping the router and test my connection. OK, that takes care of the connection to the external world where our Do-more Designer software is. 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 Do-more PLC's and they all have fixed IP Addresses. I did a ping from the laptop and sure enough I could reach both Do-more PLCs. So all the networking on this side of the router now seems to be working. Perfect. I should mention I also turned off the wireless functionality of this router. It doesn't matter for this demo, but the IT guys here hate it when we bring up extraneous Wi-Fi signals OK, now it's time to connect this side of the router to this side. We do that with Port Forwarding - which on this router is under Applications and Gaming you can see I gave each Do-more a name, specified the port numbers that will come from the Do-more Designer Software on the PC, the local IP address of each Do-more and the Do-more's Port Number. Remember, that's the same fixed port number on every Do-more PLC if you are using the primary Ethernet Port on the Do-more CPU. So any messages that come into the router with this port number will be forwarded to this IP Address and this port number. Any messages that comes in with this port number will be forwarded to this IP Address and port number. Here's a key point the router you use has to have the ability to specify the Do-more PLCs port number like this. Some of the routers I tested wouldn't let me specify the Do-more's port number so I couldn't use those routers for port forwarding to a Do-more 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 Do-more Port number or what some routers call the internal port number - so watch out for that. Ok, we've spent a lot of time setting talking about how to setup the network for port forwarding. But if you think about it, all we really did was wire the PC and Do-more PLCs to the router, setup our network addressing and configured the router to talk to the PC and the Do-mores 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 one, hopefully you now have a better idea of what to look for and what you need to do. Ok, given all that networking and router stuff, setting up Do-more Designer to talk to the Do-more PLC's on the LAN side of the router is easy. Start the Do-more Designer Software and start a new project. Give it a name and we'll be using an Ethernet CPU. Let's connect to this Do-more on the other side of the router. PLC, Connect, Add a new link. We want to connect via Ethernet. Do-more Designer can't see the PLCs on the other side of the router, so we need to give it some help by hitting this Link Editor button. Give it a name. We want this type of Do-more and the CPU with the Ethernet Port. In particular, we want to talk over Ethernet, to the Router's IP Address. Then we want to tell the router that we want to talk to this port so we click on Advanced button and enter the port number here. Make sure the Protocol is set to Do-more. It should be but just check to be sure to be sure. Great, accept that and now we just proceed like we always would. Select the port forwarded link we just created and do it. And sure enough we get all the usual Do-more prompts just like we are connected to a local Do-more. Perfect. And while we're at it, let's go ahead and create the other Do-more PLC's connection too. This time let's bring up the link editor directly from the launch pad. New Link. Same thing as last time. Drop into the Link Editor. We'll call this one Do-more2. This Do-more, This CPU. The router we want to talk to. The port on that router that's connected to the other Do-more. And accept. Let's disconnect from Do-more number 1 and re-connect to Do-more number 2. And we're done. Easy. So once you get your networking and router stuff setup to do port forwarding, using it from Do-more Designer is simple. If you need any help with the Do-more 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. Just don't post any messages directed at AutomationDirect's tech support there. They don't monitor the forums on a regular basis.