0

Situation: I have 3 devices on an Ethernet network.

1) 172.30.40.100 (Ubuntu 14.04)
2) 172.30.41.101 (other)
3) 192.168.30.102 (other)

I would like to setup 1) to be able to send msgs to both of the devices. I can hear each of the devices emitting UDP traffic (ngrep/tcpdump/Wireshark). There is a UDP protocol msg which will tell 2)/3) to change its IP, allowing a proper network setup where all three devices are on the same network.

Background: 2)/3) are devices that may reboot and when they do, they come up on a different network(192) than what I currently have set. There are other devices on the network that can only hear UDP msgs on the current network so getting the 2)/3) onto the proper network is important.

Currently, I have a program running on 1) that will change its IP address to 192 and send the msg to 3) to change to 172, and then change its own IP back to 172. I am hoping there is some other way to be able to send UDP msgs to each device WITHOUT changing 1)'s IP address.

Is this possible?

  • What handles routing between the networks? A firewall? A router? A switch? Without any of these to handle the Layer 2/3 routing your computer won't really know how to communicate to the devices outside the subnet that it's configured with. You could theoretically make a custom route to achieve this, but you'd have to code it for each and every subnet manually. – Thomas Ward Jun 13 '18 at 17:08
  • The devices are simply connected by a ethernet hub (no intelligence) – Carl Bartlett Jun 13 '18 at 17:46
1

If you are plugged into a non-managed switch or hub, an Ethernet Alias will fix you up. Not sure how to do it in Network Manager (I always remove it anyway, and use the /etc/network/interfaces file) but if you open a terminal you can do

sudo ifconfig eth0:1 192.168.30.105 netmask 255.255.255.0

And you should be able to talk freely between either of the other devices from the Ubuntu machine.

In /etc/network/interfaces simply add a second stanza referencing eth0:1 and set an IP and netmask. Don't set a gateway address.

  • First I found a better solution. Routes. But this works because it is doing the same thing. It is creating a route to each of the networks I need to communicate with. The problems is that I didn't mention (and didn't think it would matter) that I have a second interface that shares the same IP range. This broke that interface, but again not part of the original question. – Carl Bartlett Jun 13 '18 at 20:11
  • Ultimately adding ip route add {2'sIP}/32 dev eth0 allowed direct communication with that ip address without changing my ip. – Carl Bartlett Jun 13 '18 at 20:13
  • @CarlBartlett - yeah, the fact that you have a second adapter would've been nice to know :) – ivanivan Jun 14 '18 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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