Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
So, I guess the answer to my question about subnet masks is that they are ONLY used for broadcasting. They can also be looked at and the network can be determined from them, but their real use is for broadcasting....
No. As I said before, your machine will go to any machine on the same subnet (with the subnet mask coverage) directly (and those machines can be connected to your ethernet interface). For any off-subnet IP's, it will ask the gateway to please forward the packet to the destination (because it's not on its own local network). Aside from broadcasting issues, the mask really determines when to go through the gateway and when not.
Originally posted by jeremy lynch, classful subnetting is still very much in use. I don't think he was calling the whole post rubbish, just saying that 10.0.0.1 could have a number of netmasks.
Originally posted by lynch Yes it is common.But classful subnetting is still in use,thus it is not obsolete.
Most netblock owners, who got their block pre-CIDR, have been asked to give back unused parts. Microsoft, for example, own at least one class A. To get a /24 or larger you a required to fill in a RIPE141, presumably on the basis that, if you can understand one of these enough to sucessfully complete the form, there's a vague chance you have a suitable use for the netblock
Quote:
And I dont like my posts being called rubbish,but I'll put that down to snobbery.
Then don't post things that are, at best, misleading.
Then don't post things that are, at best, misleading.
So now I'm being accused of writing posts that are misleading.At best, I try to offer the simplest answer to a question.No doubt MartBrooks has the expertise in these matters and I respect that.But I'm guessing the majority of people who read these posts are not netblock owners and the ones who are dont need CIDR explained to them.CIDR isnt needed when setting up a simple lan with one host using the internet.
Any,I wont derail this thread any further by replying to these flames.
Sorry ionized.
lynch
Originally posted by lynch
Any,I wont derail this thread any further by replying to these flames.
Sorry ionized.
lynch
Actualy, you've all been very helpful. The thing I wanted to hear was that the subnet defines a network SO THAT packets destined outside the defined network go through the router. I work with ipchains for my firewall and I know this is where you can use netmasks to define blocks of addresses to block, I just didn't know the application when setting up a network in linux or windows.
I'm still a little confused on broadcast addresses now though, heh. So if I define my network&mask as 10.0.0.1/255.255.255.127
what exactly is the broadcast address? I thought that if a network was defined as 10.0.0.1/24 then the broadcast would be 10.0.0.255....but how is that defined? Also, when exactly is the broadcast used...is it used to send out packets to find certain IP addresses on the network or something?
Originally posted by Ionized
Also, when exactly is the broadcast used...is it used to send out packets to find certain IP addresses on the network or something?
Broadcast is used when the same message is sent to many machines. With broadcast it's sent only once. Using normal methods of connection - once per client.
The subnet mask is used by the computer to decide which route to send packets.
so, if you have a 10.0.0.1/24 setting in a pc,
the addresses 10.0.0.1 to 10.0.0.254 will be on his LOCAL network.
Every subnet has two reserved addresses, the 1st and the last.
10.0.0.0 is the 'network' number and 10.0.0.255 is the 'broadcast' number.
Any other addresses are passed to the gateway device for routing.
So, if you have 10.0.0.1/25, addresses 10.0.0.1 to 10.0.0.126 are local
10.0.0.0 is the 'network' number & 10.0.0.127 is the broadcast address
(The other network there will be 10.0.0.128, broadcast 10.0.0.255, members 10.0.0.129 to 10.0.0.254 )
Confused?
Regards,
Peter
Last edited by peter_robb; 08-29-2002 at 10:11 AM.
How do I know a subnet is a valid subnet mask for a given class, notably if it is a non-contiguous subnet mask?
For example, given an IP '144.32.176.9' with its subnet mask '255.255.252.7'?
In addition, with that given pair, how can I use subnet mask (with its IP address) to work out its host id? It is B class, so I can use 255.255 to translate it back to net id 144.32 (is this correct?). Yet I do not know how to translate it back to its host id with 1111110000000111(252.7) and 1011000000001001 (176.9), if I use 'Not' then 'And' operation to combine it together.
I appreciate any advice,
Last edited by shogun1234; 06-09-2007 at 01:43 AM.
A subnet mask must follow a particular form. It is 32 bits long and the it must be a sequence of 1 bits with all the rest of the bits being 0 (OK, this is a lousy explanation, so I'd say just go read the Wikipedia article which explains it with a nice chart). Therefore 255.255.252.7 is an invalid subnet mask, as in binary it is 11111111.11111111.11111100.00000111 which breaks the "all ones, then all zeros" rule. However, 255.255.252.0 would be a valid subnet mask.
The subnet mask is logically ANDed with the IP address to produce the network IP. For 255.255.252.0 this network IP is the first 22 bits of the IP address. Therefore, the host IP is the remaining 10 bits. Remember, with classless routing, you can't necessarily determine the subnet mask just by looking at the IP address! The Wikipedia article has a fiuller explanation of this...
A subnet mask must follow a particular form. It is 32 bits long and the it must be a sequence of 1 bits with all the rest of the bits being 0 (OK, this is a lousy explanation, so I'd say just go read the Wikipedia article which explains it with a nice chart). Therefore 255.255.252.7 is an invalid subnet mask, as in binary it is 11111111.11111111.11111100.00000111 which breaks the "all ones, then all zeros" rule. However, 255.255.252.0 would be a valid subnet mask.
The subnet mask is logically ANDed with the IP address to produce the network IP. For 255.255.252.0 this network IP is the first 22 bits of the IP address. Therefore, the host IP is the remaining 10 bits. Remember, with classless routing, you can't necessarily determine the subnet mask just by looking at the IP address! The Wikipedia article has a fiuller explanation of this...
Thanks your reply.
I understand that the subnet mask should have bits started with 1 (at leftmost) and ended with 0 (at right most). For example, 11111111 11111111 00000000 00000000. What I am confused is - I read the RFC 905, in which it states that a non-contiguous subnet mask is also valid, though it is not recommended.
If the given example ('144.32.176.9' & '255.255.252.7') is not an invalid subnet mask, would you please to show me which pair (IP & subnet mask) is a valid IP & subnet mask (non-contiguous subnet mask) and how to prove that it is valid?
It looks like RFC 905 is a meta-document suggesting practices for transport protocol specification and not itself a specification of how IP subnetting should work (correct me if I'm wrong -- I didn't read it all that carefully). One could design a protocol where non-contioguous subnet masks are valid (it just means that the "host part" of the address would be somewhere in the middle of the address rather than the ending parts, e.g. you could make bits 12-20 of a 32 bit address the "host part" and the rest the "network address"). I don't know why anyone would ever want to do such a thing, but it's possible. However, AFAIK, IP never does this and subnet masks must be contiguous.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.