LinuxQuestions.org
Visit Jeremy's Blog.
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 07-04-2008, 07:14 PM   #1
jdavis2
Member
 
Registered: Feb 2007
Distribution: Fedora, Mandrake, Knoppix, Windows XP
Posts: 37

Rep: Reputation: 15
How can two seemingly different subnets on the same segment talk toeach other?


I was in the process of creating a larger subnet on my home network and before I changed the prefix/mask on the last system I noticed that I could still ping and make ssh connections across what I believed to be a different subnet.

I have a mixture of physical and virtual machines in a home network environment (just for fun). Both Linux and Windows systems. I am working with 192.168.1.32/28 and 192.168.1.0/26. I have a DNS server and a DHCP server on 192.168.1.0/26 but the DHCP server is only serving a few addresses in the 192.168.1.32/28 ranges (because I haven't gotten to it yet). However, all of the systems involved right now have a hard coded ip address. The name server is also forwarding ip packets.

I have a system with the address of 192.168.1.44 with a mask 255.255.255.240 broadcast 192.168.1.47. With this system I can access machines on 192.168.1.0/26 with the following addresses 192.168.1.41 and 192.168.1.39 while each of those have a netmask 255.255.255.192 and broadcast of 192.168.1.63.

192.168.1.41 is linux virtual machine(Ubuntu6.04) hosted on a windows system in the 192.168.1.0/26 subnet and 192.168.1.39(Mandrake10.0) is linux physical machine in the same subnet. 192.168.1.44/28(Open Suse10.3) is also a linux physical machine.

Why are these systems talking to each other?
 
Old 07-04-2008, 07:17 PM   #2
apnicservices
LQ Newbie
 
Registered: Jul 2008
Location: London, UK
Distribution: Debian
Posts: 23

Rep: Reputation: 16
Traceroute from one machine to another, your router between the different subnets is probably routing between them.
 
Old 07-04-2008, 09:35 PM   #3
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
This works mostly because you have subnetted a subnet, are only using addresses common to both subnets, and have luckily avoided a trap.

Let's show what is happening with your addresses, and why everything seems to work. We'll start with unicast addresses.

All of your networks are 192.168, so let's drop the first two of the four octects. And I'll call your networks NET1 and NET2. Your addresses look like:

Code:
name: network network bits       netmask network bcast ip range
NET1: 1.32/28 nnnnnnnn.nnnnhhhh  255.240  1.32   1.47  1.33 - 1.46
NET2: 1.0 /26 nnnnnnnn.nnhhhhhh  255.192  1.62   1.63  1.1  - 1.62
where n is the network part, and h is the host part.

Quote:
I have a system with the address of 192.168.1.44 with a mask 255.255.255.240 broadcast 192.168.1.47.
Ok, this system is in our NET1.

Quote:
With this system I can access machines on 192.168.1.0/26 with the following addresses 192.168.1.41 and 192.168.1.39 while each of those have a netmask 255.255.255.192 and broadcast of 192.168.1.63.
Ok, these systems are in NET2.

Quote:
192.168.1.41 is linux virtual machine(Ubuntu6.04) hosted on a windows system in the 192.168.1.0/26 subnet and 192.168.1.39(Mandrake10.0) is linux physical machine in the same subnet.
Ok, this system is in NET2.

Quote:
192.168.1.44/28(Open Suse10.3) is also a linux physical machine.
Ok, this system is in NET1.

Quote:
Why are these systems talking to each other?
If you look at the ip range column above, you'll see that NET1 is a subset of NET2; in other words, all addresses in NET1 are in NET2.
You will also notice that all of your addresses (1.44, 1.39, 1.41) are in both NET1 and NET2. Therefore, you just happen to have two overlapping subnets, and just happen to be using only those addresses that are in both subnets. Thus, route processing strips off the network part to perform network packet switching, and all addresses fall within the same route.

Now what about broadcast addresses? Since broadcast addresses don't cross network boundaries (aka: broadcast domains), there is no problem given the IPs you are currently using.

In the chart below, You see that the broadcast bits look identical, with one exception: the 5th bit, which is 16. I've marked that bit with a ?.
Code:
name: bcast  bcast bits
NET1  1.47   1  00101111
             n  nnn?hhhh
NET2  1.63   1  00111111
             n  nnhhhhhh
But, wait! There is a problem. What about host 101111 (47) on NET2? This looks exactly like a broadcast on NET1 ! Thus, all hosts on NET1 will accept and attempt to handle the packet.

So it is only luck (or the well-worked out homework example here!) that allows this to work out.
 
Old 07-04-2008, 11:27 PM   #4
jdavis2
Member
 
Registered: Feb 2007
Distribution: Fedora, Mandrake, Knoppix, Windows XP
Posts: 37

Original Poster
Rep: Reputation: 15
I think I get it now.

Quote:
Originally Posted by Mr. C. View Post
This works mostly because you have subnetted a subnet, are only using addresses common to both subnets, and have luckily avoided a trap.

So it is only luck (or the well-worked out homework example here!) that allows this to work out.
Okay, 192.168.1.0/28 is a subset of 192.168.1.0/26 so it is almost like they are on the same subnetwork especially while residing on the same segment.

If I am following you correctly, it would not haved worked if I had used the next subnet which would be 192.168.1.64/26 instead of 192.168.1.0/26?
 
Old 07-04-2008, 11:32 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Sounds like you've got it.
 
Old 07-04-2008, 11:42 PM   #6
jdavis2
Member
 
Registered: Feb 2007
Distribution: Fedora, Mandrake, Knoppix, Windows XP
Posts: 37

Original Poster
Rep: Reputation: 15
Thank you! I can see how knowing this will help me avoid other more serious traps in the future. Like in the area of security.
 
  


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
ip of my server changes, seemingly at random esteeven Linux - Networking 7 03-10-2007 08:18 AM
2 subnets on the same network segment robadawb Linux - Networking 5 11-16-2005 03:42 PM
talk talk daemon configuration ananthkrk Red Hat 1 10-16-2004 11:45 AM
Making two subnets talk to each other. NetAX Linux - Networking 12 09-20-2004 02:41 AM
why cannot "talk" to others,since mesg is yes and disable = no(in /etc/xinetd.c/talk) whepin Linux - Newbie 0 12-31-2001 02:04 AM

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

All times are GMT -5. The time now is 07:34 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