0

I am making a USB attached IoT device which implements TCP/IPv4 over USB (CDC-NCM) with DHCP etc. My device allocates a 192.168.4.x/255.255.255.0 subnet.

I've noticed that NAT Wifis will stop working on my MacBook if this device is attached first. My device is on a separate subnet from the WiFi NATs (e.g. 192.168.0.x or 192.168.100.x) but they all have 24 bit netmasks (255.255.255.0). Is this simply a case of a race condition of the first network to initialize gets chosen for outbound traffic by MacOS? Is there a way to counter this?

I don't see helpful guidance in RFC 1918 "Address Allocation for Private Internets" about conflicts/ routing priorities when multiple smaller subnets share the 192.168/16 address space. I'm looking through RFC 2663 "IP Network Address Translator (NAT) Terminology and Considerations" and it doesn't seem to offer guidance here and RFC 1631 "The IP Network Address Translator (NAT)" doesn't refer to private network subnets at all.

Should I instead use 10.x.x.x/8 for my IoT subnet? Or perhaps 192.168.x.x/255.255.255.252? I'm curious if MacOS and iPadOS is perhaps intelligent enough to use the "largest subnet" for chosing a NAT device?

In searching the various forums, it seems MacOS assigns a 'default' (e.g. all traffic) route to attached devices. Some references say Ethernet devices are auto priorities, others say you just have to use the GUI to rearrange the stack order of the network device you want to be prioritized. I need to be able to hint this from my device itself, as I really can't expect the customers of my IoT device to go in and jigger with network settings to restore Internet access whenever my device is attached...

Jay
  • 101

1 Answers1

0

Having multiple DHCPs on a network is asking for trouble. For a commercial device for normal people, frankly, its a disaster.

The solution is simple, turn off its DHCP.

Rohit Gupta
  • 507
  • 2
  • 3
  • 18