
Networking Lab
Initial conditions/prerequisites:
•Have a working computer connected to the local network.
•Have Knoppix booted on the computer.
•Have a DHCP server set up in the classroom.
•Have a terminal window open. (Click the icon that looks like a monitor with the >_ symbols on it)
Goals:
•Be able to staticly and dynamically assign IP addresses.
•Have basic knowledge about the fundamentals of networking
The basics of networking are a very simple subject. All that is to be seen is how computers communicate over a network, and how these computers are able to talk to one another.
|
Procedure |
Explanation / Background
|
|
1.The way computers communicate over a network is much like how a mailman delivers mail in a neighborhood. If a house has no address the mailman will not be able to deliver mail to the house. This is the same for a computer, without an IP address it can not receive any information from the other computers on the network. 2. Assigning an IP address is very easy. But first, you must become root. So in your terminal type the command: su This will make you root. Now you can give your computer an IP address. You will give your computer the IP address that is written on the front of the box. If the IP address on the front of the box was 192.168.1.1, you would use this command to assign your computer that address: ifconfig 192.168.1.1 Your computer will now be able to communicate with other computers over the network. |
•IP stands for Internet Protocol. •It is important for no two computers to have the same IP address, or there will be problems. If two houses next to one another had the same address, where would the mail go? •IP addresses assigned in this way are called static IP addresses because the computer keeps that address even if it is shut down. •All information that goes across a network is encapsulated inside of something called a packet. Packets make it easier to transmit information and reassemble, as they contain extra information in addition to what is being sent. This information explains how to reconstruct what was sent across the network. A packet is sort of like an envelope holding a letter. |
|
2.The command ifconfig can be used for many different things. By itself, it will display the current network configuration of your computer. Find your IP address in the information displayed, where the finger is pointing to. Make sure to get the IP address from the device labeled eth0. 3.
|
•Much useful information is displayed when using ifconfig. The RX packets and TX packets are the packets that have been received and transmitted, respectively. •Collisions are when packets intersect one another on the network and then obliterate each other. Collisions usually happen on networks with a lot of traffic going across them. •The section labeled HWaddr is the hardware address of the specified device, commonly called the MAC address. A MAC address is a unique identifier that can not be changed. The MAC address has six parts which are broken up into two sections, both sections are six characters long, and each part of the MAC address is two characters long. The first section identifies the manufacturer of the device, the second section is the number assigned to that particular device to separate it from the rest. |
|
4.The easiest and most basic way to communicate with another computer is to ping it. Performing a ping is a very simple task, all that is needed is the IP address of the computer you wish to ping. If you were to ping 192.168.1.1, the command would be: ping 192.168.1.1 To stop the ping hit Control+C 5.By using ping by itself you can see that the computer you pinged is responding by their IP address showing on the screen. To actually see your computer talking to your friend's, you have to use the tcpdump command. Use the tcpdump command now to see all of the traffic moving over the network, using this command: tcpdump Tcpdump displays all of the packets of information received by your computer, though at this time you do not want to see all of the traffic moving across the network. |
•When you run ping, there is a section labeled TTL. TTL stands for Time To Live. This number is the amount of hops a packet will go before it dies. One hop is the handing off of a packet from one computer, server or router to another. If the packet has to go through two computers, three servers and fifteen routers to get to its destination, it has to make twenty hops. |
|
6.To sort out your friends IP address from the rest, you will need to grep for it, using a pipe. Grep is a very handy tool which can be used to search for patterns or strings in the target area. Note: To get the pipe character, hold <shift> and press the key that is just above <enter>. If your friend's IP address was 192.168.1.2, you would use the command: tcpdump -n | grep '192.168.1.2' This would bring up all of the traffic on the network that is headed to or coming from 192.168.1.1. Now if you ping your friend you will be able to see the ping going across the network. |
•The -n argument tells tcpdump not to display host names, only to display IP addresses. This is important because otherwise you would not be able to grep for the specific IP address you want, as sometimes two computers have the same name, and this would cause problems if you were to grep for the traffic from that name. The command to display your computers name is: hostname |
This next section will deal with using dynamic IP addresses instead of static IP addresses. Exciting, isn't it?
|
8.Earlier you assigned your computer an IP address, now you will have your computer go out and find an IP address for itself. The easiest way to do this is to click on the crazy looking penguin icon in the lower left hand corner of the screen, then to network configuration, and on to network card configuration. Now if there are more than two network cards in the computer it will ask you to specify which to use. If so, ask your instructor to tell you which card is connected to the local DHCP server. Next, a dialog box will pop up asking if you would like to use DHCP, click yes. 9.You should now have a new IP address, use ifconfig to confirm this. If you did not receive a new IP address, try the previous step again, and check again. If you still do not have a new IP address, speak to your instructor. |
DHCP is an acronym for Dynamic Host Configuration Protocol |
|
Procedure |
Explanation / Background |
|
10.Every website has an IP address that you are sent to when you type in the URL into the address bar in your browser. Imagine having to remember every one of those IP addresses, it would be very hard to do. This is why DNS (Doman Name Service) is very useful. DNS will take the name of the website that you give it and find out what IP address is associated with that name. This is how you are able to get to a website just by typing in a URL. Performing a DNS lookup is very easy. If you want to know the IP address of google.com, use the command: host google.com This will display all of the IP addresses that are associated with that URL. |
•For many large websites, such as Google, there will be more than one IP address returned when a DNS lookup is performed. •Another reason why remembering IP addresses for websites would be troublesome is because if the company hosting the website decides they want new hardware, the IP address of the site could change.
|
|
11.In most cases, when you connect to a website, you do no connect directly to that website, you have to go through routers, servers and other computers. It is possible to trace the path of the connection, to see all the points in between. This can be useful if you are having trouble connecting to a specific site or location and want to know where things are going wrong, so you can know who you should yell at for stopping your connection. There are a couple of ways to trace a path in Linux. The nicest looking one is Matt's Trace Route. To trace the path to google.com using Matt's Trace Route, use the command: mtr google.com Alternatively, you can use the basic Trace Route command which behaves a bit differently. To trace google.com with it, use the command: traceroute google.com You will now be able to see all of the different paths you have to go through to get to google.com |
|
Stuff to do when you're done with the lab
Here are some things to try if you finish early.
1.Trace your favorite websites, then goto some of the hops that are in between.
Lab Worksheet Name: ____________________
Date: ____________________
What command can you use to determine your IP address?__________________________________________
What is your IP address? _____________________________________________________________________
What is the most basic way to communicate between computers?_____________________________________
What are the different IP
addresses that google.com uses?___________________________________________
_________________________________________________________________________________________
How many hops does it take to get to google.com?_________________________________________________