1 / 15

Recitation 6

Recitation 6. Midterm 1’s solution Project 2 IP Forwarding CIDR. Project 2. Environment 1 tracker, 2 seeds and 2 leeches Expand your project 1 Download from multiple peers. Be able to upload. Be able to accept incoming connections.

elmer
Download Presentation

Recitation 6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Recitation 6 • Midterm 1’s solution • Project 2 • IP Forwarding • CIDR

  2. Project 2 • Environment • 1 tracker, 2 seeds and 2 leeches • Expand your project 1 • Download from multiple peers. • Be able to upload. • Be able to accept incoming connections. • Connect to 2 leeches and upload your available pieces to leeches.

  3. Protocol • State machine: • am_choking: this client is choking the peer • am_interested: this client is interested in the peer • peer_choking: peer is choking this client • peer_interested: peer is interested in this client • bitfield: <len=0001+X><id=5><bitfield> SEND+RECV • keep-alive:<length prefix> is 0 • choke: <len=0001><id=0> • unchoke: <len=0001><id=1> • interested: <len=0001><id=2> • not interested: <len=0001><id=3> • have: <len=0005><id=4><piece index> • request: <len=0013><id=6><index><begin><length> SEND+RECV • piece: <len=0009+X><id=7><index><begin><block> SEND+RECV

  4. Notes • After handshake, seeds should send the bitfield with “all of bit 1s”. Leeches may not send “bitfields” or bitfield with “all of bit 0s” • After downloading & verifying a piece, your program should advertise the piece by sending a “have” to peers. Don’t send a “have” to peers having it already.

  5. Sample Question: Subnetting Consider a conventional class B network. A network administrator decides to give all subnets in the class B network a sub-net mask of 255.255.248.0. (5 points) How many sub-nets can the administrator use if all sub-nets use this mask? (5 points) How many hosts are possible on each sub-net? (5 points) The administrator just heard that she only needs 16 sub-nets for the class B address. What sub-net mask maximizes the number of hosts on each sub-net?

  6. MAC A -> FF: …FF, Type=ARP Who has IP X ???? Send broadcast ARP (from IP add. to MAC add.) • Application doesn’t know MAC address !!! • Application works with IP address: ssh 128.6.171.162 (ssh cereal.rutgers.edu) ping 192.168.1.1 • Recall: Ethernet Frame Structure • “A” knows IP X of “C”, how can A send an ethernet frame to C? How does A know MAC of C?? HUB MAC C -> MAC A, type=ARP Hey guy, I have IP X !!! MAC A-> MAC C, type=IP IP packet A B C D

  7. Multi-Hop Forwarding Example X sends an IP packet to Y?? 3. R2b->Y 1.X-> R1a 2. R1b->R2a b b a a R1 R2 N1 N2 N3 x Y 1. X sends to its gateway (IP of R1a) 2. R1 forwards the packet to R2 3. R2 forwards the packet to Y

  8. N1 R1 N2 Deliver directly (ARP) N3 Deliver directly (ARP) N4 R3 Multi-Hop Forwarding Example R1 R2 R3 N1 N2 N3 N4 Dest Next hop Routing table @ R2 Actual routing table contains IP addresses, Flags indicating type of entries, net mask etc.

  9. IP forwarding ROUTING TABLE AT A ROUTER: Destination Gateway Genmask Flags Metric Ref Use Iface 128.6.5.0 A 255.255.255.128 U 0 0 0 eth0 128.6.5.128 B 255.255.255.128 U 0 0 0 eth1 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 128.6.5.1 0.0.0.0 UG 0 0 0 eth0 (default) 128.6.5.1 0.0.0.0 UG 0 0 0 eth0 Question1: Packet with dest IP = 128.6.5.200, what is the next-hop (gateway)? For each entry: if ( <dest IP> AND <netmask> == <destination field>) { choose the next hop = the corresponding gateway; break; } Question2: How many networks does the router connect to?

  10. Host A Application Layer Transport Layer Network Layer Host-to- Net Layer Network programming in JavaTCP/IP stack Host B Application Protocol Data Application Layer Transport Protocols (UDP and TCP) Data Transport Layer TCP/UDP header IP IP IP Network Layer Network Layer Network Layer IP header Data TCP/UDP header Host-to- Net Layer Host-to- Net Layer Host-to- Net Layer

  11. Sample Question: IP Forwarding The following table is a routing table using CIDR. Address bytes are in hexadecimal. The notation “/12” defines the length of the mask in bits. For example, for C4.50.0.0/12, the mask is 12 bits, or FF.F0.0.0 in hexadecimal notation. For each of the following destination IP addresses (in hexadecimal), state what the next hop will be by using the routing table above (2 points each): • C4.4B.31.2E : • C4.5E.05.09 : • C4.4D.31.2E : • C4.5E.03.87 : • C4.5E.7E.12 : • C4.5E.D1.02 :

  12. 200.71.0.0 200.71.1.0 200.71.2.0 ….. 200.71.255.0 200.71.0.0 200.71.1.0 200.71.2.0 ….. 200.71.255.0 service provider service provider Routing table Routing table Reducing Routing Table Size Without CIDR: With CIDR: 200.71.0.0 200.71.1.0 200.71.2.0 ….. 200.71.255.0 200.71.0.0/16

  13. Sample Question: CIDR • The company X has 4 offices, each office has one subnet. All subnets connect to a router (Router 1 in the figure). This router connects to the ISP router. The subnets are described in the figure.

  14. Sample Question: CIDR (cont.) A. Fill out the routing table for the router 1:

  15. Sample Question: CIDR (cont.) B. Assume that the ISP router forwards to the router 1 an IP packet that has the destination address 139.200.1.135. Which subnet will the packet be forwarded to? Based on the routing table in (1), what is the interface that the router 1 will forward the packet through? C. Assume that the ISP router implement CIDR. What is the routing entry for all subnets of the company X in the routing table of the ISP router?

More Related