程序代写代做代考 flex Subnetting Lecture 8

Subnetting Lecture 8
Dr John C. Murray Senior Lecturer

IP Addressing

IP Addressing
• Example network addresses:
– 32.0.0.0(classAnetworkaddress)
– 146.176.0.0 (class B network address) – 199.20.30.0 (class C network address)
• Example broadcast addresses:
– 32.255.255.255(classAbroadcastaddressfornetwork32.0.0.0)
– 146.176.255.255 (class B broadcast address for network 146.176.0.0)
– 199.20.30.255 (class C broadcast address for network 199.20.30.0)

IP Addressing
• The IP address is 32 bits long and can address over 4 billion physical addresses (232 or 4,294,967,296 hosts).
• There are three main address formats:

IP Addressing – Initial Bit Patterns • Initial bits are defined for each of the classes.

IP Addressing
• The class A address is thus useful where there are a small number of networks with a large number of hosts connected to them.
• Class C is useful where there are many networks with a relatively small number of hosts connected to each network.
• Class B gives a good compromise between of networks and connected hosts.

IP Addressing – Initial Bit Patterns
• Initial bits – means that there are strict limits on the IP addresses for each of the nodes in each of the ranges.
• A node with an address starting with 10.x.y.z can only be a class A address
– The value 10 has the binary representation 00001010
• This corresponds to the rule that class A addresses must start with a 0 as the first bit, and this rules out networks starting with 10 as belonging to any other class.

IP Addressing – Initial Bit Patterns • A class B address starts with the bit
pattern 10
– restricting the class B addresses to the range 128 through to 191.

IP Addressing – Address Ranges


IP Addressing – Address Ranges
Class A has one difference from Classes B and C.
– We know that we cannot use all zeros and we cannot use all ones (reserved for broadcast and network).
– However, the bit pattern 01111111 represents the value 127 and this is predefined as the loopback address and cannot be used!
– The next lowest value is the bit pattern 01111110 (126).
– 127 is used for network tests to check the integrity of any programs that are being developed without comprising the network itself.
– A loopback address is “connected” to a virtual network card (not NIC) in your machine called the loopback adapter.
– Data destined for 127 is written to an output buffer and then read in from the input buffer of the same card. Data does not reach the network. It is an IP address by default assigned to resolve Local Host (try http://localhost , 16,777,214 addresses)

IP Addressing

Subnet Mask 192-223 = Class C
209 . 98 . 208 . 34 Network Network Network Host
• Taking a class C as an example – the router will, by default, see the first three octets as network bits, and the final octet as host bits.
– The required bits define the class type.

• Subnetting
Subnet Mask
– There are not enough IP addresses available to provide every network with a default IP address.
• Scaling of the Internet to its present size was not accounted for.
– Subnetting is the practice of squeezing more network addresses out of a given IP address than are available by default.
– By default means: upon reading the first octet in an address, a router knows which bits to treat as network address bits.

Subnet Mask
• In the real world, most enterprises need more network address space than what they are assigned by their IPSs.
• This creates the need to ‘cheat’ by claiming some of the default host bits for use in addressing networks
• It is done by inserting a third zone between the default network and host address spaces.
• A subnet allows for a hierarchy of internets within a network.

Subnet Mask
• A network can have one IP address to connect to the Internet, but within that network, it is possible to have various subnet numbers for each subnet.
• To create a subnet, a bit mask or subnet mask, must be applied to show which part of the address is the network part and which is the host.
• The subnet mask is a 32 bit number that has 1’s for bit positions specifying the network and subnet parts and 0’s for the host part.

Subnet Mask • Subnet Mask Class A:
– 255.0.0.0
• Subnet Mask Class B:
– 255.255.0.0
• Subnet Mask Class C:
– 255.255.255.0

Subnet Mask
• The subnet mask can be thought of as a way of determining which part of the IP address represents the network identifier (NetID) and which part represents the HostID.
• Subnet masks are determined using a logical bitwise AND.
• The bitwise AND operation has two sets of binary numbers (IP address and subnet mask), and uses a set of rules to determine the outcome if the mask bit is a 1 or a 0.

Subnet Mask
• Rule 1
– Any bit ANDed with a 1 is copied to the result.
• Rule 2
– Any bit ANDed with a 0 produces a 0 in the result.

Subnet Mask • Example 1
Address bits
1001
Mask bits
1100
Result bits
1000
Address bits
110011
Mask bits
111100
Result bits
110000
• Example 2

Subnet Mask
• Now to create this using a subnet mask
– The binary pattern for the IP address 10.10.10.1 is:
1st Octet
2nd Octet
3rd Octet
4th Octet
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
• To use the first 16 bits of the address as our NetID we use a mask of 16 binary 1’s
– We AND this with the above address

Subnet Mask
1st Octet
2nd Octet
3rd Octet
4th Octet
10
10
10
1
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
10
0
0
0
Address Mask Result
• Hence the NetID is 10.0.0.0
– and the remainder value is 0.10.10.1 – Subnet mask: 255.0.0.0

Subnet Mask
• How does the network know if a computer is on the same network or a different one?
• It uses an adjacency check
– A test is performed on the source and destination IP address.
– If they have the same NetID then they are both on the same subnet (or physical network segment).
• The actual delivery will be carried out using the MAC address.

Subnet Mask
• If they have differing NetID’s then they are on different network segments.
– Data will be sent to the default router or gateway.
– The router will then forward the packet to another router or to a locally connected network.

Subnet Mask – Example 1
Source IP address
10.10.10.1
Subnet Mask
255.255.0.0
NetID
10.10.0.0
Source IP address
10.10.27.33
Subnet Mask
255.255.0.0
NetID
10.10.0.0
• Are these computers on the same network?

Subnet Mask – Example 2
Source IP address
10.15.170.1
Subnet Mask
255.255.0.0
NetID
10.15.0.0
Source IP address
10.15.27.63
Subnet Mask
255.255.0.0
NetID
10.15.0.0
• Are these computers on the same network?

Subnet Mask – Example 3
Source IP address
10.15.174.1
Subnet Mask
255.255.255.0
NetID
10.15.174.0
Source IP address
10.15.27.63
Subnet Mask
255.255.255.0
NetID
10.15.27.0
• Are these computers on the same network?

Subnetting
– Supports:
• 16,384networks • 65,534hosts
– Problem – need to sub divide networks to make them manageable and easier to administrate.
– We have an Net address: 154.132.0.0 with a default subnet mask of 255.255.0.0.
• The network can use all of the last 16 bits to identify hosts
• the following IP addresses are all suitable for hosts on this network: – 154.132.10.1
– 154.132.10.19
– 154.132.110.123 – 154.132.254.254
• Class B network

Subnetting
– Extend the subnet mask so that the mask covers the third Octet.
– We will now use the following subnet mask: • 255.255.255.0
• Solution:

Variable Length Subnetting
• What happens if you get a situation where a company doesn’t want 254 networks each with 254 hosts?
• Perhaps they only want 10 networks but with up to 600 hosts on each. Or they may want six networks each with 2000 hosts.
– To do this, the rather rigid approach of using all of the third octet as the subnet mask is too inflexible.
– What we want to do is to use some, or all of the third octet to subdivide our networks.
– This is called variable-length subnet masking.

Variable Length Subnetting
• Use a part of the 3rd or 4th octet:
• Just using two bits to distinguish our network range.
• With these two bits we have the following possibilities:
– 00, 01, 10 and 11
• By using only two bits in the third octet to designate our network component we will be using those bits corresponding to a place value of 192 (made up of 128 +64).
– Giving a subnet mask of: 255.255.192.0

Variable Length Subnetting
• If we use three bits the patterns are as follows:
– 000, 001, 010, 011, 100, 101, 110 and 111.
• Our mask will then be (using 128+64+32) 224.
– This together with the initial two octets, gives us a complete mask of 255.255.224.0.
• With three bit we have eight possible network combinations.
– If we use four bits we would have 16(24) network combinations. Continuing… with five bits we have 32 networks, six bits give us 64 networks and so on…

Variable Length Subnetting
Binary form
Dot-decimal notation
IP address
11000000.10101000.00000101.10000010
192.168.5.130
Subnet mask
11111111.11111111.11111111.11000000
255.255.255.192
Network prefix
11000000.10101000.00000101.10000000
192.168.5.128
Host part
00000000.00000000.00000000.0000010
0.0.0.2
http://jodies.de/ipcalc?host=192.168.5.130&mask1=16&mask2=

Variable Length Subnetting
• Computers on different networks can not talk to each other, and requires a router to connect them – even if they are connected via a switch
• IP’s represents the same type of network? – IP1: 192.10.10.22
– IP2: 192.10.10.22
• Only Subnet mask could tell!
– IP1: 192.10.10.22/24 – classful
– IP2: 192.10.10.22/26 – classless

Example: Getting a NetID’s
• IP address is: 192.168.3.55/28
• What is the network ID?
• 198.168.3.48
• How you get it?
• Logical AND of IP address with subnet mask
• What is the broadcast address?
• 192.168.3.63
• How to get a broadcast address?
• Logical OR of the compliment of subnet mask and the IP address



1.
2.
3.
4.
Example: Getting NetID’s
University has allocated our lab a NetID: 192.168.1.0 to use. This is the best they can do.
However, we need 4 small networks for our lab for: final year projects,
lab visitors,
research students working in robotics,
students working in image biology have different rights
• What are out NetID’s and broadcast ID for the four networks that we can create?
because they need to share different resources and should

Example: Getting NetID’s
• The default network mask is:
– 11111111.11111111.11111111.00000000
• For 4 sub-nets, we need 2 bits
– 11111111.11111111.11111111.11000000 – With possibilities: 00,01,10,11
• Now find the magic number!
– 11111111.11111111.11111111.11000000: accounts for 64
– So we can have 4 networks with 64 IDs and 64-2 hosts for each network

Example: Getting NetID’s
• The network ID’s are: – 192.168.1.0 /26
– 192.168.1.64 /26
– 192.168.1.128 /26
– 192.168.1.192 /26
• What are the corresponding broadcast addresses?

Example: Host Address
• Given a network mask:
– 255.255.255.240
– You are asked to assign an IP address to a machine
• Which are the useable Host address? A. 192.168.1.224
B. 192.168.1.47
C. 192.168.1.160
D. 192.168.1.192 E. 192.168.1.207 F. 192.168.1.239 G. 192.168.1.108

Questions