ITIS 3100 – Lab 2 Routers Overview: The purpose of this lab is to introduce the student to some of the functions of a router, specifically bridging communication between two networks. For this lab one router (a Linux based system) will be use to connect 2 different networks together and allow them to communicate. The router for this lab will be a low end PC with two NICs installed. The operating system for the router will be Debian Linux. This lab may be done individually or by pairs. If the lab is done in pairs, each student must hand in their own lab report. For pairs each student will “own” one of the networks. They will cooperate to get the clients to communicate through the router. The 3rd octet of their IP address will be assigned by the instructor. See web site or the posting in the lab for your network id. For students working in pairs they will need to work out the address to be shared between their clients. Note: all the examples below use an arbitrary network id of 99. Hardware requirements Equipment: One Linux router (PC) with 2 NICs Two Switches either a Linksys BEFSX41 or WRT54G Important: only the switch function of the Linksys router will be used Two Client Linux VMs on separate PCs Cat 5e cables Procedure: Preliminary Ensure your environment will support the lab The lab will require 3 computers and 2 Linksys routers overall Ensure there are enough power outlets and Ethernet cables available (5 power ports and 4 cables) Part 1 The first part of the lab will be setting up two Linux VMs on two separate physical machines. You will be recycling the VMs that were set up in your last lab. You may use either Debian or CentOS (or one of each). VMs are being used so you don’t mess up the base machines for other classes (and also don’t permanently mess up your own VMs). The two VMs will be set up with IP addresses for different network class environments, one for 172.16 (a Class B network) and one for 192.168 (a Class C network). Last saved: 3/7/2016 11:16:00 PM Page 1 of 6 ITIS 3100 – Lab 2 Routers After the machines are set up they will be connected together via a switch to show they cannot communicate since they are in different networks. In Part 2 of this lab they will be connected via a router and communication will be enabled. Note: Depending on how Linux was set up when the OS was installed, DHCP may or may not be enabled for your NIC cards. (DHCP is an automatic IP address assigner). Having DCHP enabled on either your VM client or on the NIC cards on the router will make the lab impossible to run. One of the steps you will need to do for each of the VMs and the Router is to ensure DHCP is not enabled. The following method of checking and, if need be, changing is valid for Debian Linux: Locate the interfaces configuration file o /etc/network/interfaces View the contents: o Look for the iface line e.g. iface eth0 inet dhcp o If it has static at the end its probably ok, if there is the dhcp change it to static Use vi, vim or another editor of your choice Change dchp to static o Add lines, if needed, to assign an address and a netmask to the NIC for that iface Use man interfaces to find the command(s) to do that Save the file and restart the network card(s) as needed o /etc/init.d/networking restart Lab steps: 1. Configure VM1s IP environment change to root user ■ su (or su -) Configure the IP address to a Class B (172.16.99.1 – 172.16.99.253), e.g. 172.16.99.10. Remember to change the 99 to your own network id. See the IP table on the web page. ■ ifconfig eth0 172.16.99.10 2. Configure VM2s IP environment Configure the IP address to a Class C (192.168.99.1 – 192.168.99.253), e.g. 192.168.99.10 ■ ifconfig eth0 192.168.99.10 3. Connect the two VMs together and test Connect VM1 and VM2 together with a Linksys Router Use only the switched part (ports 1 and 2) - See Figure 1 4. Ping to verify the two VMs cannot communicate From VM1 ■ ping self, for example ping 172.16.99.10 ■ ping other ping 192.168.99.10 Last saved: 3/7/2016 11:16:00 PM Page 2 of 6 ITIS 3100 – Lab 2 Routers From VM2 ■ ping self, for example ping 192.168.99.10 ■ ping other ping 172.16.99.10 5. Optional Bonus (+2pts) Change the net mask for both VMs to /1 Repeat the pings and note the results Return the net masks to normal WAN Linksys 1 2 3 4 PC1 PC2 VM1 VM2 Figure 1 Part 2 Add the Linux router to the network and make necessary changes to the VM IP configurations. The router and the VM systems will be reconfigured to allow communications between the two disparate networks. Lab Steps: 6. Configure the Linux router IP Log onto the router Userid: student PW: student Change to root user su root pw: rootpw Configure the gateway for 172.16.99.0 network ■ ifconfig eth0 172.16.99.254 Configure the gateway for 192.16.99.0 network ■ ifconfig eth1 192.168.99.254 Enable the ip forward function in Linux (very important!) ■ ip forwarding can be enabled for this session by the following command: echo 1 > /proc/sys/net/ipv4/ip_forward Last saved: 3/7/2016 11:16:00 PM Page 3 of 6 ITIS 3100 – Lab 2 Routers ■ ip forwarding can be permanently enabled by the following: find the sysctl.conf file (usually in the /etc directory) find and uncomment the following line: # net.ipv4.ip_forward = 1 The actual parameter on the line may vary by Linux distribution, read the comments to understand which command enables ip forwarding Use the ifconfig and route commands to verify ■ ifconfig ■ route 7. Modify VM1s IP add default gateway for eth0 (very important!) ■ route add default gw 172.16.99.254 use route command to verify the routing table ■ route 8. Modify VM2s IP add default gateway for eth0 (very important!) ■ route add default gw 192.168.99.254 use route command to verify the routing table ■ route 9. Physically connect the system together The Debian router will be inserted between the two VMs See Figure 2 10. Test connections 11. Ping to verify the two VMs can now communicate Note: you may need to wait a short while (1-2 minutes) for the route tables to establish connections. ping self, for example (just for the fun of it) ■ ping 172.16.99.10 ping the gateway ■ ping 172.16.99.254 ping other ■ ping 192.168.99.10 Clean-up 12. Return everything to normal Uncable all hardware and reconnect the pc to the wall port Put away the Linksys “switches” and power bricks Return router to table Deliverables: An organized written lab report including: Screen shots of the IP configurations for the VMs. Screen shots of the results of pings from both Parts 1 and 2 See the Lab 2 suggested format for ideas Points to cover: Setup of the original network and how the network “worked” Last saved: 3/7/2016 11:16:00 PM Page 4 of 6 ITIS 3100 – Lab 2 Routers Setup of the routed network o Changes that were made and why they were done Remember: communication is a critical IT skill! Part of the grade for the lab will be on the written aspect of the lab as well as the physical details. Trouble shooting: Just doesn’t work: o Double check DHCP is disabled and a static IP is set for all machines Can’t change IP: 0. switch to root user 1. use ifconfig to show the basic information Can’t ping gateway: make sure to change default gateway after configuring the IP Use: route add default gw 172.16.99.254 - or route add default gw 192.168.99.254 Can’t ping other network: make sure to open the Linux IP forward function Use: o echo 1 > /proc/sys/net/ipv4/ip_forward Figure 2: Example Lab 2 network for userid 33. Last saved: 3/7/2016 11:16:00 PM Page 5 of 6 ITIS 3100 – Lab 2 Routers Notes: Router information Machine ID: router n ID: student PW: student Root PW: rootpw Last saved: 3/7/2016 11:16:00 PM Page 6 of 6