Score:1

Using two different networks with the same IP ranges

eg flag

My camera (Nikon D7500) is hard-coded to use the IP address 192.168.1.1, which is the same as my LAN network range (specifically my router), I would like to find a solution to have it connected without changing my entire LAN or disconnecting from the LAN every time.
I searched for a way to do this with masquerading and creating a sort of alias for the camera's address (and set it to forward it to the camera on the correct interface), but didn't find anything that seems relevant, only answer I saw was saying to change the range of one of the networks?

Edit: I found a temp solution of running a VM that has the USB wireless NIC assigned to it.

Organic Marble avatar
us flag
What version of Ubuntu?
Didi Kohen avatar
eg flag
20.04, but if I have the idea of what to do, I have the know-how to port it from other versions. Posted here since I thought that netplan might make this easier.
muru avatar
us flag
I'm assuming you have two network interfaces? If so, you can stick the one that connects to the camera in its own network namespace
Didi Kohen avatar
eg flag
Indeed two different network interfaces, but it seems that the driver of the wireless one doesn't support network namespaces.
Score:0
eg flag

While not an ideal solution in my opinion, I used network namespaces and it does the job, since I used multiple sourced to find out how to do it, here's what I did is create a small script to be run as root:


ip netns add camera
iw phy phy0 set netns name camera
ip netns exec camera ip link set <ifname> up
ip netns exec camera wpa_supplicant -i <ifname> -D nl80211 -c <wpa_config> &
ip netns exec camera dhclient <ifname> 
ip netns exec camera <do the thing>
ip netns exec camera ip link set phy0 netns 1
ip netns pids camera | xargs kill
pids=`ip netns pids camera | wc -l`
if [ $pids -ne 0 ];then
    echo lingering processes, not deleting netns
    exit 1
fi
ip netns del camera

What this does:

  1. Create a netns called camera
  2. Add phy0 card to the camera netns
  3. Start the link
  4. Connect to a wifi network using a config file (created with wpa_passphrase)
  5. Get the address
  6. Do what you need (I used gphoto2 to transfer from the camera)
  7. Remove the nic from the netns
  8. kill leftover processes
  9. check for lingering processes
  10. If none, delete netns
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.