1. Briefly define the following terms: (24%) (a) TCP Socket: (4%) p232 TCP socket is identified by a four-tuple: (source IP address, source port number, destination IP address, destination port number). Thus, when a TCP segment arrives from the network to a host, the host uses all four values to direct (demultiplex) the segment to the appropriate socket. (講到四個給三分, 多的 解釋一分) (b) Congestion window(4%) p308 The congestion window, dented cwnd, imposes a constraint on the rate(2%) at which a TCP sender can send traffic into the network.(tcp sender 和 into the network 2 分) (c) ICMP(4%) P389 ICMP is used by hosts and routers(2) to communicate network-layer information(1) to each other. The most typical use of ICMP is for error reporting(1). (d) Routing vs. forwarding(4%) P344 Forwarding refers to the router-local action of transferring a packet from an input link interface to the appropriate output link interface. (2) 透 過 forwarding table 決定從 input link interface => output link interface Routing refers to the network-wide process that determines the end-to-end paths that packets take from source to destination. (2) 建立 routing table (e) Exponential backoff P508 When transmitting a given frame, after experiencing the nth collision in a row for this frame, the adapter chooses a value for K at random from {0,1,2,…,2m-1} where m=min(n,10). The adapter then waits K*512 bit times before sensing if the channel is idle. (f) CSMA/CD p507 CSMA/CD does the following: 1. An adapter may begin to transmit at any time; that is, there is no notion of time slots. 2. An adapter never transmits a frame when it senses that some other adapter is transmitting; that is, it uses carrier sensing. (CS 2%) 3. A transmitting adapter aborts its transmission as soon as it detects that another adapter is also transmitting; that is, it uses collision detection. (CD 2%) 4. Before attempting a retransmission, an adapter waits a random time that is typically small compared with the time to transmit a frame. (MA) 2. TCP congestion control algorithm has three major components. Briefly describe the functionality of each component.(9%) p310 (1) Slow start: When a TCP connection begins, the value of cwnd is typically initialized to a small value of 1 MSS, resulting in an initial sending rate of roughly MSS/RTT. For example, if MSS=500bytes and RTT=200msec, the resulting initial sending rate is only about 20 kbps, since the available bandwidth to the TCP sender may be much larger than MSS/RTT, the TCP sender would like to find the amount of available bandwidth quickly. Thus, in the slow-start state, the value cwnd begins at 1 MSS and increase by 1 MSS every time a transmitted segment is first acknowledged. ( 1->2->4 到 ssthres 變回每次+1 3%) (2) Congestion avoidance: On entry to the congestion-avoidance state, the value of cwnd is approximately half its value when congestion was last encountered—congestion could be just around the corner! Thus, rather than doubling the value of cwnd every RTT, TCP adopts a more conservative approach and increases the value of cwnd by just a single MSS every RTT. (超過 ssthres 每次多 1,2% 每個 rtt 的時間才+1 1%) (3) fast recovery: In fast recovery, the value of cwnd is increased by 1 MSS(1%) for every duplicate ACK(2%) received for the missing segment that caused TCP to enter the fast-recovery state. Eventually, when an ACK arrives for the missing segment, TCP enters the congestion-avoidance state after deflating cwnd. If a timeout event occurs, fast recovery transitions to the slow-start state after performing the same actions as in slow start and congestion avoidance: The value of cwnd is set to 1 MSS, and the value of ssthresh is set to half the value of cwnd when the loss event occurred. 3. (a) Describe the purpose of having an IP address as well as a MAC address used in a network host. (b) Why are different inter-AS and intra-AS protocols used in the Internet? Ans: (a) By having different kinds of address in network layer and link layer, we can use different kinds of protocols (not only a 802.3 protocol) in our LAN side connecting to the same WAN running in IP protocol. Furthermore, since the IP address is designed in a hierarchical structure and most of the time location dependent, whenever a host moves to a new location, it can register to the local administrator for a new IP address rather than updating the IP tables around the whole Internet. (b) We use different inter-AS and intra-AS routing protocols to solve the scalability and administrative authority problems. The scalability problem means, if we have all our routers in the Internet running on a single routing protocol, as the number of routers become large, the overhead involved in computing, storing, and communicating routing information will become unacceptable. The administrative authority problem means each ISP or organization may want to run its routers whatever routing protocols it please or hide aspects of its network’s internal organization from the outside. 4. (a) Use link-layer switches as an example to explain collision domains and plug-and-play. (b) What is the fundamental difference between a link-layer switch and a router? (c) How to resolve the hidden terminal problem in wireless LANs? Ans: (a) Collision domain on a switch: each link connected to the switch is its own collision domain. The switch will only forward frames that destined to that link. Plug-and-play on a switch: when using a switch, it does not need to be configured. It has a self-learning mechanism that builds the switch table on its own. (b) A switch is a link-layer device which examines the link-layer header to forward frames, while a router is a network-layer device that examines the network-layer header to route packets. (c) Using the RTS and CTS signals. When a sender wants to transmit its frame to a receiver, it will first send a RTS to notify the receiver to reserve channel for it. The receiver will broadcast a CTS to give the sender the permission to send while preventing other nodes from sending their frames to it for that reserved duration. 5. A student attaches a laptop to the NCTU campus network. He/she then requests and receives www.google.com. Identify and briefly describe protocols(at all layers) involved in requesting and receiving such a www page. Ans: IEEE 802.3(link layer), use CSMA/CD to forward frames in LAN. In this case, it helps your laptop communicate with routers or DNS server in your LAN via 802.3 Ethernet protocol. DHCP(application layer), allow a host to dynamically obtain its IP address from network server when it joins network. In this case, when the laptop connects to the campus network, it will run the DHCP protocol to obtain an IP address. UDP(transport layer), provide an unreliable, connectionless, fast data transmission. In this case, the DHCP messages are encapsulated in UDP datagrams. ARP(link layer), find the MAC address that corresponds to a known IP address. In this case, before your laptop can query the DNS server, it must first send ARP query to get the MAC address of the router. DNS(application layer), query the IP address of a domain name. In this case, query the IP address of www.google.com. TCP(transport layer), provide a reliable , full-duplex connection between two hosts. In this case, your laptop may establish a TCP connection to the server of www.google.com, then requesting and receiving data on it. HTTP(application layer), request and receive the content of web pages; In this case, the page of www.google.com. RIP or OSPF or BGP(network layer), intra-AS or inter-AS routing protocols. In this case, it helps your packets correctly route between routers from your local network to the server of www.google.com. Others may include ICMP or 802.11 wireless LAN. 6. 14% 6. a) S1 S1 Link Link layer layer R1 R1 Network Network layer layer S2 S2 Link Link layer layer R2 R2 Network Network layer layer R3 R3 Network Network layer layer Host Host AA Application Application layer layer Host Host BB Application Application layer layer b) Application Transport Network Network Network Data link Data link Data link Data link Physical Physical Physical Physical R1 R2 Host A S1 Application Transport Network Network Data link Data link Data link Physical Physical Physical R3 S2 Host B c) IP=2, MAC=d MAC=c MAC=b IP=3, MAC=e S1 S1 IP=1, MAC=a MAC=j R1 R1 MAC=k S2 S2 IP=7, Host Host AA MAC=i IP=4, MAC=f R2 R2 IP=5, MAC=g IP=8, MAC=l IP=6, R3 R3 MAC=h Host Host BB Source MAC Destination MAC Source IP Destination IP i) a d 1 8 ii) a d 1 8 iii) e f 1 8 iv) g h 1 8 v) i l 1 8 vi) i l 1 8 d) A router forwards a packet by examining the value of a field in the arriving packet’s forwarding table. The result from the forwarding table indicates to which of the router’s outgoing link interfaces the packet is to be forwarded. Depending on the network-layer protocol, this value in the packet’s header could be the destination address of the packet or the indication of the connection to which the packet belongs. router 根據收到封包的 destination IP,查 forwarding table 來決定這個封包的 outgoing interface e) Each node (host or router) has an ARP table in its memory, which contains mappings of IP addresses to MAC addresses. By using ARP protocol, routers can obtain the next hop MAC addresses. 用 ARP 詢問 next hop 的 MAC address,或者 ARP table 上已有 cache 可就現有 的資料來得知 next hop 的 MAC address f) R3 Host B MAC address i l Interface 1 2 g) Destination Address Range 1 8 Link Interface 0 1 (or IP of R1) (or IP of R3) (Assume R1 is link to interface 0 and R3 is link to interface 1 of R2.) 7. Initialization: From u Cost to u v x 0 1 ∞ y 2 z ∞ v y ∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ Cost to v x 1 4 0 3 ∞ 3 y 2 ∞ 0 z 7 6 ∞ ∞ ∞ loop 1: From u v y u 0 1 2 Du(u) = 0, Du(v) = min{c(u, v) + Dv(v) , c(u, y) + Dy(v) } = min{ 1 + 0 , 2 + ∞} = 1, Du(x) = min{c(u, v) + Dv(x) , c(u, y) + Dy(x) } = min{ 1 + 3 , 2 + 3} = 4, Du(y) = min{c(u, v) + Dv(y) , c(u, y) + Dy(y)} = min{ 1 + ∞ , 2 + 0} = 2, Du(z) = min{c(u, v) + Dv(z) , c(u, y) + Dy(z) } = min{ 1 + 6 , 2 + ∞} = 7 Loop 2: Cost to From u v y u v x y z 0 1 2 1 0 3 4 3 3 2 3 0 6 5 5 Du(u) = 0, Du(v) = min{c(u, v) + Dv(v) , c(u, y) + Dy(v) } = min{ 1 + 0 , 2 + 3} = 1, Du(x) = min{c(u, v) + Dv(x) , c(u, y) + Dy(x) } = min{ 1 + 3 , 2 + 3} = 4, Du(y) = min{c(u, v) + Dv(y) , c(u, y) + Dy(y)} = min{ 1 + 3 , 2 + 0} = 2, Du(z) = min{c(u, v) + Dv(z) , c(u, y) + Dy(z) } = min{ 1 + 5 , 2 + 5} = 6 Loop 3: From stable. 8. u Cost to u v x 0 1 4 y 2 z 6 v y 1 2 3 0 5 5 0 3 3 3