Download presentation
Presentation is loading. Please wait.
Published byHector McDaniel Modified over 9 years ago
1
ECE 4110 – Internetwork Programming Extra Examples on Addressing and FTP
2
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 2 Notice The slides in this file have been added to Lecture8.ppt and Lecture10.ppt, later on. They are provided to you in a separate file for your convenience.
3
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 3 CIDR vs. VLSM Essentially, both are the same thing. Both allow a portion of the IP address space to be recursively divided into subsequently smaller pieces. Difference: Where is the recursion (subdivision of addresses) performed? VLSM: The organization performs the recursion on the address space assigned. Invisible to the global Internet. CIDR: Subdivision of addresses is done by Internet authorities before the user receives the address block.
4
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 4 Addressing: Example 1 A small organization is given a block with the beginning address and the prefix length 205.16.37.24/29. What is the range of the block?
5
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 5 Addressing: Example 1 (Sol’n) Beginning address is 205.16.37.24 Prefix is 29 bits. Keep the first 29 bits and change the last 3 bits to 1s. Beginning:11001111 00010000 00100101 00011000 Ending:11001111 00010000 00100101 00011111 There are only 8 addresses in this block.
6
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 6 Addressing: Example 1 (Alternative Sol’n) Another method to solve this problem. Length of the suffix is 32–29=3. So, there are 2 3 =8 addresses in this block. If the first address is 205.16.37.24, the last address is: 24+7=31 205.16.37.31
7
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 7 Addressing: Example 2 What is the network address if one of the addresses is 167.199.170.82/27?
8
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 8 Addressing: Example 2 (Sol’n) Prefix length is 27 Keep the first 27 bits as is and change the remaining 5 bits to 0s. So, the first 3 bytes remain unchanged. 167.199.170.X Last byte is 01010010 Change last 5 bits to 0s 01000000 64. The network address is 167.199.170.64/27.
9
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 9 Addressing: Example 3 An organization is granted the block 130.34.12.64/26. The organization needs to have four subnets. What are the subnet addresses and the range of addresses for each subnet?
10
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 10 Addressing: Example 3 (Sol’n) Suffix length is 6. 2 6 =64 addresses. 64/4=16 address in each subnet. Subnet 1: 130.34.12.64/28-130.34.12.79/28. Subnet 2: 130.34.12.80/28-130.34.12.95/28. Subnet 3: 130.34.12.96/28-130.34.12.111/28. Subnet 4: 130.34.12.112/28-130.34.12.127/28.
11
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 11 Addressing: Example 4 Address block 190.100.0.0/16 granted to an ISP. These addresses distributed to three groups of customers: 1. 64 customers; each needs 256 addresses. 2. 128 customers; each needs 128 addresses. 3. 128 customers; each needs 64 addresses. Design the subblocks and give the slash notation for each subblock. How many addresses are still available after these allocations?
12
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 12 Addressing: Example 4 (Sol’n – Group 1) 256 addresses suffix length is 8 Prefix length is 24 Customer 1:190.100.0.0/24 190.100.0.255/24 Customer 2:190.100.1.0/24 190.100.1.255/24 … Customer 64:190.100.63.0/24 190.100.63.255/24 Total = 64 x 256 = 16,384 addresses
13
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 13 Addressing: Example 4 (Sol’n – Group 2) 128 addresses suffix length is 7 Prefix length is 25 Customer 1:190.100.64.0/25 190.100.64.127/25 Customer 2:190.100.64.128/25 190.100.64.255/25 … Customer 128:190.100.127.128/25 190.100.127.255/25 Total = 128 x 128 = 16,384 addresses
14
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 14 Addressing: Example 4 (Sol’n – Group 3) 64 addresses suffix length is 6 Prefix length is 26 Customer 1:190.100.128.0/26 190.100.128.63/26 Customer 2:190.100.128.64/26 190.100.128.127/26 … Customer 128:190.100.159.192/26 190.100.159.255/26 Total = 128 x 64 = 8,192 addresses
15
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 15 Addressing: Example 4 (Sol’n) Number of granted addresses: 2 16 = 65,536 Number of allocated addresses: 16,384 + 16,384 + 8,192 = 40,960 Number of available addresses: 65,536 - 40,960 = 24,576
16
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 16 Addressing: Example 5 An ISP has been assigned the address block 206.0.64.0/18. Its first customer requests 800 host addresses. Starting from the first address in the address space of ISP, assign an address block to the customer.
17
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 17 Addressing: Example 5 (Sol’n) /18 has 16,384 addresses (equivalent to 64 class C’s). Customer’s request (800) is more than 2 9 =512, but less than 2 10 =1024. So, 1024 addresses are given to the customer. Prefix is 32-10=22 bits. 11111111 11111111 11111100 00000000 Address block is 206.0.64.0/22, i.e., the range 206.0.64.0 - 206.0.67.255.
18
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 18 Addressing: Example 6 An ISP has 200.25.0.0/16 address block. ISP wants to allocate the 200.25.16.0/20 address block to numerous customers. How can this be done in a classful environment? How can this be done in a classless environment?
19
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 19 Addressing: Example 6 (Sol’n - Classful) 200.25.16.0/20 is equivalent to 16 class C blocks (/24’s). ISP can assign the following 16 class C networks to the customers. Network #0: 200.25.16.0/24 11001000.00011001.00010000.00000000 Network #1: 200.25.17.0/24 11001000.00011001.00010001.00000000 Network #2: 200.25.18.0/24 11001000.00011001.00010010.00000000 … Network #15: 200.25.31.0/24 11001000.00011001.00011111.00000000 Note that all customers get equal shares.
20
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 20 Addressing: Example 6 (Sol’n - Classless) In classless addressing, customers can be assigned blocks of different sizes. For example: Organization A gets ½ of the address block. Organization B gets ¼ of the address block. Organizations C and D each get 1/8 of the address block. How can this be done?
21
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 21 Addressing: Example 6 (Sol’n - Classless) Step 1: Divide address block 200.25.16.0/20 into two equal halves, each with 2 11 =2048 addresses Original ISP Block:11001000.00011001.00010000.00000000 200.25.16.0/20 Org. A:11001000.00011001.00010000.00000000 200.25.16.0/21 Remaining:11001000.00011001.00011000.00000000 200.25.24.0/21
22
Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 22 Addressing: Example 6 (Sol’n - Classless) Step 2: Divide remaining block from Step 1 into two equal halves. Org. B:11001000.00011001.00011000.00000000 200.25.24.0/22 Remaining:11001000.00011001.00011100.00000000 200.25.28.0/22 Step 3: Divide remaining block from Step 2 into two equal halves. Org. C:11001000.00011001.00011100.00000000 200.25.28.0/23 Org. D:11001000.00011001.00011110.00000000 200.25.30.0/23
23
23 Example: tcpdump output We transfer a 25 byte file (sample.bin) in binary mode from client1 to server. Password is 8 bytes. Ftp client output: [tuna@server Works]$ ftp client1 Connected to client1 (10.4.2.2). 220 ready, dude (vsFTPd 1.0.1: beat me, break me) Name (client1:tuna): tuna 331 Please specify the password. Password: (8 bytes password typed here) 230 Login successful. Have fun. Remote system type is UNIX. Using binary mode to transfer files. ftp> get sample.bin local: sample.bin remote: sample.bin 227 Entering Passive Mode (10,4,2,2,179,209) 150 Opening BINARY mode data connection for sample.bin (25 bytes). 226 File send OK. 25 bytes received in 0.000305 secs (80 Kbytes/sec) ftp> bye 221 Goodbye.
24
24 Example: tcpdump output (cont’d) Here is the tcpdump output with the time information removed due to space limitations, and lines enumerated. [tuna@client1 tuna]$ /usr/sbin/tcpdump -l -t port ftp tcpdump: listening on eth0 1.server.33243 > client1.ftp: S 4062919016:4062919016(0) win 5840 (DF) 2.client1.ftp > server.33243: S 4160563913:4160563913(0) ack 4062919017 win 5792 (DF) 3.server.33243 > client1.ftp:. ack 1 win 5840 (DF) 4.client1.ftp > server.33243: P 1:52(51) ack 1 win 5792 (DF) 5.server.33243 > client1.ftp:. ack 52 win 5840 (DF) [tos 0x10] 6.server.33243 > client1.ftp: P 1:12(11) ack 52 win 5840 (DF) [tos 0x10] 7.client1.ftp > server.33243:. ack 12 win 5792 (DF) 8.client1.ftp > server.33243: P 52:86(34) ack 12 win 5792 (DF) 9.server.33243 > client1.ftp:. ack 86 win 5840 (DF) [tos 0x10] 10.server.33243 > client1.ftp: P 12:27(15) ack 86 win 5840 (DF) [tos 0x10] 11.client1.ftp > server.33243:. ack 27 win 5792 (DF) 12.client1.ftp > server.33243: P 86:119(33) ack 27 win 5792 (DF) 13.server.33243 > client1.ftp:. ack 119 win 5840 (DF) [tos 0x10] 14.server.33243 > client1.ftp: P 27:33(6) ack 119 win 5840 (DF) [tos 0x10] 15.client1.ftp > server.33243:. ack 33 win 5792 (DF) 16.client1.ftp > server.33243: P 119:138(19) ack 33 win 5792 (DF) 17.server.33243 > client1.ftp:. ack 138 win 5840 (DF) [tos 0x10] 18.server.33243 > client1.ftp: P 33:41(8) ack 138 win 5840 (DF) [tos 0x10] 19.client1.ftp > server.33243: P 138:163(25) ack 41 win 5792 (DF) 20.server.33243 > client1.ftp:. ack 163 win 5840 (DF) [tos 0x10] 21.server.33243 > client1.ftp: P 41:47(6) ack 163 win 5840 (DF) [tos 0x10] 22.client1.ftp > server.33243: P 163:208(45) ack 47 win 5792 (DF) 23.server.33243 > client1.ftp: P 47:64(17) ack 208 win 5840 (DF) [tos 0x10] 24.client1.ftp > server.33243: P 208:276(68) ack 64 win 5792 (DF) 25.client1.ftp > server.33243: P 276:295(19) ack 64 win 5792 (DF) 26.server.33243 > client1.ftp:. ack 295 win 5840 (DF) [tos 0x10] 27.server.33243 > client1.ftp: P 64:70(6) ack 295 win 5840 (DF) [tos 0x10] 28.client1.ftp > server.33243: P 295:309(14) ack 70 win 5792 (DF) 29.server.33243 > client1.ftp:. ack 309 win 5840 (DF) [tos 0x10] 30.server.33243 > client1.ftp: F 70:70(0) ack 309 win 5840 (DF) [tos 0x10] 31.client1.ftp > server.33243: F 309:309(0) ack 71 win 5792 (DF) 32.server.33243 > client1.ftp:. ack 310 win 5840 (DF) [tos 0x10]
25
25 Example: tcpdump output (cont’d) Ethereal output is easier to read. You can compare it against tcpdump output. No Source Destin. Protocol Info 1 10.4.2.1 10.4.2.2 33243 > ftp [SYN] Seq=4062919016 Ack=0 Win=5840 Len=0 2 10.4.2.2 10.4.2.1 ftp > 33243 [SYN, ACK] Seq=4160563913 Ack=4062919017 Win=5792 Len=0 3 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919017 Ack=4160563914 Win=5840 Len=0 4 10.4.2.2 10.4.2.1 Response: 220 ready, dude (vsFTPd 1.0.1: 5 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919017 Ack=4160563965 Win=5840 Len=0 6 10.4.2.1 10.4.2.2 Request: USER tuna 7 10.4.2.2 10.4.2.1 ftp > 33243 [ACK] Seq=4160563965 Ack=4062919028 Win=5792 Len=0 8 10.4.2.2 10.4.2.1 Response: 331 Please specify the passwor 9 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919028 Ack=4160563999 Win=5840 Len=0 10 10.4.2.1 10.4.2.2 Request: PASS deneme12 11 10.4.2.2 10.4.2.1 ftp > 33243 [ACK] Seq=4160563999 Ack=4062919043 Win=5792 Len=0 12 10.4.2.2 10.4.2.1 Response: 230 Login successful. Have fun 13 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919043 Ack=4160564032 Win=5840 Len=0 14 10.4.2.1 10.4.2.2 Request: SYST 15 10.4.2.2 10.4.2.1 ftp > 33243 [ACK] Seq=4160564032 Ack=4062919049 Win=5792 Len=0 16 10.4.2.2 10.4.2.1 Response: 215 UNIX Type: L8 17 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919049 Ack=4160564051 Win=5840 Len=0 18 10.4.2.1 10.4.2.2 Request: TYPE I 19 10.4.2.2 10.4.2.1 Response: 200 Binary it is, then. 20 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919057 Ack=4160564076 Win=5840 Len=0 21 10.4.2.1 10.4.2.2 Request: PASV 22 10.4.2.2 10.4.2.1 Response: 227 Entering Passive Mode (10, 23 10.4.2.1 10.4.2.2 Request: RETR sample.bin 24 10.4.2.2 10.4.2.1 Response: 150 Opening BINARY mode data c 25 10.4.2.2 10.4.2.1 Response: 226 File send OK. 26 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919080 Ack=4160564208 Win=5840 Len=0 27 10.4.2.1 10.4.2.2 Request: QUIT 28 10.4.2.2 10.4.2.1 Response: 221 Goodbye. 29 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919086 Ack=4160564222 Win=5840 Len=0 30 10.4.2.1 10.4.2.2 33243 > ftp [FIN, ACK] Seq=4062919086 Ack=4160564222 Win=5840 Len=0 31 10.4.2.2 10.4.2.1 ftp > 33243 [FIN, ACK] Seq=4160564222 Ack=4062919087 Win=5792 Len=0 32 10.4.2.1 10.4.2.2 33243 > ftp [ACK] Seq=4062919087 Ack=4160564223 Win=5840 Len=0
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.