cs522 logo
rainbow animatio

Solution to Homework #2. IP address and End Host Routing

Goal:

Assignment Date: 9/11/2006
Due Day: 9/18/2006
Related Material: http://cs.uccs.edu/~cs522/intro/pcnetsetup/pcnetsetup.htm; Chapter 5.6.
Description:

  1. What is the equivalent Classless IP addess notattion for the wired Ethernet 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. What is the equivalent Classless IP address notation for the wireless subnet?
    Ans: The Genmask pattern 255.255.255.0 has 24bit 1s indicating the network address field has 24 bits. The classless IP address notation is 128.198.80.0/24.
  3. How many IP addresses can be assigned to machines in the wireless 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-24) - 3=256-3=253.
  4. What command(s) you use to find out the MAC address of the gateway interface for 128.198.160.0 subnet?
    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

    On blanca, 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.

  5. 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:18 [ether] on eth0

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

  6. 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.

    The following arp command was run 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


  7. Does the gateway (router) change the source and destination IP addresses of the IP packets passing by? Explain (Note that there are two cases, one involves with network address translation, NAT).
    Ans: Since the destination IP address will be used by other routers to forward the IP packets to its final destionation, normally 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.

    The exception case are the firewalls of the destination network (or called enhanced router) and the load balancer of server clusters. The firewall may be configured with the Destination Network Address Translation (DNAT) service where the destination IP address of a packet destined to a web server, or email server, or DNS server, will be translated into a Private LAN address such as 10.0.0.2 and then forward it to a machine within DeMilitarized Zone (DMZ). Note that for the packets for return response, the firewall will change the source IP address from private LAN address back to the corresponding external IP address. In some server cluster systems, one front end distributor or load balancer machine will be configured with the external IP addresses or called Virtual IP addresses of the cluster. When it receives the request, it will forward the requests to one of the physical servers based on some scheduling discipline. Normally the LAN between distributor and physical server are configured with private LAN address. Therefore the request packet's destination IP address will be changed by the distributor from that of VIP to the IP address of the physical server (private IP address). If responses go through the distributor, the source IP address of physical server in the packets will be converted back to the corresponding VIP address.

    The Internet sharing case at home is called SNAT (source network address translation). It converts an outgoing packet's source IP address to that of the share external IP address. Sometimes the port needs to be modified also since other connections may have been allocated with that port number for the external connections. For the response coming back from Internet, the gateway machines will convert its destination IP address back to that of the corresponding internal IP address.

  8. Give an example where a gateway may change the source and destination IP addresses of packets passing by.
    Ans: Oops, In above Internet sharing example, the gateway changes one of the IP address field, but not simultaneously.
  9. Does the gateway (router) change TTL field in the IP header of packets passing by?
    Ans: The gatewy will decrement the TTL field by one.
  10. Does the router repeat the source and destination MAC addresses of the incoming frame in its outgoing frame?
    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.
  11. 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.