2

I have 2 sensors with the following IP addresses:

Sensor A IP: 192.168.0.80

Sensor B IP: 192.168.1.201

I am able to connect them to my laptop separately using 192.168.0.100/255.255.255.0 for Sensor A and 192.168.1.100/255.255.255.0 for Sensor B.

What IP address and network mask can I use to connect both at the same time?

Marco Emerson
  • 23
  • 1
  • 3

2 Answers2

3

Both devices are required to be in the same subnet in order to communicate directly or use a router. As it is, they are in separate subnets 192.168.0.0/24 and 192.168.1.0/24.

You either needs to adjust one side's 3rd octet or reduce the netmask to /16.

If all else fails, you can statically assign IP addresses from both subnets to the laptop's NIC.

Zac67
  • 81,287
  • 3
  • 67
  • 131
  • "You either needs to adjust one side's 3rd octet or reduce the netmask to /16." The "or" implies that I can somehow get away without modifying the sensors' configurations. Is that what you really meant? I cannot modify the devices' configuration. Given that, will the IP address 192.168.0.100 / 255.255.0.0 as the laptop's IP address work with them? – Marco Emerson May 10 '18 at 06:49
  • With reducing the mask on the laptop only, it would be able to reach the device, but the device would still require a router to reply. I've added to option for dual IP bindings in my answer. – Zac67 May 10 '18 at 06:55
  • Could you please elaborate on the added option? How do I do that? I am using Ubuntu 16.04. Will that be done in the "Edit Connections" part? – Marco Emerson May 10 '18 at 07:04
  • Sorry, host configurations are off-topic here. But maybe https://help.ubuntu.com/lts/serverguide/network-configuration.html can help you. – Zac67 May 10 '18 at 12:07
2

On the presumption this is a real life problem and you can't reconfigure anything on the two sensors nor are they configured to use a router. And also assuming the sensors are configured as /24 (you don't actually say this).

  • reduce the subnet mask on the host to /23 or smaller
  • Assign addresses on the host in both subnets.

Of course you end up with mismatched subnets: the host considers the network to be /23, while the two sensors consider themselves to be in two non-overlapping /24 networks. This situation is to be avoided if you can possibly help it: all kinds of trouble can ensue. But if you have a practical problem, sometimes you have to be pragmatic. I'd consider this to be okay if you're taking final backups from something you're taking out of service, but just to repeat, try hard to ensure it's temporary.

Sensor A IP: 192.168.0.80 Sensor B IP: 192.168.1.201

Concretely for Unix-like systems including Ubuntu, assuming an ether interface eth0:

ifconfig eth0   192.168.0.1 netmask 255.255.254.0
ifconfig eth0:1 192.168.1.1 netmask 255.255.254.0

For a Cisco router to be in both subnets, assuming interface Ethernet0:

interface Ethernet0
  ip address 192.168.0.1 255.255.254.0
  ip address 192.168.1.1 255.255.254.0 secondary
jonathanjo
  • 16,104
  • 2
  • 23
  • 53