1

I'm trying to implement the ptp/ip library for my DLSR (nikon d7200). Because my camera uses the (limited) wifi-direct mode, I need a device in between my development computer and the camera, so that I still can use the internet in my main computer.

I ended up using a Raspberry PI 4 as the middle point between the DSLR (nikon d7200) and the computer. The PI is in the same network through ethernet as my development computer, and I'm using the PI's wi-fi to connect to the cameras own wi-fi hotspot.

The problem is that both the camera's and my router's ip is 192.168.1.1. I have already tried to change the IP of my router, but it broke too much other stuff. Thus, changing neither of the actual IPs is not feasible, as my DSLR doesn't allow it either.

I need to find a way to differentiate the two interfaces' same ip addresses.

My question is: Is there a way to alias the IPs of wlan0 to another range, so that the gateway for eth0 is the default (192.168.1.1), and the gateway for wlan0 is something else. Keep in mind that the packets of wlan0 still need to end up going to the 192.168.1.1 (my DSLR)

I have already tried to bind a random IP address to the the gateway of wlan0 on the PI:

sudo ip route add 10.0.0.0/24 via 192.168.1.1 dev wlan0, but couldn't get it to work (packet_filtered when trying with ping)

I have also tried to use the socket library in Python3, mainly the SO_BINDTODEVICE option. However, the socket libary for Python3 is a little too low level for my taste.

I cannot change the metric parameter for any of the interfaces, as this would break my VNC connection.

If someone out there can nudge me in the right direction, I will be grateful!

  • 1
    You should be easily able to "change the IP of my router". Nothing you can do on the Pi (or any other computer) will help. – Milliways Mar 24 at 9:55
  • Hello and welcome -- It has made me curious then I asked a question on another SE site. I thought it can be configured by iptables. unix.stackexchange.com/questions/574606/… – M. Rostami Mar 24 at 11:50
  • Searching a bit, I found this: "I used Nikon's WMU program to change IP addresses in the D7200." Does that help? – Bob Brown Mar 24 at 16:22
1

You can use iptables to mangle the destination ip address. For example you can use the ip address 192.168.123.1 to address the DSLR and use routing to get connected to this ip address from your local area network 192.168.1.0/24. Of course this will not reach the DSLR because it has the ip address 192.168.1.1. But then you can use iptables with destination network address translation (DNAT) as follows:

rpi ~$ iptables -t nat -A OUTPUT -o wlan0 -p tcp -d 192.168.123.1 -j DNAT --to-destination 192.168.1.1

This is only an example how it could work. You may try to use an ip address from you LAN, maybe 192.168.1.123 for the DSLR, which could do things easier? I cannot say much more without details about your network setup on the RasPi.

| improve this answer | |
  • So, the 192.168.1.1 on wlan0 will be reachable as 192.168.123.1 on the eth0? – M. Rostami Mar 24 at 16:11
  • @M.Rostami Yes, that is the idea. I haven't tried it but it is a NAT as you use on every router (here destination NAT). I think it could work. In this case you would have to use routing between subnet 192.168.1.0/24 (LAN) and subnet 192.168.123.0/24. From the latter subnet 192.168.123.1 is nated to 192.168.1.1. – Ingo Mar 24 at 16:42
0

There is an article here https://forum.heliconsoft.com/viewtopic.php?t=8991 that suggests you can change the IP address on your D7200 to another subnet e.g. 192.168.2.1

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.