This homework assignment has five questions; answer all of them. This assignment is due no later than 9:00 p.m. on Thursday, 18 October.
If you mail in your assignment, please submit a printable document
— a PostScript .ps
or PDF .pdf
document, for
example — and not a source document — a
Word .docx
or Latex .tex
document, for example.
Given 163 < 16217 < 4,800 < 173, assume each node has 17 routers. Because 173 - 4,800 = 113 < 172, the nodes with fewer routers are at the bottom level.
The answers, approximately verbatim, and in no particular order:
Let us assume that x refers to clusters, y refers to regions, and z refers to routers.
Min (x - 1) + (y - 1) + z While (x.y.z) >= 4800 | X | Y | Z | (x - 1) + (y - 1) + z | X.Y.Z. | 16 | 15 | 20 | 49 | 4800 | 15 | 16 | 20 | 49 | 4800 | 17 | 18 | 16 | 49 | 4896 | 18 | 16 | 17 | 49 | 4896 | 17 | 16 | 18 | 49 | 4896 | 16 | 17 | 18 | 49 | 4896 | 16 | 18 | 17 | 49 | 4896X = 16, Y = 15, Z = 20 and X = 15, Y = 16, Z = 20 are the minimum values that occur. For that, the table size is going to be 16 + 15 + 20 and that is 51. (Tanenbaum A., Computer Networks, Chapter 5).
The formula to minimize is (a - 1) + (b - 1) + c.
While abc >= 4800.\ The possible solutions by trial and error1 are 1 a = 17, b = 18, c = 16 \ By the formula (a - 1) + (b - 1) + c = 17 + 18 + 16 = 51 1 a = 17, b = 17, c = 17 \ By the formula (a - 1) + (b - 1) + c = 17 + 17 + 17 = 51 1 a = 18, b = 16, c = 17 \ By the formula (a - 1) + (b - 1) + c = 18 + 16 + 17 = 51 1 a = 16, b = 18, c = 17 \ By the formula (a - 1) + (b - 1) + c = 16 + 18 + 17 = 51 1 a = 17, b = 17, c = 17 \ By the formula (a - 1) + (b - 1) + c = 17 + 17 + 17 = 51 1 a = 16, b = 17, c = 18 \ By the formula (a - 1) + (b - 1) + c = 16 + 17 + 18 = 511: But which one is the best solution?
The minimum occurs at 15 clusters, each with 16 regions, each region having 20 routers, or one of the equivalent forms, e.g., 20 clusters of 16 regions of 15 routers. In all cases the table size is 15 + 16 + 20 = 51.
Reference: Computer Networks by Tanenbaum & Wetherall16 times 16 times 16 = 4096 -> a little too small \ 16 times 18 times 18 = 5184 -> too big \ 16 times 17 times 15 = 4080 -> too small \ 17 times 17 times 18 = 4896 -> almost \ 16 times 16 times 19 = 4864 -> almost \ 16 times 15 times 20 = 4800
The minimum size of the routing table for a three-layer is (x - 1) +, and multiply xyz ≥ 4800 in each other is close enough to the total routers.
The answer would be:| x | y | z | (x - 1) + (y - 1) + z | 17 | 17 | 17 | 49 | 18 | 17 | 16 | 49 | 17 | 18 | 16 | 49 | 18 | 16 | 17 | 49 | 17 | 16 | 18 | 49 | 16 | 17 | 18 | 49 | 16 | 18 | 17 | 49
'a' clusters, \ 'b' regions per cluster, and \ 'c' routers per region.
Now, \ Given that, \ Since abc ≥ 4800 \ The min size of the routing table is (1 - 1) + (b - 1) + c \ and the nearest cube root of 4800 is 16 \ Hence according to trial and error method we get,| A | B | C | (a - 1) + (b - 1) + c | 17 | 17 | 17 | 49 | 18 | 17 | 16 | 49 | 17 | 16 | 18 | 49 | 16 | 17 | 18 | 49 | 16 | 18 | 17 | 49 | 17 | 18 | 16 | 49 | 18 | 16 | 17 | 49
Hence the three parameters in the general vicinity of 16 are 16, 17, and 18.Adding a tokens to the bucket every 5 usec puts (1/5 tkn/usec)(106 usec/sec) = 2×105 tkn/sec. If each token represents 48 bytes, the transmission rate is (2×105 tkn/sec)(48 bytes/tkn) = 9.6 Mbytes/sec.
The answers, approximately verbatim, and in no particular order:
For 1 sec there are 200,000 tokens.\ As each byte has 8 bits, 48 bytes have = 384 bits
Transmission rate = number of tokens/sec times number of bits per token. 200,000 times 384 = 76.8 mbps.The maximum transmission rate is the rate at which the bucket is emptied. The field2 is in the general field format and indicates the size of the bucket in bytes. The value must be a number and must be greater than or equal to the token bucket rate.
To determine the maximum transmission rate we should:Convert from byte to bit (multiply by 8)3 \ Convert from microsecond to second (multiply by 10 sup -6)
5 usec = 48 times 8 times 10 sup 3 bits.1 sec = (48 times 8 times 10 sup 3) / 10 times 10 sup -6
1 sec = 38.4 times 10 sup 9 -> 38.4 GbpsThe maximum transmission rate is 38.4 Gbps
(source: rfc 1363)1: First, the question asks about the undifferentiated maximum transmission rate. Because it doesn't matter which senders contribute to the maximum, multiplexing doesn't seem to be relevant to this question. Second, a back-to-back run of any size has at best an indirect effect on multiplexing: all the packets in the run could come from one sender, but it could also be that each packet in the run comes from a different sender. The choice of senders getting tokens from the bucket has nothing to do with the bucket, but has to do with a scheduler elsewhere in the network subsystem.
2: Field? What is the field?
3: Multiply what by 8?
C22F1582 base 16 is 194 047 021 130 base 256, represented as 194.47.21.130 in dotted-quad notation. 194 base 10 is 11000010 base 2, indicating a class C IP address. See also.
The answers, approximately verbatim, and in no particular order:
C2-2F-15-82 = 11000010.00101111.00010101.10000010 = 194.47.21.130
SOURCE: http://technet.microsoft.com/en-us/library/bb726995.aspx \ http://technet.microsoft.com/en-us/library/cc786995(v=ws.10).aspxTo convert a hexadecimal IP address to dotted decimal notation we need to do two conversion steps:
1 Convert from hex to binary 1 Convert from binary to decimal notation.Conversion Hex to Binary:1
| Hex | Binary | | 0 | 0000 | | 1 | 0001 | | 2 | 0010 | | 3 | 0011 | | 4 | 0100 | | 5 | 0101 | | 6 | 0110 | | 7 | 0111 | | 8 | 1000 | | 9 | 1001 | | 10 | 1010 | | 11 | 1011 | | 12 | 1100 | | 13 | 1101 | | 14 | 1110 | | 15 | 1111 | |2 Conversion TableC22F1582 in hex equals \ 11000010001011110001010110000010 in binary
Convert from Binary to Decimal:With dotted decimal notation, each 32-bit address numbers is viewed as four distinct groupings of 8 bits Each of the four groupings of 8 consecutive bits is referred to as an octet. (source: HTTP://technet.microsoft.com/enus/library/cc786995%28v=2s.10%29.aspx)
| 11000010 | 00101111 | 0010101 | 10000010 | | 128 + 64 + 2 | 32 + 8 + 4 + 2 + 1 | 16 + 4 + 1 | 128 + 2 |As a result, C22F1582 in hexadecimal equals \ 194.47.21.130 in decimal notation.
1: Not necesary
C2=11000010 2F=00101111 15=00010101 82=10000010
Now the combined notation is,11000010.0010101.00010101.10000010 = 194.47.21.130
Hence the dotted decimal notation is 194.47.21.130C2-2F-15-82 \ Now expanding the hexadecimal to binary form, we get. 11000010-00101111-00010101-10000010 \ The decimal equivalent of the above binary form is 194.47.21.130.
Assuming an IP packet, a receiver assembling fragments has to 1) recognize fragments, 2) buffer fragments for reassembly into a packet, and 3) determine how received fragments effect the sequence number acknowledged. Recognizing fragments can be done with the identifier and more-fragments bit in the header. Fragment buffering can be handled easily and flexibly with a queue array indexed by fragment identifier and each queue ordered by fragment offset. Acknowledgments can ignore partially assembled packets, but it may be helpful to acknowledge fragments extending the received-byte sequence number.
The answers, approximately verbatim, and in no particular order:
Place fragments in buffer at destination in the right place for reassembly, even if the fragments arrive out of order.
SOURCE: Tenenbaum page 434So at this stage till the last fragment arrives the total size is not known, since the total size information is not known in any fragment hence the only indication is the last fragment will not contain the more fragment (mf) bit set.
Hence the only way to handle the reasembling of the IP fragments is to buffer the pieces till the last one arrives.1 Once they arrive build a buffer based on the size information that can be extracted and then put the fragments into the buffer.For tracking the bytes that are present or absent a bit map is used. But in a general phenomenon this process is difficult.2
1: Or treat the fragments as if they were packets and use existing buffering, if any.
2: It may be inefficient in terms of space used, but why would it be difficult?
To get rid of that issue, we need to build a buffer which is based on the size of the information that can be derived. Then we can use a bit map to track bytes. (Tanenbaum A., Computer Networks, Chapter 5)
3: Fragment identifier.
4: But is the fragment-identifier field always valid?
5: Does such a timer exist on the receiver side? Sounds difficult to set up. Also, how does the receiver respond when the timer goes off?
6: Really? The only way? Why is that?
7: Yes? And why is that important?
At the destination the IP fragments arrive at different order or some can be missing. As the total size is also not included in any fragment,8 the bit which doesn't has mf bit set is the last fragment.
By building a buffer from which the size of information is extracted, we can put all the fragments and a bit map can be used to track the presence and absence of bytes. This is complete when all the bits in the bitmap are 1.8: The total size of what? The original unfragmented packet? If so, how is that any different from not including the size of the entire data transfer in each packet?
Assume the subnet mask specifies the CIDR prefix for the entry.
int look-up(int ipa) out-line = default-out-line prefix-size = 0 for each entry in look-up-table if ipa & entry.mask == entry.prefix and prefix-size < entry.mask.size prefix-size = entry.mask.size out-line = entry.out-line return out-line This is a simple algorithm, but impractically inefficient.
The answers, approximately verbatim, and in no particular order:
skb
associated
with the packet; the necessary information is inside that structure.
skp->dst
, the routine information, was initialized by the call to
ip_route_input
in ip_rcv_finish
earlier in the code path.
int ip_forward(struct sk_buff * skb)
Router_Alert
option in the header, or if it is present
but no interested processes are running (in which case ip_call_ra_chain
)
return FALSE), ip_forward
continues:1
if (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb)) return NET_RX_SUCCESS if (skb->pkt_type != PACKET_HOST) goto drop skb->ip_summed = CHECKSUM_NONE if (iph->ttl <= 1) goto too_many_hops rt = (struct rtable *) skb->dst; if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) goto sr_failed if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev) + rt->u.dst.header_len)) goto drop ip_decrease_ttl(iph) if (rt->rt_flags & RTCF_DOREDIRECT && !opt->srr) ip_rt_send_redirect(skb) skb->priority = rt_tos2priority(iph->tos) return NF_HOOK( PF_INET, NF_IP_FORWARD, skb, skb->dev, rt->u.dst.dev, ip_forward_finish)
The packet is finally transmitted with dst_output given below:
static inline int ip_forward_finish(struct sk_buff * skb) { struct ip_options * opt = &(IPCB(skb)->opt) IP_INC_STATUS_BH(IPSTATS_MIB_OUTFORWARDDATAGRAMS) if (unlikely(ipt->optlen) { ip_forward_options(skb) return dst_output(skb) }
Reference:\ http://www.civilnet.cn/book/kernel/Understanding%20Linux%20Network%20Internals/understandIni-CHP-20-SECT-1.html
1: Does this handle CIDR?
Destination IP Address Parsing and Table Lookup:
The router performs a table lookup to determine the output port onto which to direct the packet, and the next hop to which to send the packet along this route. This is based on the destination IP address in the received packet and the subnet mask(s) of the associated table entires. The result of this lookup could imply: - A local delivery: that is, the destination addresses is one of the router's local addresses and the packet is locally delivered. - A unicast delivery: to a single output port, either to a next-hop router or to the ultimate destination station. - A multicast delivery: to a set of output ports that depends on the router's knowledge of multicast group membership. The router must also determine the maping of the destination network address to the daa link address for the output port (address resolution or ARP). This can be done either as a separate step or integrated as part of the routing lookup. - Packet Lifetime Control: The router adjusts the time-to-live (TTL) field in the packet used to prevent packets from circulating endlessly throughout the internetwork. A packet being delivered to a local address within the router is acceptable if it has any positive value of TTL. A packet being routed to output ports has its TTL value decremented as appropriate and then is rechecked to determine if it has any life before it is actually forwarded. A packet whose lifetime is exceeded is discarded by the router (and may cause an error message to be generated to the original sender). - Checksum Calculation: The IP header checksum must be recalculated due to the change in the TTL field. Fortunately, the checksum algorithm employed (a 16-bit one's complement addition of the header fields) is both commutative and associative, thereby allowing simple, differential recomputation. (source: rfc 1071)If (N matches a directly connected network address) Deliver datagram to D over that network link; Else if (the routing table contains a route for N) Send datagram to the next-hop address listed in the routing table; Else if (there exists a default route) Send a datagram to the default route; Else Send a forwarding error message to the originator;3
2: You may assume packet validity is established by a lower layer in the protocol stack.
3: Does this handle CIDR?
if (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb)) return NET_RX_SUCCESS if (skb->pkt_type != PACKET_HOST) goto drop skb->ip_summed = CHECKSUM_NONE if (iph->ttl <= 1) goto too_many_hops rt = (struct rtable *) skb->dst; if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) goto sr_failed if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev) + rt->u.dst.header_len)) goto drop ip_decrease_ttl(iph) if (rt->rt_flags & RTCF_DOREDIRECT && !opt->srr) ip_rt_send_redirect(skb) skb->priority = rt_tos2priority(iph->tos) return NF_HOOK( PF_INET, NF_IP_FORWARD, skb, skb->dev, rt->u.dst.dev, ip_forward_finish)4
Reference--\ http://www.civilnet.cn/book/kernel/Understanding%20Linux%20Network%20Internals/understandIni-CHP-20-SECT-1.html
4: Does this handle CIDR?
#define MAX_ROUTES 128 /* maximum size of routing table */ typedef struct { int IPaddress; int subnetmask; int outline; } int numRoutes = 0; Route routingTable[MAX_ROUTES]; /* This function takes ipaddress as its parameter and returns outline value of type int */ public int forward(int ipaddress) { int i; for (i = 0; i < numRoutes; ++i) { // looking for ipaddress in routing table if (ipaddress == routingTable[i].IPaddress) { // returning line value return routingTable[i].outline5 } } }
5: Does this handle CIDR?
int Forward(IP_address) { for (triple in table) { if triple.address = IP_address6 return triple.outline_line } return -1 // or some integer that is irrelevant to the outline lines. }
6: Does this handle CIDR?