4.6. Exercises and Summary

4.6.1. Questions

  1. Which tool will print the current assigned IP number of an interface?

  2. Which file is used to associate a network number to a network name?

  3. Which file is used to assign a host IP number to a host name?

  4. Can the netstat tool display the kernel routing tables?

  5. What is the syntax to add a default route through the 172.16.1.1 router?

  6. Which daemons are commonly used for dynamic routing between LANs?

  7. Which file contains the IPs for the DNS servers

4.6.2. Files

FileDescription
/etc/resolv.conffile containing a list of DNS servers used to resolve computer host names
/etc/sysctl.confconfiguration file for the sysctl tool used to customise kernel settings in /proc/sys/
/proc/sys/net/ipv4/ip_forwardfile containing information about the kernel forwarding status. The kernel will either forward or not packets that are addressed to a different host depending if the file contains a 1 or a 0

4.6.3. Commands

CommandDescription
arpprint the kernel ARP cache
dhcpcda DHCP client daemon
dhcpclienta DHCP client daemon
ifconfigused to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary
netstatprints information about network connections, routing tables, interface statistics, etc
pinguses the ICMP protocol's mandatory ECHO_REQUEST datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. ECHO_REQUEST datagrams (pings) have an IP and ICMP header, followed by a struct timeval and then an arbitrary number of pad bytes used to fill out the packet
pumpis a daemon that manages network interfaces that are controlled by either the DHCP or BOOTP protocol. While pump may be started manually, it is normally started automatically by the /sbin/ifup script for devices configured via BOOTP or DHCP
routemanipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program. When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables
sysctlused to modify kernel parameters at runtime. The parameters available are those listed under /proc/sys/
tracerouteutilizes the IP protocol time to live field and attempts to elicit an ICMP TIME_EXCEEDED response from each gateway along the path to some host

4.6.4. Exercises

  1. In the Routing Scenario section (Figure 4.1, “A routing scenario:”) in this chapter, give the routing table for the LANs gateway.

  2. Start your network interface manually

    ifconfig eth0 192.168.0.x
    

    List the kernel modules. Make sure that the eth0 module is loaded (check /etc/modules.conf).

  3. Stop the network interface with:

    ifconfig eth0 down
    

    Verify that you can bring the interface back up without entering new information:

    ifconfig eth0 up
    
  4. Stop the interface and remove the kernel module (rmmod module). What happens if you try to bring the interface up again?

  5. Divide the class into two networks A (192.168.1.0) and B (10.0.0.0) (see the scenaria for at least three and four hosts (see Figure 4.2, “First Scenario - at least 3 hosts” and Figure 4.3, “Second scenario - at least 4 hosts”).

    Figure 4.2. First Scenario - at least 3 hosts

    First Scenario - at least 3 hosts
    • Try accessing machines across networks (this shouldn't work!)

    • Choose an existing machine to be the gateway (on either network)

    If you choose the router to be on the existing 192.168.1.0 network then do the following on that router:

    • create an aliased interface on the 10.0.0.0 network (x is any available number)

      ifup eth0:1 10.0.0.x  
      
    • allow IP forwarding

      echo 1 > /proc/sys/net/ipv4/ip_forward
      
    • add a route to the other network using the gateway machine (you will need to know either the eth0 or eth0:1 setting of the gateway depending on which network you are on).

    Figure 4.3. Second scenario - at least 4 hosts

    Second scenario - at least 4 hosts

    Make sure the routers force routing through the aliased interface. For example on router A:

    route add -net 192.168.1.0/24 gw 172.16.0.10 dev eth0:0