Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Subnetting

Options
  • 17-11-2006 3:53pm
    #1
    Closed Accounts Posts: 4,128 ✭✭✭


    Could someone please explain Subnetting to me please (with examples). Am finding it hard to understand and tis doing my head in (as easy as you can please). Have looked at things on the net and am even more confused.

    Would be greatly appreciated.


«1

Comments

  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    If you were a little bit more specific I'd help you. People can write books explaining how subnetting works. It's almost the same as someone saying "can you explain life to me?".

    What do you not understand about it?

    Cheers

    McGintyMcGoo


  • Registered Users Posts: 5,111 ✭✭✭tba


    Im more than a bit confused by subnetting, what is it for exactly?


  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    Hi McGinty,
    Thanks for the reply.

    I dont understand subnet masks, or why you'd use them - how they are calculated or trying to figure out how many subnet addresses you can have or how many hosts. Its one big swirly mess in my head.

    Even more messy after reading somethings on the net.


  • Closed Accounts Posts: 333 ✭✭McGintyMcGoo


    Greetings

    Have a quick read of this.

    Follow that up with either this or this.

    If you have any specific questions after that I'll be glad to help.

    Cheers

    McGintyMcGoo


  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    Sorry McGinty. I have read the 3 of these in my search and its gobbledy gook to me.

    Can anyone explain in simple breakdown what the steps are? Please?


  • Advertisement
  • Closed Accounts Posts: 53 ✭✭Urban Kaos


    Righteo heres how I understand subnets (although Im open to suggestions on this!)

    A subnet mask is used in conjuction with the IP address. Typically your subnet mask would be 255.255.255.0. Basically it allows a large network to be segregated into seperate groups as it were. Thats how the internet works to the best of my knowledge!

    When information is passed about via the LAN it will only go within those computers with the same subnet mask. Any PC's that need to connect outside the subnet mask will then go to the default gateway i.e. the router and that will act as the intermediatry between the networks with different subnet masks. The router will know what goes where as it reads in packet data will know where the data is to be sent to.

    Dunno if that makes it any easier to understand; or indeed if this is accurate! :eek: Good luck though!!


  • Closed Accounts Posts: 583 ✭✭✭monkey tennis


    Urban Kaos wrote:
    When information is passed about via the LAN it will only go within those computers with the same subnet mask.

    Not exactly - remove the 'mask' from 'subnet mask' and you're almost there. You could have one machine with the subnet mask 255.255.255.128 (/25) which would be able to communicate no problem with another host with the subnet mask 255.255.255.0 (/24), so long as its IP address fell within the network range of the /25 host. The /25 would technically be half of the /24.

    E.g. A PC with the address 192.168.0.2, mask 255.255.255.128 could communicate with a router with the address 192.168.0.1, mask 255.255.255.0, but not with any address above 192.168.0.127.

    Bear with me while I type out a big explanation... :)


  • Closed Accounts Posts: 220 ✭✭esskay


    Subnetting is a method whereby any normal ip address range (192.168.0.1 - 192.168.0.254) used for one network can be broken down in to smaller networks by changing the subnet mask.

    Normal network setup
    Ip address range 192.168.0.1 - 192.168.0.254
    Subnet mask 255.255.255.0

    lets look at the above numbers in binary

    192.168.0.1= 11000000.10101000.00000000.00000001
    192.168.0.254= 11000000.10101000.00000000.11111110
    255.255.255.0= 11111111.11111111.11111111.00000000
    [ Network ][ Host ]
    [ 192.168.0 ][ 1-254 ]

    in the subnet mask all the 1's show what part is the network part and the 0's show what part is the host part. 24 bits are used to identify the network, 8 bits are allocated for identifying the pc's

    The ip address is comprised of two parts, one part identifies the network and the other the individual machine on that network. The network mask tells the computer how to identify the two parts. So in the above example the network is 192.168.0 and the pc is 1. Another pc on the same network could be

    192.168.0.23 = 11000000.10101000.00000000.00010111
    255.255.255.0= 11111111.11111111.11111111.00000000
    [ Network ][ Host ]

    So this pc can be see to be on network 192.168.0 and is number 23. This setup allows up to 254 computers on one big network.

    Subnetting involves manipulating the subnet mask to have less overall computers but multiple networks by allocating more bits to the network part.

    Subnetted example
    if we use the following subnet mask
    255.255.255.252 =11111111.11111111.11111111.11111100
    [ Network ][ Host]
    we are saying to the computer/router that we want to use 30 bits to identify the network and only 2 bits to identify the pc's on that network. This allows us to have up to 62 individual networks with 2 pc's on each network.

    example
    Subnet range = 192.168.0.1 - 192.168.0.2
    network id = 192.168.0.0
    subnet mask = 255.255.255.252

    in binary this look like this

    192.168.0.1 =11000000.10101000.00000000.00000001
    192.168.0.2 =11000000.10101000.00000000.00000010
    192.168.0.0 =11000000.10101000.00000000.00000000
    255.255.255.252 =11111111.11111111.11111111.11111100

    another subnet with the same mask could be
    Subnet range = 192.168.0.9 - 192.168.0.10
    network id = 192.168.0.8
    subnet mask = 255.255.255.252

    192.168.0.9 =11000000.10101000.00000000.00001001
    192.168.0.10 =11000000.10101000.00000000.00001010
    192.168.0.8 =11000000.10101000.00000000.00001000
    255.255.255.252 =11111111.11111111.11111111.11111100

    to simplify

    192.168.0.1 =11000000.10101000.00000000.000000 01
    192.168.0.2 =11000000.10101000.00000000.000000 10
    192.168.0.0 =11000000.10101000.00000000.000000 00
    255.255.255.252 =11111111.11111111.11111111.111111 00


    192.168.0.9 =11000000.10101000.00000000.000010 01
    192.168.0.10 =11000000.10101000.00000000.000010 10
    192.168.0.8 =11000000.10101000.00000000.000010 00
    255.255.255.252 =11111111.11111111.11111111.111111 00

    So the network id has changed from
    11000000.10101000.00000000.000000
    to
    11000000.10101000.00000000.000010

    the remaining 2 bits are used as follows
    00 like 192.168.0.0, not usable
    01 pc 1
    10 pc 2
    11 broadcast address
    this is instead of the usual 8 bits
    00000000 = 0
    11111110 = 254
    11111111 = 255 broadcast address

    so we can have the following networks (30 bits)
    11000000.10101000.00000000.000000
    up to
    11000000.10101000.00000000.111111

    Subnetting allows multiple "virtual" networks to be setup on one physical network e.g. one physical switch but many networks

    I hope this makes sense, feel free to ask questions if clarification is needed.

    EssKay

    edit: dammit, my spacing has been messed up!


  • Closed Accounts Posts: 1,956 ✭✭✭layke


    i'll make it simple.

    You buy an IP, but you have 4 separate networks. Why buy 4 IP's when you may only need to have 30 machines on each network? An awful waste isn't it?

    Well that's where subnetting comes in. As explained by Urban Kaos it's for network segregation, as in you can break an IP range into multiple networks.
    Another positive for it is because we were running out and the above helps stop the waste of IP's

    IP6 has solved that problem and subnetting will not be used anymore.

    e.g http://www.subnet-calculator.com/


  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    Thanks again for that.
    I understand binary, Network/host address. Im just not getting where some of the figures are coming out of. Maybe am just too thick. If you are given an IP address (Class b say) of say 142.23.50.0. How do you calculate the no of subnets/hosts?


  • Advertisement
  • Closed Accounts Posts: 1,956 ✭✭✭layke


    Each IP has 8 octets in each of the 4 parts totalling 32 bits. In a class B it uses 16

    8 8 8 8
    142.23.50.0

    2 to the power of N -2.
    N = the number of bits you stick in (either host or Network).

    The minus 2 is so you remove the first and last IP address in your subnet as they are unusable (First being the wire address, the last being the network broadcast address).

    When planning a network it's best to start by thinking about how many Networks and hosts you need. Then calculate which subnet is best suited.


  • Closed Accounts Posts: 220 ✭✭esskay


    ok, the ip you suggested cant be used as it ends in 0 so i'll use 42.23.50.1
    A class b address has a subnet mask of 255.255.0.0

    Binary again

    42.23.50.1 =00101010.00010111.00110010.00000001
    255.255.0.0 =11111111.11111111.00000000.00000000

    you have 16 bits for network and 16 for hosts.


    if you want to have more networks you can adjust the subnet mask
    ip 00101010.00010111.00110010.00000001
    snm 11111111.11111111.11000000.00000000 = 255.255.192.0

    so your new networks can be
    00101010.00010111.00110010.00000000=43.23.50.0
    00101010.00010111.01110010.00000000=43.23.114.0
    00101010.00010111.10110010.00000000=43.23.178.0
    00101010.00010111.11110010.00000000=43.23.242.0
    11111111.11111111.11000000.00000000=255.255.192.0

    [network part ] [host part ]
    00101010.00010111.00 110010.00000000=43.23.50.0
    00101010.00010111.01 110010.00000000=43.23.114.0
    00101010.00010111.10 110010.00000000=43.23.178.0
    00101010.00010111.11 110010.00000000=43.23.242.0
    11111111.11111111.11 000000.00000000=255.255.192.0

    the decimal numbers are hard to make sense of, look at the binary and the number of 1's and 0's in the subnet mask.


  • Closed Accounts Posts: 583 ✭✭✭monkey tennis


    OK, I was busy, but I've typed out a whole load of stuff. A lot of this has been gone over in previous posts, but I typed it all out dammit, I'm going to post it!

    Here's a small example of one reason behind subnet masks.

    Computer A and computer B are on a small network. Computer C is on a different network, say in another building, with a router connecting the two buildings:
       A         B
       |--------|
            |
            |
        [Router]
            |
            |
       |--------|
       C
    

    If A wants to talk to B, it can communicate directly through the network (i.e. the hub or switch that connects the two computers. If A wants to talk to C, it needs to go out over the router, which will send it on to C's network and on again to C. Straightforward enough, I hope.

    The question is, when A needs to send information to C, how does it know that it needs to go out a router? How does it know not to just plonk it onto the local network, where it would never reach C? Basically, how does it know that C is on a seperate network?

    When you give a host IP settings (i.e. an address and subnet mask), the subnet mask is what lets the host know how many other hosts are on its own network, and what the possible range of addresses for those other hosts are. If it has to send data to a host on its own network, it sends it directly to it. If it has to send data to a host on a different network, it sends that data to the router, telling it to forward it on to the destination IP address. Let's have a look at how this works:

    Computer A's IP address is 192.168.1.1, subnet mask 255.255.255.0.
    Computer B's IP address is 192.168.1.2, subnet mask 255.255.255.0.

    You don't need to know much about subnetting to see that these two are on the same network.

    Computer C's IP address is 192.168.2.3, subnet mask 255.255.255.0.

    It's pretty easy to tell that this is on a different network.

    If A wants to talk to B, it looks at its IP address and subnet mask. This is what it sees:

    IP address: 11000000101010000000000100000001
    Snet mask: 11111111111111111111111100000000

    WTF? OK, let's make that a little easier for humans to read:

    IP address: 11000000.10101000.00000001.00000001
    Snet mask: 11111111.11111111.11111111.00000000

    Look a bit more familiar? This is the binary representation of 192.168.1.1 and 255.255.255.0 (you can see this yourself with Windows calculator - use Scientific mode, type in '192' or whatever, and hit the 'Bin' radio button to show the binary representation.

    Why are we talking about individual bits? Because this is how the computer sees IP addresses and subnet masks - as a stream of ones and zeros. It doesn't give a crap about decimal numbers, they're just there to make it easier for humans. 192.168.1.1 is a lot easier for us with our squishy brains to remember than 11000000101010000000000100000001.

    The subnet mask is what tells the computer which bits of the IP address represent the network it's part of, and which bits represent its own address within that network. If we replace all the 1s in the subnet mask with 'N', meaning 'network', and replace the 0s with 'H', meaning 'host', we get this (I've seperated the host bits from the subnet bits to make things a little clearer:
    110000001010100000000001 00000001
    NNNNNNNNNNNNNNNNNNNNNNNN HHHHHHHH
    

    If you read that from left to right and convert each octet (eight bits) to decimal, you see that '192.168.1' is the part of the IP address that contains the subnet bits. Actually, that's '192.168.1.0', as the last eight bits still have to be counted, they just take a value of zero (if you really want to know why, it's because the computer does a bitwise AND operation on the IP address and the subnet mask). So, our network address is 192.168.1.0. The host bits, 00000001, are easy to convert to decimal - we get '1'. So, we see that the host address is '1' in decimal.

    So how does this help the computer figure out what other addresses are part of its network? Well, the computer will bitwise AND the foreign IP address with its own subnet mask and compare it to its own network address. Let's take computer B's address, 192.168.1.2 for an example. I won't show the actual bitwise operation; let's use our analogy of 'S' bits and 'H' bits again. I'll also add in the octet markers and decimal values just to make things clearer:
       192      168      1        2
    11000000.10101000.00000001 00000010
    NNNNNNNN.NNNNNNNN.NNNNNNNN HHHHHHHH
    

    We see straight away that the network address is 192.168.1.0, same as computer A's. Thus, computer A knows that computer B is on its own network.

    OK, let's see what happens when A wants to talk to C. It goes through the same as above to figure out whether C is on its own network or not:

       192      168      2        3
    11000000.10101000.00000010 00000011
    NNNNNNNN.NNNNNNNN.NNNNNNNN HHHHHHHH
    

    Hmm, looks like the result of that calculation gives 192.168.2.0, not the same as 192.168.1.0. Computer C is not on the same network as A. Computer A now knows it needs to send this data to a router in order for it to make its way to C's network. Now, I bet you're thinking that you could have seen that just by looking. Yes, because the network/host division is neatly on the line between octets, it's easy for a human to see the difference between these sample networks. But what if it wasn't so neat? What if we were using a subnet mask of 255.255.255.248 (/29). Are these two IP addresses on the same network or not:

    83.17.58.214/29
    83.17.58.219/29

    They look pretty similar, but they're actually on different subnets. A computer would know this straight away of course, because it would do its little bitwise AND operation to find the subnet addresses and it would see that they're different.

    As you see, you can't think in decimal numbers with addresses like this - your poor human brain will just get itself confused.


  • Closed Accounts Posts: 12,401 ✭✭✭✭Anti


    I think my head just imploded.


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Wait for VLSM and Supernetting :)


  • Closed Accounts Posts: 583 ✭✭✭monkey tennis


    I think everyone goes through a headphuck with sub/supernetting when they're first exposed to the concept, but it'll eventually click and all make perfect sense. I think it's important to try to get out of the habit of thinking in decimal when you're working with subnetting, and do a lot of drawing out of addresses and masks in binary until you get it.


  • Registered Users Posts: 1,298 ✭✭✭tom_ass19


    thats just crazy.....lol im in second yr n im doing networking, that actually made more sense to me than when my lecture was tryin to explain it to our class.....:D


  • Registered Users Posts: 7,541 ✭✭✭irlrobins


    Moving to net/comms


  • Registered Users Posts: 3,088 ✭✭✭Static M.e.


    dellas1979:
    Did the above explain it for you or do you need more help?

    Any questions on the above?

    (I was going to post but it ended up repeating alot of what has been said before, hence the questions)


  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    Hey,
    Thanks for the replies.

    Just going to have a read of the above posts now - see if I can understand.

    ;-)


  • Advertisement
  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    Sorry - hahahahahahaha.

    no seriously - thanks for the reply - hahahahahahahaha - but jesus - ahahahahahahahaha (im laughing at myself) ahahahahahahaha.

    Ahahahahahaha. Ive got a fit of the giggles which is turning to to tears right now......have I gone mad reading this?

    Can someone give me a calulation and see if I can work it out with you?

    I cant take anymore reading. Maybe if I could do one Id have more questions as right now I cant even work out what questions I have....

    Thanks again.


  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    Here is an example question:

    Using the address 192.64.10.0/28, how many subnets and hosts can be calcluated?


  • Closed Accounts Posts: 4,128 ✭✭✭dellas1979


    192.64.10.0/28, how many subnets and hosts can be calcluated

    OK. I worked it out as:

    n n h h
    192.64.10.0

    Gone into the last octet to get your 4 bits = 2 to power 4 - 2 = 14 subnets

    4 bits left = 2 to power 4 - 2 = 14

    14 subnets, 14 hosts.

    Am I correct? Any more I can practice on?


  • Closed Accounts Posts: 583 ✭✭✭monkey tennis


    dellas1979 wrote:
    14 subnets, 14 hosts.

    Am I correct? Any more I can practice on?

    Almost - there are 14 hosts per subnet alright (4 bits left = 2 to power 4 - 2 = 14 as you worked out).

    But you don't take 2 away when you're calculating the number of subnets. You need to understand the reason you take away 2 when you're calculating the hosts. That reason is that the first and last host addresses in a subnet are reserved - the first is reserved as the network address, the last is reserved as the broadcast address.

    So there are 16 subnets, with [16 minus network address, minus broadcast address = ] 14 hosts in each.


  • Registered Users Posts: 3,088 ✭✭✭Static M.e.


    http://www.celticrover.com/BSIG/default.aspx

    Have a look through this site


  • Registered Users Posts: 16,288 ✭✭✭✭ntlbell




  • Closed Accounts Posts: 9 mcdonagh521


    Can anyone help me with this?

    If a class B address 136.206.x.y were to be
    represented as a CIDR address, write down the address in
    CIDR notation.

    I just can't get my head around it.
    Thanks.


  • Closed Accounts Posts: 2,039 ✭✭✭rmacm


    http://en.wikipedia.org/wiki/CIDR_notation

    ^^^ Give a read of that maybe or the link ntlbell posted above your post.

    CIDR notation is the IP address followed by a / and the the length in bits of the subnet mask. So for example lets say a Class C address of 192.168.1.1 in CIDR notation would be 192.168.1.1/24

    Yours is a Class B so what's the length in bits of the net mask for a Class B address and you'll have your answer.


  • Closed Accounts Posts: 9 mcdonagh521


    So is the answer 136.206.x.y/16?


  • Advertisement
  • Closed Accounts Posts: 2,039 ✭✭✭rmacm


    So is the answer 136.206.x.y/16?

    Yeah that's it. See it's not that hard :)


Advertisement