2

This question already has an answer here:

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?

marked as duplicate by Zac67, Ron Maupin May 10 '18 at 13:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Not quite. I just need an IP address that I can use. I don't want to learn the calculation methods, which the other post gives – Marco Emerson May 10 '18 at 6:41
  • Yes, but that Q/A would tell you how you can fix your problem. – Zac67 May 10 '18 at 6:43
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.

  • "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 6: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 6: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 7:04
  • Sorry, host configurations are off-topic here. But maybe 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

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