I'm doing a project with an Keyence camera module that scans and determines the height of an object. This data has to be transmitted to my server. To send and receive commands trough/from the keyence sensor you need to use a communication unit, we chose the TCP/IP module DL-EN1. According to the datasheet from the module you can connect the sensor to the router OR directly to your computer with a cross-over cable. We chose the second one because we don't want to mess with the clients router ports to open a TCP/IP connection.
We tried the sensor on our windows laptop first, keyence provides an IP-configurator (only for windows) where you can find the module and change the ip-addres and add a TCP-port (ex. 64000), Then we wrote a simple python script that connects with this ip-adress and port and is able to send and receive data. Everything worked fine on windows - even when using the cross cable we found the sensor and where able to send data to it.
Because the ip-configurator is non existable for ubuntu we had to add this manually, this is where the problems begin, when I configure the ip-adress manually and open a tcp port for this ip adress (with ufw firewall commands) it gets refused when running the python script (port closed?)
When I check 'ifconfig' I see the ip-adress on the ethernet port where to sensor is connected to, I tried manually putting an ip-adress and I also tried the "link-local only" option. When u run the command "ufw status" is also says that the tcp port is open for this ip-adress. When I restard my server it does put the ufw on inactive (could this be the problem? I have to manually restart the ufw, but I thought then when ufw is inactive it just let's everything trough, but I'm not sure which port I have to use then because I don't have this option like in the Windows program)
When we configure the module on our windows pc and keep it connected to our router we where able to send commands from the ubuntu server to it. But that is not want we want, we need the cross cable connection but when we configure the sensor on our windows pc and plug it in on the ubuntu it doesn't remember the ip or port, anyone has and idea what could be the problem here? I'm new to ubuntu and TCP/IP so sorry if I made some mistakes here. The server is also connected to the internet but I don't think this should give any problems (we added 2 extra ethernet ports for the communication module)
11 Answer
I've into the same kind of problems, albeit without ufw involved. I have put my findings in this repo if it can help you :
From what you are saying, you do have the IP already setup, and when you ping it, you receive a response ?
Could it be that the device communication mode is not correctly setup. We had this problem with the SR-750 (a barcode reader), it was using RS-232 by default (usb communication). The only way to change it was unfortunately via the Windows software.
Try to do a nmap on the ip to find if there are any open ports on the device.