Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BINARY CONVERSION REHASH:
- If you need to convert decimal (say, 82) to binary, write out powers of two from RIGHT-TO-LEFT up to 128:
- 128 - 64 - 32 - 16 - 8 - 4 - 2 - 1
- Then mark a one underneath the largest-but-not-over number for your decimal. In that case it's 64. Subtract that from your decimal, record the new decimal and repeat (leaving 0's underneath numbers too big) until your decimal reaches 0. In this case:
- 0 1 0 1 0 0 1 0
- If you need to convert binary to decimal, count from RIGHT-TO-LEFT in powers of 2 starting at one (1, 2, 4, 8, 16, 32, 64, 128) and each time you hit a "1" in your binary number, write down the power of 2 it refers to. Add up all the powers of two that were marked with ones at the end (or as you go, whatever is easiest for you). So to convert 00101110 to decimal we go:
- Counting right to left we have 1 (ignore), 2 (check), 4 (check), 8 (check) 16 (ignore) 32 (check). 2 + 4 + 8 + 32 = 46. :D
- An IP address is four bytes (octets) long or 32 bits (4 * 8).
- Subnetting:
- CIDR notation: 192.168.0.0/24
- Dot-decimal notation: 192.168.0.0 255.255.255.0
- The /24 part of CIDR notation refers to the number of bits "filled-in" from the left-hand side.
- So /24 actually equals:
- 8 + 8 + 8 + 0 = 24
- 11111111.11111111.11111111.00000000
- Why are we filling in from the left hand side? Because the bits left over on the right side represent the "free room" we have for networks (network addresses, host addresses and broadcast addresses). So in the example above, we have 8 bits free on the right or 256 potential addresses.
- Use the method at the top to translate from dotted decimal to binary noting that a subnet mask will always be a contiguous group of 1's and then 0's.
- A network:
- A network is comprised of 3 types of addresses. The first address in the network is called the network address and is used (alongside the subnet) to define the rest of the network space. It is not assignable to a host. You also have a broadcast address, the last address in a network, which is used to send messages to everyone on that network. It is also not usually assignable to a machine. All addresses in between those two are host addresses and can be assigned to machines. Using the example above (192.168.0.0/24) with the 256 potential addresses, the network address would be 192.168.0.0, the broadcast would be 192.168.0.255 and all the ones between can be assigned to hosts.
- IF YOU'RE ASKED TO DESCRIBE AN IP GIVEN IT AND IT'S SUBNET MASK:
- Convert the given ip address into bits (do it by octects separated by spaces or dots for readability).
- Break the subnet mask up into bits (in groups of 8 for convenience/readability).
- Overlay/superimpose the subnet mask over the bits in the given IP address. This represents the distinction between the "outside the network" and "inside the network" bits. Anything covered by a one describes the network it represents and everything covered by a zero represents the network (as in either a network address, broadcast address or potential host address).
- If there are no "1" bits from the IP address underneath "0" bits from the subnet mask, the address you have is a network address, because it's the first one in the network (because computers count from 0 so the first address inside the network [the network address] will have all "0" in it's section). If all the given IP address bits underneath the subnet's "0" bits are 1, you have the broadcast address for that network, the last address inside that network. Other combinations of 1's/0's (of the given IP address bits) underneath the 0's section of a subnet mask represent a host address.
- TO DESCRIBE A NETWORK GIVEN AN IP AND IT'S SUBNET MASK:
- Using the section immediately above you should be able to work out if the given IP is a network, host or broadcast address. You may be asked to describe the network in which it sits, usually by giving the network address, broadcast address and range of host addresses.
- Again, convert your given IP to bits broken up into octets.
- Directly underneath, write your subnet in octet-grouped bits directly underneath the bits of that given IP.
- Now compare the two and create a new set of 4 octets worth of bits where each position is only "1" where both the given IP and the subnet had a "1" (also known as a logical AND), for every other pair combo put a 0. This is the network address!
- 192.168.0.10/26 (it could potentially be a network, broadcast or host address, we'll find out once we compare):
- 11000000.10101000.00000000.00001010 - Given IP
- 11111111.11111111.11111111.11000000 - Given Subnet (in decimal dotted notation it would be 255.255.255.192)
- --------.--------.--------.--------
- 11000000.10101000.00000000.00000000 - Network address!
- From here, take the NEWLY FOUND NETWORK ADDRESS and compare it to the subnet mask. Create a new address that is the exact same as the network address except for each position that the subnet mask has a "0", put a "1". This is the broadcast address!
- 11111111.11111111.11111111.11000000 - Subnet mask
- 11000000.10101000.00000000.00000000 - Broadcast address
- --------.--------.--------.--------
- 11000000.10101000.00000000.00111111 - Broadcast address. Converts back to: 192.168.0.63!~
- Now every address between the network address and broadcast address is a potential host address. So everything from 192.168.0.1 to 192.168.0.62. An easy way to know how many addresses are in the address space is to count up the subnet mask from right to left in powers of two. Stop when you hit the first "1" value and the power of 2 it represents is the number of addresses in that space! Don't forget the network and broadcast address take out 2 from that number. In the example above we go 1, 2, 4, 8, 16, 32, *64* addresses. If you have a calculator you can also punch in 2 ^ [number of zeroes in subnet mask] where 2 ^ 8 = 64. Or 1 network, 1 broadcast and 62 potential host addresses!
- 172.63.24.72/18
- 10101100.00111111.00011000.01001000 - Given IP
- 11111111.11111111.11000000.00000000 - Subnet mask
- 10101100.00111111.00000000.00000000 - Network address (172.63.0.0)
- 10101100.00111111.00111111.11111111 - Broadcast address (172.63.255.255)
- 2 ^ 14 = 16384 addresses or 1 network, 1 broadcast and 16382 potential host addresses.
- IF YOU'RE GIVEN SOME ADDRESS SPACE (IP AND SUBNET MASK) AND ASKED HOW TO BREAK IT UP TO MEET CERTAIN REQUIREMENTS:
- From above, the subnet mask represents the divide between "outside the network" and "inside the network", so to break up a given address space we'll be using the parts under the "zeroes" of the subnet mask when superimposed over the network address.
- - If you're asked if you can make X number of subnetworks from a given address space, turn it into binary and if that binary number fits inside the "0" space of the subnet mask you have enough space to make up that many networks. <CATCH>Typical networks require a host and broadcast address as well as host addresses (2 minimum) for the machines on it. So you need at least four addresses per network. If your networks are smaller than that your examiner may be trying to fuck with you.</CATCH>
- - If you're asked to make up networks from given address space *and you have more address space than necessary*, check whether the question asks for you to account for future user growth or future network partitioning.
- - When making up networks, convert the number of networks you want to make to bits and count the bits (ie 5 to binary is 101 or 3 bits in total). In your given subnet mask, turn that many bits from 0s to 1s (from left to right to keep all the "1"s contiguous). What you have now is the new subnet mask for your subnetworks (sub-subnet mask?). Using the originally provided IP and subnet mask, work out the broadcast address for that address space and now start building up your networks. They'll go up in groups of [# OF ADDRESSES IN SPACE] and the final broadcast address of the final subnetwork will be the broadcast address of the original subnet mask. Yay.
- - When you're told how many users/hosts that a network will need to cater to, you can use a similar process to above except take the maximum number of hosts you'll need on any particular subnetwork, add two (for network and broadcast address) and turn that into binary. Count the number of bits in that number (35 hosts is 100011 in binary which is 6 bits long) and if you have at least that many 0's in your given subnet mask you can break it up into subnetworks.
- LASTLY: PRIVATE ADDRESS SPACE
- There are three sets of private, reserved address space in the entire IP address space gamut. These cannot be assigned to as "public" IP addresses and are (thus) not routable outside of private networks. Often they will be used as a network inside a home or office (usually any LAN) and will talk to the outside world through a router which does have a public IP address by a mechanism known as NAT.
- The private IP address spaces are:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
Advertisement
Add Comment
Please, Sign In to add comment