I have an Open Mesh access point connected to the same router (an Aerohive BR100) than an Axis camera. I would like to automate the discovery of the camera's IP from inside the Open Mesh sensor, knowing the camera's MAC address.
This bad Ascii art shows how the things are cabled:
+================= Aerohive router ================+
| ____ ____ ____ ____ ____ |
| [..] [..] [..] [..] [..] |
|_____||______||______________||____________||_____+
|| || || ||
Axis OpenMesh borrajax-pc DSL
camera access pt. (my laptop) connection
The router where camera and OpenMesh devices are connected to assigns IP addresses in the shape: 10.200.255.XXX/24
If I unplug my laptop (borrajax-pc) from the Aerohive router and connect it to the WiFi network provided by the Open Mesh sensor, my IP becomes 10.223.176.150 (which is ok, since it is an IP provided by the Open Mesh sensor, and that's my router/gateway... my boss, after all). Anyhow... at this point, I can ssh into the sensor itself (as I said it's my gateway):
borrajax@borrajax-pc:~$ ssh [email protected]
[email protected]'s password:
BusyBox v1.19.4 (2013-01-08 11:35:01 UTC) built-in shell (ash)
Enter 'help' for a list of built-in commands.
_______ ________ __
| |.-----.-----.-----. _ | |.-----.----| |__
| - || _ | -__| | |_| | | | || -__|__--| |
|_______|| __|_____|__|__| |__|__|__||_____|____|__|__|
|__| http://www.open-mesh.com ---------------------
(c) Open-Mesh, Inc. All rights reserved.
firmware-ng: fw-ng-r443
Powered by these open source projects:
http://www.openwrt.org http://kokoro.ucsd.edu/nodogsplash
http://coova.org http://www.open-mesh.org
-------------------------------------------------------------
root@BorrajaX_Test_Sensor:~#
But when I'm inside the sensor, none of its interfaces have an address like the ones the external Aerohive router is providing (10.200.255.XXX/24), so I can't see my neighbors in one hop (or jump).
Just in case it's helpful, here's a list of interfaces with its assigned IP address:
root@BorrajaX_Test_Sensor:~# ifconfig
bat0
bat0.0
bat0.1
bat0.2 inet addr:5.17.32.120 Bcast:5.255.255.255 Mask:255.0.0.0
bat0.3
br-lan1
br-lan2 inet addr:192.168.83.2 Bcast:192.168.83.255 Mask:255.255.255.0
br-meship inet addr:10.223.168.1 Bcast:10.223.171.255 Mask:255.255.252.0
br-priv inet addr:10.223.172.1 Bcast:10.223.175.255 Mask:255.255.252.0
br-pub inet addr:10.223.176.1 Bcast:10.223.179.255 Mask:255.255.252.0
eth0
eth1
lo inet addr:127.0.0.1 Mask:255.0.0.0
mesh0
mon0
pub0
As you can see, none of the IPs looks like the ones provided by my router (10.200.255.XXX)
Now, if I find the camera's IP through other ways, and I find out said IP is, for instance, 10.200.255.204 this is what happens within the sensor.
root@BorrajaX_Test_Sensor:~# traceroute 10.200.255.204
traceroute to 10.200.255.204 (10.200.255.204), 30 hops max, 38 byte packets
1 192.168.83.1 (192.168.83.1) 2.265 ms 0.608 ms 1.378 ms
2 10.200.255.204 (10.200.255.204) 3.227 ms 1.265 ms 1.092 ms
So it hops through the br-lan2 interface and "sees" it properly. I can even ping it.
root@BorrajaX_Test_Sensor:~# ping 10.200.255.204
PING 10.200.255.204 (10.200.255.204): 56 data bytes
64 bytes from 10.200.255.204: seq=0 ttl=63 time=2.788 ms
But the ARP table doesn't register the mapping MAC <--> 10.200.255.204 (I'm guessing because it's jumping once through 192.168.83.1)
Is there any way of arping a "neighbor" when that neighbor is connected to the same router than the Open-Mesh device itself? Also, as I mentioned, the IP the Aerohive router assigns to the Open-Mesh device seems to become hidden somehow inside the Open-Mesh device. Is there any way of overcome this "hidden-ness"?
PS: If I do the whole thing from my laptop, it works fine:
1st: Verify that my IP belongs to the range assigned by my router (10.200.255.XXX)
borrajax@borrajax-pc:~$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 5c:f9:dd:52:10:78
inet addr:10.200.255.205 Bcast:10.200.255.255 Mask:255.255.255.192
[ . . . ]
2nd: Check the arp table:
borrajax@borrajax-pc:~$ arp -n
Address HWtype HWaddress Flags Mask Iface
10.200.255.193 ether e0:1c:41:30:ea:40 C eth0
No camera!!
3rd: fping to the whole 10.200.255.XXX subnetwork:
fping -g 10.200.255.1/24
10.200.255.193 is alive
10.200.255.204 is alive
10.200.255.205 is alive
ICMP Host Unreachable from 10.200.255.205 for ICMP Echo sent to 10.200.255.194
ICMP Host Unreachable from 10.200.255.205 for ICMP Echo sent to 10.200.255.19
[ . . . ]
4rd: Check the arp table again:
borrajax@borrajax-pc:~$ arp -n | grep -v "incomplete"
Address HWtype HWaddress Flags Mask Iface
10.200.255.204 ether 00:40:8c:e3:df:aa C eth0
10.200.255.193 ether e0:1c:41:30:ea:40 C eth0
Tadaaaa!! 10.200.255.204 ether 00:40:8c:e3:df:aa is the camera