The system that I am attempting to set up consists of several PLCs hooked up via Ethernet to a Raspberry Pi. The Pi is then connected to Hamachi VPN (I use hamachi because we do not have and external ip to use for other VPN solutions. If there is another alternative I an open to trying). On the other end there is a PC connected to the Hamachi network. I need to be able to talk (ping and connect) with the PLCs hooked to the Pi. I have been able to use iptables to get the PC to talk to one PLC but not through its own ip but buy pointing the software at the hamachi ip. I can get it to the point of pinging the PC from the PLC using iptables but not the other way around. My endgame is to be able to access the PLC from the PC using the PLC's ip over hamachi vpn. Any ideas or direction?
------------- ------------- -----------
| PLC |_____(eth0)___| RasPi |____(ham0)____| PC |
| | (eventually | | | |
------------- will have ------------- -----------
switch here) | (eth1) |
| |
------------__________________|
| Internet |
------------
You could try installing OpenWRT on your pi, then attempt to configure it to do some NAPT routing where it picks a specific PLC to communicate with based on the port number that the pi was accessed with. I'm not sure you can use a hamachi VPN to connect using a manually configured port number, but you could certainly do that with a regular TCP connection.
Also, it might be worth looking at some of the answers in this post:
https://raspberrypi.stackexchange.com/questions/243/is-it-possible-to-set-up-a-raspberry-pi-as-a-wireless-router
Instead of installing OpenWRT, you can just implement a few routing features that suit your needs.
Hamachi
Ok guys, latest working version is 2.1.0.8.6, newer versions will get you segmentation fault errors.
I uploaded it for you, it is a debfile
http://ul.to/ppisqm61
Instead of install.sh I used the following, install.sh might also work but that's the way I did it:
sudo dpkg -i --force-depends --force-architecture logmein-hamachi_2.1.0.86-1_armel.deb
Related
I am quite new to the BACnet protocole but I am facing some troubles finding a device on a network.
Basically, I have a setup on a network 128.10.100.XXX/24 where I have multiple devices, as my nmap scan will show
root#xxx:/home/xxx# nmap -sP 128.10.100.120/24
Starting Nmap 7.80 ( https://nmap.org ) at 2022-11-02 05:11 UTC
Nmap scan report for 128.10.100.1
Host is up (0.00076s latency).
MAC Address: 00:50:06:XX:XX:XX (TAC AB)
Nmap scan report for 128.10.100.150
Host is up (0.00059s latency).
MAC Address: 00:80:4F:XX:XX:XX (Daikin Industries)
Nmap scan report for 128.10.100.160
Host is up (0.00024s latency).
MAC Address: 00:50:06:XX:XX:XX (TAC AB)
Nmap scan report for xxx (128.10.100.120)
Host is up.
When I run specific scans for BACnet, all devices have an open 47808 port:
Starting Nmap 7.80 ( https://nmap.org ) at 2022-11-02 13:08 UTC
Nmap scan report for 128.10.100.150
Host is up (0.0093s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
47808/udp open|filtered bacnet
MAC Address: 00:80:4F:XX:XX:XX (Daikin Industries)
However, when I am trying to use BACnet utilities (BACpypes in python or bacnet-stack in node.js), no device is found. I tried multiple libraries and various setups (modifying the broadcast address, etc...) without any success.
I struggle to understand the reason...
Thank you in advance for your help,
A.
Have you validated your setup using 3rd party tools such as YABE ?
Fire up wireshark with a capture filter "port 47808", then look at the who-is from your app vs the who-is from YABE.
Also check the netmask on both devices match... this will affect the broadcast messages.
Speaking of which, try a directed who-is message to the controller from your app to see if the controller responds.
Things worth considering :-
Tools such as YABE, VTS and Wireshark - to learn from the success cases/successful instances of communication.
The network card (NIC) that your tools and/or libraries are using/selecting to send the ('service' request) messages - e.g. definitely don't mix routable addresses with non-routable 'private' addresses (between the BACnet 'client' IP & the 'server' IP).
(UDPv4-only) 'Broadcasts' will only work upon the local network (- if a BBMD is not present & correctly set-up to relay the broadcast on to another part/hop of the "internetwork"/connected networks).
If you're unlucky - with a particular device, your client port just might have to be 47808/0xBAC0; and just possibly for the broadcasts too.
Also try directed/'unicast' traffic/'service' requests too - e.g. attempting to read the device object instance # (DOIN) of a target device; check you've got/are specifying the correct DOIN when targeting/firing a request at a device.
Does the target device have a BACnet router or BACnet gateway in front of it (- therefore would also need the inclusion of a DNET & DADR paired values as part of addressing it)?
If so, are you talking the same variant of BACnet, e.g. IP - as in BACnet/IP between both the (BACnet) 'client' & 'server'/serving device?
If it's a commercial/enterprise device, does it have a IP whitelist - to allow for the processing of incoming requests?
Suppose we have a device which can operate on both RS232 and RS422 protocols. we know which serial port is connected to the device, lets say /dev/ttyS4.
In Linux environment using setserial, dmesg and proc file-system (following commands) helps to identify the serial ports and some hardware/software configurations of them but not much about the device connected to them. (am I missing something here?)
dmesg | grep tty
cat /proc/tty/driver/serial
setserial -a /dev/ttyS[0-4]
My question being, Is there a good way in which we can point out exactly which protocol the device is using?
I'm trying to interface a device with python.
The device is connected to another machine in the same network (the university network) and I know it's Port number.
I can access the device from the PC where it is plugged with the following code:
dev = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
dev.connect(('137.195.53.140',51019))
where '137.195.53.140' is the PC ip, and 51019 is the port number.
However, if I try the same from another machine, ipython gets stack at the command "dev.connect(('137.195.53.140',51019))", and when I abort the evaluation and then look at "dev" I get this:
<socket.socket fd=15, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('137.195.204.85', 50393)>
where '137.195.204.85' is the IP of the machine I'm using, and the port number I've no idea.
Since ssh works with no problem within this network, I thought that my approach for accessing the device would have worked as well.
Does anyone have any clue for this? I'm sorry if I haven't been clear, but I know absolutely nothing of networking (and not very much of Python either tbh).
There's couple of things to consider:
Your university network ports
Your device's opened ports
Your network might have the 51019 port blocked. Also, ssh uses port 22 to make it's connection. Every port is a world, so there's the chance that just because 22 is open, it doesn't mean that another is. School networks usually have a pretty rigid policy on port closing for security and blocking unwanted sites too.
You can test your device access by pinging it as
$ ping 137.195.204.85
If that works, then you can go trying different ports
I have a very old windows 98 pc that has a network card on PCI that has 2 entrances on it (both RJ-11 one has "in" next to it and the secon
"out").
I'd like to connect this pc to my new laptop which has a normal RJ-45 Ethernet entrance, because I have some files I wanted to transfer out of that old pc. Is there any way to do this?
If cables would be needed to be maked, that's no problem. Of course setting the IPs and all is clear to me, W just want to know if W can connect these computers using an RJ-11 to RJ-45 connection. If that wouldn't be possible, what could work in this situation? (There are no USB ports on this pc and no CD burner)
Also, I wanted to ask, if I connected 2 PCs with RJ-11 cables would the network connection be established in the same way as when I would connect 2 PCs with RJ-45 ethernet cables?
Thanks!
One of options is to connect both to same network and transfer files with network sharing option or with hard disk reader get file's from disk:
https://www.ebay.com/itm/Hard-Disk-Drive-SATA-7-15-Pin-22-to-USB-2-0-Adapter-Cable-For-2-5-HDD-Laptop-CY/172688340405?epid=14007489979&hash=item283506f5b5:g:~pAAAOSwK6RZIpDv
or option with adapter to convert output RJ11 to RJ45 and than with normal RJ45 cable connect PC and Laptop. So point is that RJ11 has just 4 wires and is not for same purpose as RJ45 and i think even connection with RJ11 between two PC's will not work, but not sure because i don't never tested that.
I have UDP network traffic arriving on my machine (OSC traffic from an iPad, to be exact) and I want two programs to be able to receive that traffic. The problem is that I can't bind to the same network port with two programs at once and I can't send to multiple ports with the iOS app I'm using. How can I solve this problem?
You can use the power of the command line for this. The following snippet uses socat (probably needs to be installed beforehand) and tee (should be preinstalled on any OS X or Linux).
socat -u UDP4-RECVFROM:8123,fork - | tee >(socat -u - UDP4-SENDTO:localhost:8223) | socat -u - UDP4-SENDTO:localhost:8323
Explanation: socat listens for traffic on UDP port 8123, pipes it to tee, which pipes it to two other instances of socat forwarding it to ports 8223 and 8323 on localhost respectively. With your two programs you need to listen to those ports on localhost.
While the answer with using socat is elegant it is not clear for me, what you are trying to do:
both programs should receive all parts of the traffic and they will only receive and not reply. This can be done with the proposed socat way
both program should receive all parts of the traffic and there reply will be mixed together (how?)
each of the programs should only receive parts of the traffic, e.g. the one which the other did not get. This should be possible if both of your programs use SO_REUSEADDR, SO_REUSEPORT. Replies will then be mixed together.
or do you actually want to communicate with each of the programs seperatly - then you would have to use either multiple sockets in the iOS app (which you don't want to do) or built your own protocol which does multiplexing, e.g. each message is prefixed with there target app and on the target machine a demultiplexer application will receive all packets and forward them to the appropriate application and wrap the replies back in the multiplexing protocol.
In summary: please describe the problem your are trying to solve, not only one small technical detail of it.
The problem is that I can't bind to the same network port with two programs at once
Yes you can. Just set SO_REUSEADDR and maybe SO_REUSEPORT on both of them before you bind.