This question might seem odd at first, because the answer may look trivial: "Either assign a static IP address to it or just DHCP it."
Well... this challenge turns out to be not so simple:
The device in question is an "IP camera", accessible (at least theoretically) via both an Ethernet cable and WiFi.
Accessing the camera via Ethernet is straightforward and works without any problem, after setting it up per the instructions:
Device Name: IPCamera DHCP [No] IP Address: 192.168.3.27 Net Mask: 255.255.255.0 Default Gateway: 192.168.3.1 DNS Server: 220.127.116.11 Web Port (default 80): 7779
And then I can access it via:
Through that web interface I can also configure its WiFi, which means I can only tell it which of the available nearby WiFi networks to connect to, but I cannot tell which IP address it is assigned or other IP related parameters.
I know that the WiFi connection works because when I set it to send email upon motion detection, it sends the email fine across the Internet, even when the Ethernet cable is disconnected.
However, both the device and the software that came with it require rebooting, resetting and recofniguration from time to time and since the optimal placement of that camera isn't where an RJ45 jack is available, I would like to be able to access the device's web interface via WiFi.
Well... for some strange reason, I could not find anywhere what IP address is assigned to its WiFi interface as a DHCP client of my DD-WRT router. I therefore went to my DD-WRT router's 'Services' > 'Services' tab and added the camera's MAC address under the 'Static Leases' section. That essentially forced a static IP address of 192.168.1.32.
So now the topology of my network looks like this:
ISP-----Wired router (192.168.3.1)--+--LAN-----------------------------+-- My PC (192.168.3.7) | | | + IP Camera (192.168.3.27) | | | +-- Wireless router (192.168.1.1)--+-- My PC (192.168.1.29) | + IP Camera (192.168.1.32)
I then tried to access the camera through its WiFi IP address (192.168.1.32) but I have not been successful so far. I tried
To further diagnose why I am unsuccessful to access the camera via WiFi (even though the manufacturer says it can be accessible from the Internet using DDNS + port forwarding), I telneted into my router and tried to ping it from there. No response.
This is weird, because the router's web interface lists the assigned static IP address as not having any problems.
So, while still telneted to my router, I issued the
netstat -a command, which resulted in:
Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:www 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:domain 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:5431 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:telnet 0.0.0.0:* LISTEN tcp 0 0 192.168.3.30:www 192.168.3.7:33755 TIME_WAIT tcp 0 0 192.168.3.30:www 192.168.3.7:33753 TIME_WAIT tcp 0 132 192.168.3.30:telnet 192.168.3.7:33097 ESTABLISHED tcp 0 0 my-ddwrt:5431 mypc:32847 ESTABLISHED tcp 0 0 192.168.3.30:www 192.168.3.7:33758 TIME_WAIT tcp 0 0 192.168.3.30:www 192.168.3.7:33776 TIME_WAIT tcp 0 0 my-ddwrt:5431 mypc:33000 ESTABLISHED udp 0 0 localhost:34954 0.0.0.0:* udp 0 0 0.0.0.0:domain 0.0.0.0:* udp 0 0 0.0.0.0:bootps 0.0.0.0:* udp 0 0 0.0.0.0:upnp 0.0.0.0:* raw 0 0 0.0.0.0:255 0.0.0.0:* 7 Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 2 [ ] DGRAM 601
Interestingly, all the IP addresses listed by netstat are of the wired Ethernet interface. There is no reference to any WiFi address (192.168.1.x) as if the WiFi interface doesn't exist (I know it does! see earlier description on email alarm etc.)
And this is despite having configured a bridge between vlan0 and eth1 on this WiFi router.
arp -a, I can see both interfaces:
android_72c5e473c08d1ab4 (192.168.1.2) at 44:A7:CF:47:C8:37 [ether] on br0 ? (192.168.3.7) at 00:0F:B0:C8:91:72 [ether] on vlan1 ? (192.168.1.3) at D0:17:6A:5A:B2:8F [ether] on br0 mypc (192.168.1.29) at 00:13:02:20:43:AD [ether] on br0 wiredrouter (192.168.3.1) at 00:1C:10:4F:B3:27 [ether] on vlan1
So, as it seems now, the IP camera is assigned a valid (static) IP address by the router, but I have not been able to ping, SSH, telnet or http it.
The manufacturer's tech support says that what I am trying to accomplish is supported but couldn't provide clear instructions on how I can do that. He initially offered to connect via DDNS but at this point I am only interested in internal access, so the only instructions he could provide was:
In router 192.168.1.1's page, we need do port forwarding with camera's IP and camera's port. In router 192.168.1.1's page, we need find the router's external IP which should be 192.168.3.x. In router 192.168.3.1's page, we need do port forwarding with router's 192.168.1.1's external IP 192.168.3.x and camera's port, not use camera's IP.
Any idea what this means?
How can I further diagnose and accomplish web interface access through WiFi?
Update: Per a comment advice below, I ran
iptables -t -nat -n -L in my-ddwrt WiFi router and this is the output:
root@my-ddwrt:~# iptables -t nat -n -L Chain PREROUTING (policy ACCEPT) target prot opt source destination DNAT icmp -- 0.0.0.0/0 192.168.3.30 to:192.168.1.1 TRIGGER 0 -- 0.0.0.0/0 192.168.3.30 TRIGGER type:dnat match:0 relate:0 Chain POSTROUTING (policy ACCEPT) target prot opt source destination MASQUERADE 0 -- 0.0.0.0/0 0.0.0.0/0 RETURN 0 -- 0.0.0.0/0 0.0.0.0/0 PKTTYPE = broadcast MASQUERADE 0 -- 192.168.0.0/16 192.168.0.0/16 Chain OUTPUT (policy ACCEPT) target prot opt source destination
My DD-WRT router does not support the