ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.22k stars 935 forks source link

How to automatically search for PLC through Siemens STEP 7? #1106

Closed qq1793228602 closed 1 year ago

qq1793228602 commented 1 year ago

I have successfully built a virtual local area network, and my host is able to ping the PLC. At the same time, I can also connect to the PLC in Siemens STEP 7 software. However, I manually input the IP address instead of automatically searching for it

qq1793228602 commented 1 year ago

My n2n addresses are 192.168.130.10 and 20 respectively, and the PLC address is 192.168.1.222. I connected by creating a routing table on the host for 192.168.1.0->192.168.1.20

hamishcoleman commented 1 year ago

I have no experience with these PLC devices, but discovery is often done with broadcast or multicast packets - which have many issues when used in a routed network like you have described.

If you can find any information or documentation on how the discovery process works, that will probably help you work out the process. There is also the option of looking at network packet captures to learn what the software is trying to do.

qq1793228602 commented 1 year ago

Thank you for your answer. I found that the problem lies in the network segment. I now have a new problem. I have set the N2N network segment between the computer and the gateway to 1 (192.168.1.20/192.168.1.30), and at the same time, my gateway has another physical network card eth0 (192.168.1.233) connected to a device (PLC: 192.168.1.222), whose network segment is also 1. My problem now is that my PC cannot ping the PLC connected to the gateway, But the physical network card eth0 (192.168.1.233) of the gateway can be pinged, and of course, the N2N of the gateway can also be pinged

qq1793228602 commented 1 year ago

The following is the routing table for the gateway: Destination Gateway Genmask Flags Metric Ref Use Iface default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 default 10.109.155.93 0.0.0.0 UG 0 0 0 usb0 10.0.0.0 255.0.0.0 U 0 0 0 usb0 192.168.1.0 255.255.255.0 U 0 0 0 eth0 192.168.1.0 255.255.255.0 U 0 0 0 edge0 192.168.1.30 255.255.255.255 UH 0 0 0 edge0 Among them, 192.168.1.0->edge0 can be deleted

qq1793228602 commented 1 year ago

For gateways ping -I 192.168.1.20 192.168.1.233 ping -I 192.168.1.20 192.168.1.222 ping -I 192.168.1.233192.168.1.20 These are all accessible

System is Linux

qq1793228602 commented 1 year ago

I have tried adding firewall rules, iptables - t nat - A POSTROUTING - s 192.168.1.30- o eth0- j MASQUERADE, but it did not work

hamishcoleman commented 1 year ago

From what you have written, the problems you are having are all networking setup issues that are unrelated to the n2n VPN. You will be best served by reading more about how IP networking is configured. For a start, you should not have two network interfaces that are using the same subnet (except in a very small set of circumstances)

qq1793228602 commented 1 year ago

ok, think you very much!