If you have two network cards on your computer, then there should be no problem. The usual IP behavior is to ensure that the traffic for your 'private' network (embedded systems in this case) is separated from your public network, without having to do anything in the code. All that is required is for the two networks to be on different IP subnets, and by default for your โpublicโ network adapter.
Assuming your two network adapters are configured as follows:
NIC A (Public): 192.168.1.10 mask 255.255.255.0 NIC B (Private): 192.168.5.10 mask 255.255.255.0
The only configuration you should check is that NIC A is your default value. When you try to send packets to any address on your private network (192.168.50.0 - 192.168.50.255), your IP stack will look in the routing table and see a directly connected network and forward traffic through a private network adapter. Any traffic to the (directly connected) public network will be sent to NIC A, and there will also be traffic to any address for which you do not have a more specific route in your routing table.
The routing table (netstat -rn) should look something like this:
IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.10 266 <<-- 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 169.254.0.0 255.255.0.0 On-link 192.168.1.10 286 169.254.255.255 255.255.255.255 On-link 192.168.1.10 266 192.168.1.0 255.255.255.0 On-link 192.168.1.10 266 192.168.1.10 255.255.255.255 On-link 192.168.1.10 266 192.168.1.255 255.255.255.255 On-link 192.168.1.10 266 192.168.5.0 255.255.255.0 On-link 192.168.5.10 266 192.168.5.10 255.255.255.255 On-link 192.168.5.10 266 192.168.5.255 255.255.255.255 On-link 192.168.5.10 266 255.255.255.255 255.255.255.255 On-link 192.168.1.10 276 255.255.255.255 255.255.255.255 On-link 192.168.5.10 276 ===========================================================================
There will also be several multicast routes (starting at 224) that were omitted for brevity. "<<-" indicates the default route that the public interface should use.
source share