On Mon, 12 Nov 2007, in the Usenet newsgroup comp.os.linux.networking, in
article <(E-Mail Removed) .com>, Legend wrote:
NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.
You are posting from comcast.net, and they have a very good server.
>If I have a list of IP addresses, then how can I say that a group of
>them belongs to a particular router and the rest to another?
By knowing what the router interface address and netmask are for each
interface and each router.
>Or is it just possible to get the general representation schema for
>that set of IPs? For example, if I have something like:
>
>192.168.0.2
>192.168.0.3
>192.168.0.4
>192.168.0.5
>
>I want to say that this belongs to 192.168.0.x. But I was in a doubt
>if this would actually work. Any suggestions please?
First off, you are assuming that the router might be using a network
mask of 255.255.255.0. Maybe it is, or maybe it's using one of twenty
odd others. Start by finding a copy of RFC1878 on the web - you are
using a search engine after all.
1878 Variable Length Subnet Table For IPv4. T. Pummill, B. Manning.
December 1995. (Format: TXT=19414 bytes) (Obsoletes RFC1860)
(Status: HISTORIC)
A router (or indeed most network interfaces) may be using a mask of
255.255.255.252 on up to perhaps 192.0.0.0. If you look at those
masks in binary, you'll find
255.255.255.252 1111 1111 1111 1111 1111 1111 1111 1100
192.0.0.0 1100 0000 0000 0000 0000 0000 0000 0000
Now that means that where there is a '1' in the mask, the address bits
have to match. Using the first mask as an example, you had IP addresses
192.168.0.2 through 192.168.0.5 listed. Here's the mask again, and
those four addresses
255.255.255.252 1111 1111 1111 1111 1111 1111 1111 1100
192.168.0.2 1100 0000 1010 1000 0000 0000 0000 0010
192.168.0.3 1100 0000 1010 1000 0000 0000 0000 0011
192.168.0.4 1100 0000 1010 1000 0000 0000 0000 0100
192.168.0.5 1100 0000 1010 1000 0000 0000 0000 0101
Must match XXXX XXXX XXXX XXXX XXXX XXXX XXXX XX--
And you can see here that 192.168.0.2 and 192.168.0.3 have all the
needed matching bits, but 192.168.0.4 and 192.168.0.5 don't match the
third bit from the right.
Now, the real question becomes, what are you trying to ask?
You are posting to a Linux newsgroup - you may find it useful to
be reading the overview sections of the "Linux Network Administrator's"
guide, which you can find at the Linux Documentation Project. Go to
http://tldp.org/guides.html and page down about 430 lines.
* The Linux Network Administrator's Guide, Second Edition
version: 1.1
authors: Olaf Kirch and Terry Dawson
last update: March 2000
ISBN: 1-56592-400-2
available formats:
1. HTML (read online)
2. HTML (tarred and gzipped package, 690k)
3. PDF (1.5MB)
you want item 2.
Old guy