You are on page 1of 30
Toaoy Srvpy HeLPee Sumie Pooua www ignousite.com Course Code :8CS-052 Course Title: Network Programming and Administration Assignment Number : BCA(5)/052/Assignment/2020-21 ‘Maximum Marks : 100 Weightage :25% Last Dates for Submission : 31st October, 2020 (For July,2020 Session) 415th April, 2021 (For January, 2022 Session) QA. (a) Define classful addressing and discuss problems associated with it. Ans. In Classful addressing, the address space is divided into five classes: A, B, C, D, and E. Each of these classes has a valid range of IP addresses. Classes D and E are reserved for multicast and experimental purposes respectively. The order of bits in the frst octet determine the classes of IP addres. Pv4 address is divided into two parts: © Network ID © Host ID The class of IP address is used to determine the bits used for network ID and host ID and the number of total networks and hosts possible in that particular class. Each ISP or network administrator assigns an IP address to each device that is connected toits network, First Second Thirdly Fourth First. Second Third Fourth byte byte byte byte! byte byte _—_byte_—_byte cuss class A — =] chss8 i i Class B cass I i Glass Class D [1110 Class 0 [224-239 Class € [1111 Class € [240-255 a. Binary notation b. Dotted-decimal notation Ignou Study Helper-Sunil Poonia Page 1 yan mriae 7 sue Pooma www.ignousite.com Byte1 . Byte2 . Byte3 . Byte4 NET ID [Host iD| MULTICAST ADDRESS RESERVED ‘Note: While finding the total number of host IP addresses, 2 IP addresses are not counted and are, therefore, decreased from the total count because the first IP address of any network is the network number and whereas the last IP address is reserved for broadcast P. The Classful addressing wastes a large part of the address space. © Class A: 0—247-— 2824 + Class B: 10-224. 2916 Class ¢: 110 2°21-~ 248 class D: 1110--1—~- 2928 Class Number of Blocks Block Size Application A 128 16,777,216 Unicast B 16,384 65,536 Unicast G 2.097.152 256 Unicast D 1 268,435,456 Multicast E 1 268,435,456 Reserved sys Ton Sry Hexre EF boom Problems with Classful Addressing: The problem with this classful addressing method is that millions of class A address are wasted, many of the class B address are wasted, whereas, number of addresses available in class C is so small that it cannot cater to the needs of organizations. Class D addresses are used for multicast routing and are therefore available as a single block only. Class E addresses are reserved. (b) Explain the concept of subnetting, default mask and subnet mask, ‘Ans. Subnetting is the strategy used to partition a single physical network into more than one smaller logical sub-networks (subnets). An IP address includes a network segment and a host segment. Subnets are designed by accepting bits from the IP address's host part and using these bits to assign a number of smaller sub-networks inside the original network. Subnetting allows an organization to add sub-networks without the need to acquire a new network number via the Internet service provider (ISP), Subnetting helps to reduce the network traffic and conceals network complexity. Subnetting is essential when a single network number has to be allocated over numerous segments of a local area network (LAN). ‘Subnets were intially designed for solving the shortage of IP addresses Over the Internet. {A subnet mask is a number that defines a range of IP addresses available within 2 network. A single subnet mask limits the ‘number of valid IPs for a specific network, Multiple subnet masks can organize a single network into smaller networks (called subnetworks or subnets). Systems within the same subnet can commiuhicate directly with each other, while systems on different subnets must communicate through a router. ‘A subnet mask hides (or masks) the network part of a system's IP address and leaves only the host part as the machine Identifier, It uses the same format as an IPv4 address — four sections of one to three numbers, separated by dots. Each section of the subnet mask can contain a number from 0 to 255, just like an IP address. For example, a typical subnet mask for a Class C IP address is: 255,255.255.0 In the example above, the first three sections are full (255 out of 255), meaning the IP addresses of devices within the subnet ‘mask must be identical in the first three sections. The last section of each computer's IP address can be anything from 0 to 255. If the subnet mask is defined as 255.255.255.0, the IP addresses 10.0.1.99 and 10.0.1.100 are in the same subnet, but. 10.0.2.100 is not, A subnet mask of 255.255.255.0 allows for close to 256 unique hosts within the network (since not all 256 IP addresses can be used). If your computer is connected to a network, you can view the network's subnet mask number in the Network control panel (Windows) or System Preference (macOS). Most home networks use the default subnet mask of 255.255.255.0. However, an office network may be configured with a different subnet mask such as 255.255.255.192, which limits the number of IP addresses to 64 Large networks with several thousand machines may use a subnet mask of 255.255.0.0. This is the default subnet mask used by Class 8 networks and provides up to 65,536 IP addresses (256 x 256). The largest Class A networks use a subnet mask of 255.0.0.0, allowing for up to 16,777,216 IP addresses (256 x 256 x 256). Ignou Study Helper-Sunil Poonia Page 3 se iau nian sof Sumi PooMlA {c) Calculate subnet address if the IP address and the subnet mask are given as shown below: IPaddress: _205.50.39.56 Subnet Mask: 255.255.245.0 Ans. Address: 205.50.39.56 — 11001101.00110010.00100111 .00111000 Netmask: 255.255.255.0=24 11111111,11911111.11111111 00000000 Wildeard: 0.0.0.255 _00000000,00000000.00000000 .11111111 Network: 205.50.39.0/24 —11001101.00110010.00100111 .00000000 (Class C) Broadcast: 205.50.39.255 11001101.00110010.00100111 11111111 HostMin: 205.50.39.1 11001101.00110010,00100111 .o0000001, HostMax: 205.50.39.254 — 11001101.00110010,00100111 11111110 Hosts/Net: 254 Supernet Netmask:. 255.255.240.0=20 11111111.1111444919111(0000,00000000 wildcard: 0.0.15.255 00000000.00000000,0000 1111.11111111 Network: 205,50.32.0/20 11001101.00110010.0010 0000.00000000 (Class C) Broadcast: 205.50.47.255 11001101.00110010.0010 1114.41111111 HostMlin: 205.50.32.1 _11001101,00110010,0010 0000.00000001 HostMax: 205.50.47,254 11001101.00110010.0010 1111.11111110 Hosts/Net: 4094 2. (a) What is the address space in a system with 32 bit addresses? ‘Ans. Processes like Notepad,exe and MyApp.exe run in user mode. Core operating system components and many drivers run in the more privileged kernel mode, For more information about processor modes, see User made and kernel mode. Each user- ‘mode process has its own private virtual address space, but all code that runs in ketnel mode shares a single virtual address space called system space. The virtual address space fora user-mode process is called user space. In 32-bit Windows, the total available virtual address space is 2°32 bytes (4 gigabytes). Usually the lower 2 gigabytes are used for user space, and the upper 2 gigabytes are used for system space. Ignou Study Helper-Sunil Poonia Page 4 esis Toney Sry Heveee = Sume Poona www.ignousite.com T0000 Per-process vitual 2GB address spaces TeetreRE BD System virtual 2B | caress space FERRE In 32-bit Windows, you have the option of specifying (at boot time) that more than 2 gigabytes are available for user space. The consequence is that fewer virtual addresses are available for system space. You can increase the size of user space to as much 83 gigabytes; in which case only 1 gigabyte is available for system space. To increase the size of user space, use BCDEdit /set Increaseuserva. (b) How many bits are needed for defining Net IDs and Host IDs of Class A, Class B and Class C respectively? ‘Ans. Introduced the concepts of IP address classes and showed how the classes related to ranges of IP addresses. Of the five classes, D and E are dedicated to special purposes, so will leave those alone for now. Classes A, B and Care the ones actually assigned for normal (unicast) addressing purposes on IP internetworks, and therefore the primary focus of our continued attention ‘As we've seen, they differ in the number of bits (and octets) used for the network ID cofmpared to the host ID. The number of. different networks possible in each class is a function of the number of bits assigned to the network ID, and likewise, the number of hosts possible in each network depends on the number of bits provided for the host ID. We must also take into account the fact that one, two or three of the bits in the IP address is used to indicate the class itself, soit is effectively “excluded from use in determining the number of networks (though again, itis still part of the network ID). Based on this information, we can calculate the number of networks in each class, and for each class, the number of host IDs per network. Shows the calculations, iP | Total #OfBits it Octet | # Of Network ID | Usable #Of | Number of | #OfHost IDs Address | For Network ID | of IP Bits Used To | NetworkID | Possible | Per Network Class 1 Host ID Address | Identify Class Bits Network IDs ID Class A 8/24 (xx 2000 q e1=7 2-2=126 2A2= 46,277,214 Ciass B 16/16 Ox 00K 2 27 = 16,384 _| 2.2 = 65,534 Class C 2418 10x xxx, 3 T= 2,097,152 Ignou Study Helper-Sunil Poonia Page 5 Toaoy Srvpy HeLPee www.ignousite.com ‘Sumi Poowa Let's walk through one line of this table so we can see how it works. I'll stick with class B since it's “in the middle”. The basic division is into 16 bits for network ID and 16 bits for host ID. However, the first two bits of all class B addresses must be "10", so that leaves only 14 bits to uniquely identify the network ID. This gives us a total of 214 or 16,384 class B network IDs. For each of these, we have 2" host IDs, less two, fora total of 65,534. Why less two? For each network ID, two host IDs cannot be used: the host ID with al zeroes and the ID with all ones. These are addresses with "special meanings" as described in the topic that follows. You will also notice that 2 has been subtracted from the number of network IDs for class A. This is because two of the class A network IDs (0/and 127) are reserved. There are actually several other address ranges that are set aside in all three of the classes that I haven't shown here. 3. (a) Draw a TCP header diagram and show the number of bits required for each field. Which: of the TCP headet? Explain with an example. ‘Ans. The Transmission Control Protocol is the most common transport layer protocol. It works together with IP and provides a reliable transport service between processes using the network layer service provided by the IP protocol. Id indicates the length TCP segment consists of data bytes to be sent and a header that is added to the data by TCP as shown: 20-60 bytes. Ignou Study Helper-Sunil Poonia Page 6 esis Toney Sry Heveee sue Pocus ‘The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there are no options, header is of 20 bytes else it can be of upmost 60 bytes. Header fields: Source Port Address ~ 16 bit field that holds the port address of the application that is sending the data segment. Destination Port Address — 16 bit field that holds the port address of the application in the host that is receiving the data segment. Sequence Number — 32 bit field that holds the sequence number, i, the byte number of the first byte that is sent in that particular segment. Its Used to reassemble the message at the receiving end if the segments are received out of order. ‘Acknowledgement Number — 32 bit field that holds the acknowledgement number, Le, the byte number that the receiver expects to receive next. Its an acknowledgment for the previous bytes being received successfully Header Length (HLEN) — This isa 4 bit field that indicates the length of the TCP header by number of 4-byte words in the header, Le, if the header is of 20 bytes(min length of TCP header), then this field will hold 5 (because 5 x 4 = 20) and the maximum length: 60 bytes, then i'l hold the value 15(because 15 x 4 = 60). Hence, thé ValU@ GF this field is always between 5 and 15, Control flags ~ These are 6 1-bit control bits that Control connection establishment, connection termination, connection abortion, flow control, mode of transfer ete. Their function is: ‘+ URG: Urgent pointer is valid ‘+ ACK: Acknowledgement number is valid( used in case of cumulative acknowledgement) * PSH: Request for push * RST: Reset the connection * SYN: Synchronize sequence numbers * FIN: Terminate the connection Window size — This field tells the window size of the sending TCP in bytes. Checksum — This field holds the checksum for error control. It is mandatory in TCP as opposed to UDP. Urgent pointer ~ This field (valid only if the URG control flag is set) is used to point to data that is urgently required that needs to reach the receiving process at the earliest. The value of this field is added to the sequence number to get the byte number of the last urgent byte. TeP Connection ~ TCP is connection oriented. A TCP connection is established by 3-way handshake. Ignou Study Helper-Sunil Poonia Page 7 sys Ton Sry Hexre EF boom (b) What is the significance of the following TCP header fields: + Sequence Number * Reserved bits © Window Size Checksum + Urgent Pointer Ans. Sequence Number : A TCP connection is a method of transmitting two byte streams, one stream in each direction. To map the unordered, unreliable bytes in IP packets to the ordered bytes in this stream, each byte in each stream is identified by ‘a sequence number. Each TCP packet contains a segment of the stream as its payload. The TCP header contains the sequence ‘number of the first byte in this segment. TCP packets can contain an acknowledgement, which is the sequence number of the next byte the sender expects to receive (and thus, an acknowledgement of receiving all bytes prior to that). The sequence number field is 32 bits. Naively, this means each byte stream can be up to 2” bytes, or 4.3 gigabytes, long. Does this mean you can’t use a plain TCP connection to download a file larger than 4.3 gigabytes? No: when the sequence number 2°? is reached, the sequence number wraps around to zero again! ‘Because of this wrap-around, bytes in the stream don’t actually have a unique identifying sequence number. How then can we Identify which byte a packet is talking about? The answer strictly is “we can’t”, (To mitigate this, TCP can use timestamps to identify old packets, so as to discard them. More about'thatattack another time.) You might expect the first byte inthe stream to have index 0, or 1. Butit does not! Instead, the sender chooses @ random “initial sequence number” (ISN) during the connection handshake. (This complication is apparently to mitigate an attack whereby an attacker can impersonate another IP address) if the attacker is able to forge the source IP address of the IP packets it sends. Again, I'll cover that another time.) Reserved bits. jeserved data in TCP headers always has a value of zero. This field aligns the total header size as a multiple of four bytes, which is important for the efficiency of computer data processing. Reserved bits in data structures are those that have some special meaning and are used internally, Bit 3 of error code in in your example will be set if any reserved bits in paging-related data structures were modified by your code. Eg. in 4 Mb page directory entries on x86 bits 21 through 12 are reserved for use by system and overwriting them is an Page fault error code bits: 0: no page found 4: protection fault 0: read access 1: write access O:kernelmode access 1: user-mode access 1: use of reserved bit detected 41: fault was an instruction fetch Ignou Study Helper-Sunil Poonia Page 8 Toaoy Srvpy HeLPee i Sumie Pooua www ignousite.com Window Size: TCP window size is one of the most popular options for network troubleshooting or performing an application baseline. 've read many articles and books that can make this option quite overwhelming, but it's actually pretty straightforward. The TCP window size, or as some call it, the TCP receiver window size, is simply an advertisement of how much data (in bytes) the receiving device is willing to receive at any point in time. The receiving device can use this value to control the flow of data, ras a flow control mechanism. ‘Some operating systems will use a multiple of their maximum segment size (MSS) to calculate the maximum TCP window size. For example, in Microsoft Windows 2000 on Ethernet networks, the default value is 17,520 bytes, or 12 MSS segments of 1,460 bytes each. | suggest you document your system's default since it can change when installing an application. When this scenario occurs, measure the "TCP recovery time.” This is the time it takes for the receiver to go from a zero value to at least one MSS value in a TCP Window Update. In the screenshot below you can see that it took the receiver more than two seconds to "recover" from a zer0 condition, le Est View Go Caphre rahe Stites Telephony Weer Teck Hap Au C@ URE QeeeTIS BQaae OE = te me foace Oran Fob Loh fe 1 0,000 Client Server TCP 60 [TCP Zerodindow] 910042230 [ACK] Seq=1 Ack=1 Win=0 Leno 2 2.153 Client Server TCP 60 [TCP Window Update] 9100+2230 [ACK] Seq=1 Ack=1 Win=2920 Len=0 Look for TCP ZeroWindowProbe packets (screenshot below) since they help prove that the sender recognizes the receiver has Indicated its TCP Window size is zero, but is trying to get the flow going again. The existence of TCP ZeroWindowProbeAck packets also indicates that the network is delivering packets and the devices are not down. Fle Edt View Go Capture Anaye Sutisties Telephony Wireless Tools Hep 4uc@BEREQe2BTSS ZaQaan a ee a aT 11 0,002 Server Client TCP) 60, [TéP!ZeroWindow] 9100-2230 12 5.504 Client Server TcP 60 [TCP ZerowindowProbe] 2230+ ||43/ 0.001 Server Client TCP 60 [TCP ZerowindowProbeack] [T 14 5.507 Client server TCP 60 [TCP ZeroWindowProbe] 2230+ 15 0.001 server €lient

You might also like