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 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 (, and the gateway for wlan0 is something else. Keep in mind that the packets of wlan0 still need to end up going to the (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 via 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, 2020 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, 2020 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, 2020 at 16:22

2 Answers 2


You can use iptables to mangle the destination ip address. For example you can use the ip address to address the DSLR and use routing to get connected to this ip address from your local area network Of course this will not reach the DSLR because it has the ip address 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 -j DNAT --to-destination

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

  • So, the on wlan0 will be reachable as on the eth0?
    – M. Rostami
    Mar 24, 2020 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 (LAN) and subnet From the latter subnet is nated to
    – Ingo
    Mar 24, 2020 at 16:42

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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