LinuxQuestions.org
Review your favorite Linux distribution.
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 03-01-2010, 12:59 PM   #1
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
I don't understand netmasks


Can someone please hold my hand a little to get me to understand them?

A netmask is ANDed to the IP address before it leaves the computer and goes to a router, right?
 
Old 03-01-2010, 01:18 PM   #2
SrDorothy
LQ Newbie
 
Registered: Sep 2005
Location: Lacey, WA
Distribution: Mepis (in the past), Suse, Ubuntu, LinuxMint
Posts: 24
Blog Entries: 15

Rep: Reputation: 7
Netmasks

I don't really understand networking although I use it. Learn a little most days. Here is something I found with a search that might be helpful:
http://www.pointz.com/spudpage/subnets.html

It takes a bit of wading...
 
Old 03-01-2010, 01:21 PM   #3
strickland
LQ Newbie
 
Registered: Jun 2008
Distribution: slackware
Posts: 1

Rep: Reputation: 0
That's right. The ANDing of the mask with the destination ip determines the destination network number. This is used by routing points to determine where to route packets. Routing devices will have a direct connection to a few networks - packets for any destination network that isn't found are sent to the default route. Some number of the most significant bits of the IP address represent the network number and the rest designate the host. The mask will contain binary 1 values in each bit position that represents a network number and 0s on bits representing the host.
 
Old 03-01-2010, 03:36 PM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,771
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
a pair of dimes worth of information

First, you must understand some binary math. Given the binary '1011' with the mask '0010' what happens when you AND these two numbers together?
Your result is '0010' -- everywhere there is a one-bit in your number with a corresponding one-bit in your mask, your result will contain a one-bit as well.

When applied to an IP address, say '172.25.30.21' and the net mask of
'255.255.0.0' your mask has one's on the left end giving a result of
'172.25.0.0' [REMEMBER -- an IP address is four decimal numbers representing four, 8-bit values, separated by periods.]

What the netmask actually says is

Given any IP address, apply the netmask (using AND) and which ever bits remain tell you the "network" portion of the address. The other IP address bits -- the ones that went away -- tell you which host within that network.
I hope that this helps. Check out the O'Reilly book on network routing for more than most people ever want to know.

Cheers,
~~~ 8d;-Dan
 
  


Reply

Tags
netmask



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
How to configure /etc/networks and /etc/netmasks when subnetting crisostomo_enrico Solaris / OpenSolaris 8 09-23-2008 04:34 AM
What are the correct NETMASKs for multiple interfaces in a StaticIP block? GerianneMcC Linux - Networking 5 04-15-2008 06:35 AM
Understand | tuananhbirm Linux - General 3 01-10-2005 05:02 PM
eth1 and loopback netmasks addresses match HELP Belize Linux - Networking 8 10-05-2003 12:37 PM
i don't understand... humanveal Linux - Software 17 05-20-2003 03:24 AM

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

All times are GMT -5. The time now is 01:05 AM.

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