LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-12-2020, 07:26 PM   #1
MrPorcine
LQ Newbie
 
Registered: Oct 2019
Location: Menlo Park, California, USA
Distribution: Debian
Posts: 2

Rep: Reputation: Disabled
connecting two hosts on different subnets but the same physical network


I have two hosts that are on different subnets but on the same physical network. Host 1 broadcasts a UDP message that includes it's IP address. Host 2 gets this message and attempts to establish a TCP connection the Host 1. The correct port is known to both hosts. I see the traffic with a sniffer. Host 2 does send a request to host 1's address, with its address as the source. Host 1 never responds to the initial connection request from host 2.

This all works as long as both hosts are on the same subnet. For instance if both are on 192.168.0.0/24 all works. If one is on 192.168.5.0/24 and the other on 192.168.0.0/24 it fails.

If it makes any difference, both hosts are Linux on a Raspberry Pi.

Is it possible to make this work?
 
Old 05-12-2020, 07:40 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS, Manjaro
Posts: 5,787

Rep: Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773Reputation: 2773
One might want to read up on the meanings and functions of the words subnet, subnet mask, router, and perhaps bridge just as a start. You might also want to consider how easy it is to give an interface addresses in two different subnets on the same host, and why one might WANT to do that.
 
Old 05-12-2020, 07:49 PM   #3
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by MrPorcine View Post
This all works as long as both hosts are on the same subnet. For instance if both are on 192.168.0.0/24 all works. If one is on 192.168.5.0/24 and the other on 192.168.0.0/24 it fails.

Is it possible to make this work?
Giving host2 and/or host1 an address in the other respective subnet seems to be the easiest solution.
 
Old 05-12-2020, 09:39 PM   #4
MrPorcine
LQ Newbie
 
Registered: Oct 2019
Location: Menlo Park, California, USA
Distribution: Debian
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Giving host2 and/or host1 an address in the other respective subnet seems to be the easiest solution.
Well, I was hoping to find a method to avoid pre-assigning a static address. Most of the places that this will be installed there will be no DHCP server. I'm not hearing that it is possible to establish a TCP connection across subnet lines, so assignment it will have to be. Someone will be managing all the addresses on the subnet, so you can't just arbitrarily pick an unused address.

Not the answer I was looking for, but a good one nevertheless.
 
Old 05-13-2020, 01:13 AM   #5
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by MrPorcine View Post
Well, I was hoping to find a method to avoid pre-assigning a static address. Most of the places that this will be installed there will be no DHCP server. I'm not hearing that it is possible to establish a TCP connection across subnet lines, so assignment it will have to be. Someone will be managing all the addresses on the subnet, so you can't just arbitrarily pick an unused address.

Not the answer I was looking for, but a good one nevertheless.
If you don't want to give Host A an IP address that is in the same subnet as Host B, you need a router between the subnets.
 
Old 05-13-2020, 03:12 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,023

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
Either "super" net or fix subnet.

Or use static arp entry. Be careful with static arp.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KVM: two Guests running on two different Hosts mounting same qcow2 concurrently = corruption? arcadiosincero Linux - Virtualization and Cloud 7 05-13-2017 12:30 AM
How can I have two different iface's on two diff subnets? VolkHe Linux - Networking 6 09-06-2015 11:44 PM
Two NICs two different subnets, traffic leaving on wrong interface with PREROUTING ALInux Linux - Networking 1 04-15-2013 02:45 PM
OpenVPN: different subnets for physical and virtual LANs? bulls_i3 Linux - Networking 1 01-28-2010 08:23 AM
How can two seemingly different subnets on the same segment talk toeach other? jdavis2 Linux - Networking 5 07-04-2008 11:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration