Solution to Homework #2. IP address and End Host Routing due 9/17/2003

Goal:

Assignment Date: 9/10/2003
Due Day: 9/17/2003
Related Material: Section 5.6.0-5.6.3, and http://cs.uccs.edu/~cs522/intro/pcnetsetup/pcnetsetup.htm
Description:

Exercise 1. Classless Address Notation

  1. What is the equivalent Classless IP addess notattion for this subnet?
    Ans: The Genmask pattern 255.255.224.0 has 19 bit 1s indicating the network address field has 19 bits. The classless IP address notation is 128.198.160.0/19.
  2. How many IP addresses can be assigned to machines in this subnet (assume one is used by the router for the grateway interface, one used for broadcast, and one used for identifying the subnet itself)?
    Ans: 2^(32-19) - 3=8192-3=8189.
  3. Find out the MAC address of the gateway interface for 128.198.160.0 subnet. What command you use?
    Ans: I use ping and arp. The MAC address of 128.198.160.1 is 00:00:0C:07:AC:01.
    sanluis.uccs.edu> netstat -rn
    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    128.198.160.0 0.0.0.0 255.255.224.0 U 0 0 0 eth0
    169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
    127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
    0.0.0.0 128.198.160.1 0.0.0.0 UG 0 0 0 eth0


    sanluis.uccs.edu> /sbin/arp -a
    sunshine.uccs.edu (128.198.162.68) at 00:06:5B:F6:E4:CC [ether] on eth0
    chow.uccs.edu (128.198.161.110) at 00:00:39:B4:86:E0 [ether] on eth0
    sunshine.uccs.edu (128.198.162.68) at 00:06:5B:F6:E4:CC [ether] on eth0
    chow.uccs.edu (128.198.161.110) at 00:00:39:B4:86:E0 [ether] on eth0

    It does not see to be there in the arp cache table. No packet was sent the gateway recently. Therefore I created some traffic that goes through gateway 128.198.160.1

    sanluis.uccs.edu> ping 128.198.1.250
    PING 128.198.1.250 (128.198.1.250) 56(84) bytes of data.
    64 bytes from 128.198.1.250: icmp_seq=1 ttl=127 time=0.764 ms
    64 bytes from 128.198.1.250: icmp_seq=2 ttl=127 time=0.148 ms
    64 bytes from 128.198.1.250: icmp_seq=3 ttl=127 time=0.147 ms
    64 bytes from 128.198.1.250: icmp_seq=4 ttl=127 time=0.144 ms

    --- 128.198.1.250 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 2997ms
    rtt min/avg/max/mdev = 0.144/0.300/0.764/0.268 ms

    sanluis.uccs.edu> /sbin/arp -a
    math.uccs.edu (128.198.168.202) at 00:06:5B:F6:E4:CC [ether] on eth0
    lincoln.eas.uccs.edu (128.198.160.64) at 00:06:5B:0F:1A:19 [ether] on eth0
    evans.eas.uccs.edu (128.198.160.66) at 00:06:5B:0F:17:10 [ether] on eth0
    sunshine.uccs.edu (128.198.162.68) at 00:06:5B:F6:E4:CC [ether] on eth0
    ? (128.198.160.1) at 00:00:0C:07:AC:01 [ether] on eth0
    chow.uccs.edu (128.198.161.110) at 00:00:39:B4:86:E0 [ether] on eth0


    The /etc/resolv.conf file shows the following entry

    search uccs.edu eas.uccs.edu
    nameserver 128.198.160.64
    nameserver 128.198.160.66
    nameserver 128.198.1.250

    The search line indicates the domain name(s) to attach to a local name such as sanluis for DNS name lookup.
    The three nameserver lines indicate the primary DNS server used by blanca is 128.198.160.64, the secondary DNS server is 128.198.160.66 and the tenary DNS server is 128.198.1.250.

  4. For DNS query, blanca will first try to send it to 128.198.160.64. In that DNS query message, what is the source IP address, the destination IP address, the source mac address, the destination mac address?
    Ans:
    We can find blanca's IP address by "nslookup blanca" or see the local information in /etc/hosts at blanca.uccs.edu.
    128.198.162.60 blanca.uccs.edu blanca

    sanluis.uccs.edu> nslookup blanca
    Note: nslookup is deprecated and may be removed from future releases.
    Consider using the `dig' or `host' programs instead. Run nslookup with
    the `-sil[ent]' option to prevent this message from appearing.
    Server: 128.198.160.64
    Address: 128.198.160.64#53

    Non-authoritative answer:
    Name: blanca.uccs.edu
    Address: 128.198.162.60


    Therefore the source IP address is 128.198.162.60.
    The destination IP address is 128.198.160.64.

    The source mac address can be found using /sbin/ifconfig

    blanca.uccs.edu> /sbin/ifconfig
    eth0 Link encap:Ethernet HWaddr 00:B0:D0:D1:13:5C
    inet addr:128.198.162.60 Bcast:128.198.191.255 Mask:255.255.224.0

    Therefore the source MAC address is 00:B0:D0:D1:13:5C

    The destination MAC address can be found with /sbin/arp -a command:

    blanca.uccs.edu> /sbin/arp -a 128.198.160.64
    lincoln.eas.uccs.edu (128.198.160.64) at 00:06:5B:0F:1A:19 [ether] on eth0

    Therefore the destination MAC address is 00:06:5B:0F:1A:19.

  5. Assume the 128.198.160.64 is shut down for maintenance so is the 128.198.160.66. Both DNS queries will fail. Blanca will try the 3rd DNS server 128.198.1.250. In that DNS query message to 128.198.1.250, what is the source IP address, the destination IP address, the source mac address, the destination mac address?

    Ans: Repeat the same commands used in problem d.
    The source IP address is 128.198.162.60.
    The destination IP address is 128.198.1.250.
    The source MAC address is
    00:B0:D0:D1:13:5C. The destination MAC addres for the frame sent by blanca will contain the MAC address of the gateway 128.198.160.1 since 128.198.1.250 is in a different subnet. In problem c we found 00:00:0C:07:AC:01 is the MAC address of 128.198.160.1.

    Note that the gateway will forward the DNS query to 128.198.1.250 over its network interface connected to the 128.198.1.0/21 subnet, say 128.198.1.1. The frame sent by 128.198.1.1 interface will contain IP packet sent by blanca. Compare the frame received by the gateway from blanca with the related frame to be sent by the gateway to 128.198.1250.

    Sherry runs the following arp command on blanca and elan on the gateway, and find the mac address used by the router/gateway is the same.

    elan.uccs.edu> /sbin/arp -a
    uccshub.uccs.edu (128.198.1.1) at 00-00-0c-07-ac-01

    MAC address of the gateway for 128.198.160.0 is obtained using the command
    /sbin/arp -a 128.198.160.1

    ? (128.198.160.1) at 00:00:0C:07:AC:01 [ether] on eth0
    MAC address 00:00:0C:07:AC:01





  6. Does the gateway (router) change the source and destionation IP addresses? Why is that?
    Ans: No. Since the destination IP address will be used by other routers to forward the IP packets to its final destionation, it cannot be changed.
    The source IP address in the IP packet is used by the receiver to identify the sender and as the destination IP address for the return IP packets.

    Not the inside the firewall of the destination netowrk or inside a server clusters. The destination IP address may be changed.

  7. How about TTL field in the IP header?
    Ans: The gatewy will decrement the TTL field by one.
  8. Does the router change source and destination MAC addresses in the frame? Why is that?
    Ans: Yes. Because the receiver on the 2nd LAN segment will have a different MAC addresses, so is the interface of the gateway that connected to the 2nd LAN.
  9. If this is the IP packet destined to 129.42.19.99 (ibm.com), will the intermediate routers change any IP header fields?
    Ans: Only the TTL field and header checksum are changed.