首页 > > 详细

辅导 COMP2001J、Python/c++编程讲解

COMP2001J Computer Network 2024
1
Packet Tracer Lab: Introduction
Abstract:
You will learn the basics of setting up networks of computers in Packet Tracer by the following steps:
1. Create a network by physically connecting two computers
2. Get these two computers to communicate with each other
3. Add more computers using a switch
4. Add a router to allow communication outside of the network you have created
Note: All steps described in this lab note have been successfully tested using Packet Tracer 7.3 MacOS 64-
bit version.
Build a basic network
First, we create a basic network by adding two computers to the simulation and connecting them. When we
connect them together, we use a cross-over cable because we are connecting two devices of the same type.

This image with two green dots on both sides shows two computers have already been physically connected.
The dashed cable shows that it is a cross-over cable.

Basic network configuration
Before they can actually communicate, we must set up the network on each device.

By clicking on each individual component, we can configure the network settings of devices. In PC0, we set
its IP address 192.168.1.1 and its subnet mask 255.255.255.0.

In PC1, we set its IP address 192.168.2.1 and its subnet mask 255.255.255.0. Now send a message from PC0
to PC1 (click “add simple PDU”->click “pc0”->click “pc1”). Because the two computers are not in the same
subnet (why?), they cannot communicate with each other, and messages cannot be sent.

To solve this, we either change the subnet mask in both devices or change the IP address of one of the
computers to keep them in the same subnet. The easiest solution is to change the IP address of PC1 to
192.168.1.2.
COMP2001J Computer Network 2024
2
Adding more computers using a switch
A single cable is enough for two computers to communicate with each other. However, in reality, we usually
want more computers to be able to communicate and work together. To do this, we can add a switch. There
are many types of switches that can be added to the network simulations, we choose an empty switch
(Switch-PT-Empty) to get started.

Then, we need to add the necessary ports to this switch. In this example, we will connect four devices, so
we must add four ports to the switch (after we have powered it off). There are different types of ports:
ethernet (10 Mbps), fast ethernet (100 Mbps), and gigabit ethernet (1 Gbps). These are labeled ending in CE,
CFE, and CGE, respectively. As the computers we have created all have fast ethernet connections, we should
drag 4 of these to the switch and power it back on.

Now we can add some more devices (e.g., a laptop and a printer). These should all be connected to the
switch using a straight copper cable. Just like the previous example. we need to set the IP address of each
of the devices and their subnet masks. They should be set to the following values (192.168.1.1 reserved for
the gateway later):
• PC0: 192.168.1.2; 255.255.255.0
• PC1: 192.168.1.3; 255.255.255.0
• Laptop0: 192.168.1.4; 255.255.255.0
• Printer0: 192.168.1.5; 255.255.255.0

Now, you should send messages between any of the devices to test if they are connected.

Connecting to other networks using a router
We are going to add a router such that we can communicate with other devices outside our network. Routers
are more complicated to set up and configure than simple switches, so we must learn how to configure them.

First, we add an empty router to our simulation. We should add two fast ethernet ports to this empty router,
one for connecting to our switch and the other for connecting to something else in the other network. We
remove the “printer0” to free a port of the switch in our network. Connect the switch to the router using a
straight copper cable and click on the router to configure the device. Remember which port number in the
router that we connected the switch to.

Power it off COMP2001J Computer Network 2024
3
Router Configuration
To configure the router, we need to type commands into the CLI (Command Line Interface). This can be
opened by choosing the CLI tab and pressing enter. We should see a terminal like this:

This allows us to type the command into the system to change the settings. If we are unsure what the correct
command is, we can type “?” or add it to a command that we are not sure of.

1. Before changing settings, we have to enable the privileged mode by typing the command enable (or
en). This gives us more options so that we can execute to change the settings.

2. To start setting up the device, we use the configure terminal command. This allows us to configure
the different network interfaces.

3. After this, we must select the correct interface and define the type of connection and the port
number. The switch is connected to this router using fastEthernet over port 0/0 so the command is:
interface fastEthernet 0/0

4. Now we have selected the interface, we can set details like the IP address and subnet mask. This is
done with the command ip address followed by the ip address and the subnet mask. Here we are
going to give the address 192.168.1.1 to the network interface connected to the switch and give it
the same subnet mask as the other devices in the network.

5. Lastly, we need to activate the interface so that it is operational. This is done with the command no
shutdown. This means that the interface will remain on when the device is powered up.

6. Assuming that everything else is done correctly, you should see a message ending ‘changed state to
up’. Finally, we need to exit the interface (so we can configure another interface).
COMP2001J Computer Network 2024
4

Adding a server
Now, we will add a Server to our simulation and connect it to the second port on the router. These should
be connected using a cross-over cable. We will go through the same steps to set the IP address of this
network interface to 10.1.1.1 with a subnet of 255.255.255.0.


After this, we need to set the IP address of the server to 10.1.1.2 with a subnet of 255.255.255.0.
Additionally, we need to set the gateway to the IP address of the router in this network (10.1.1.1). Lastly,
we need to change the settings of all devices in the first network so that the default gateway is set to the
IP address of the router in the first network (192.168.1.1). Now, we should be able to send messages to
devices outside our network.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!