Cisco packet tracker experiment

Cisco packet tracker experiment

Use of CPT software

Connect two PC s to build LAN

Connect two PC s directly to form a network. Note: cross wires are required for direct connection.

For the basic network configuration of two PC s, you only need to configure the IP address, and then ping each other successfully.


Building LAN with switches

Build a LAN with the following topology:

The basic network configuration of each PC is shown in the following table:

Q: can PC0 ping PC1, PC2 and PC3?

PC0 and PC1 are on the same subnet, so PC0 can ping PC1, but not PC,2 and PC3.

Q: can PC3 ping PC0, PC1 and PC2? Why?

PC3 and PC2 are on the same subnet, so PC3 can ping PC2, but not PC0 and PC1.

Q: change the masks of the four PC s to 255.255.0.0. Can they ping each other? Why?

They can ping each other. If the mask is 255.255.255.0, PC0, PC1, PC2 and PC3 are not the same LAN, and they cannot communicate with each other. And the mask is changed to
255.255.0.0. They belong to the same LAN and can communicate with each other.

Q: does the network connected by layer 2 switch need to be configured with a gateway? Why?

need. The gateway is used to establish transmission connections between two networks, so that hosts on different networks can establish cascaded, point-to-point transmission connections across multiple networks.

Switch interface address list

Layer 2 switch is a plug and play multi interface device, which has 3 times for received frames
Two processing methods: broadcast, forward and discard (please find out when and what operations). Then, in order to forward successfully, the switch must have an interface address list, that is, MAC
Table, which is automatically obtained by the switch through learning! Still build the topology shown in the figure above and configure the IP of each computer
In the same subnet, use the magnifying glass in the toolbar to click a switch, such as Switch3 on the left, and select MAC Table to see the MAC of the original switch
The table is empty, that is, it does not know how to forward frames (so what will it do?), After accessing (ping) PC1 with PC0, check the MAC of the switch
Table, there are corresponding records now. Please think about how to get it. With the increase of network communication, each switch will generate its own complete MAC table. At this time, the switching speed of the switch is the fastest!


Secret: you can also use CPT's Simulation mode, that is, Simulation mode, to further see this process!

Spanning Tree Protocol

The switch will broadcast when the destination address is unknown or the broadcast frame is received. If there is a loop / loop between switches, a broadcast cycle storm will occur, which will seriously affect the network performance.
The STP protocol running in the switch can avoid the broadcast cycle storm between switches.
Using only switches, build the following topology:

This is the initial state. We can see that there is a loop between switches, which will cause the cyclic transmission of broadcast frames, that is, a broadcast storm, which will seriously affect the network performance.
Then, the switch will automatically block the redundant lines through the spanning tree protocol (STP) to form a spanning tree with a unique path tree with Switch4 as the root (which root switch has relevant policies)!
After a period of time, with the STP protocol successfully building the spanning tree, the two interfaces of Switch5 are physically connected, but logically impassable. They are in Blocking state (Orange), as shown in the following figure:

During network operation, if there is a problem with the physical connection between Switch4 and Switch5 at some time (cut off the connection between Switch4 and Switch5), the spanning tree will change automatically. The previous Blocking interface above Switch5 is now active (green), but the interface below Switch5 is still Blocking (Orange). As shown in the figure below:

Note: the STP protocol of the switch, i.e. spanning tree protocol, always automatically ensures that there will be no loop between switches, thus forming a broadcast storm.

Secret: you can see this process very clearly by using CPT Simulation, that is, the Simulation method!

Preliminary router configuration

We simulate the connection between Chongqing Jiaotong University and Chongqing University, and construct the following topology:

Description I
Jiaotong University and Chongqing University are obviously two different subnets. The communication between different subnets needs to pass through the router.
There is at least one subnet under each interface of the router. In the figure, we simply plan three subnets:
The router on the left belongs to Jiaotong University. The switch is used to connect the network of Jiaotong University, and the assigned network number is 192.168.1.0/24. The router interface is also the gateway of Jiaotong University network, and the assigned IP is 192.168.1.1
The router on the right belongs to Chongqing University. The switch is used to connect the network of Chongqing University. The assigned network number is 192.168.3.0/24. The router interface is also the gateway of Chongqing University network. The assigned IP is 192.168.3.1
The two routers are connected by WAN interface, which is also a subnet. The assigned network number is 192.168.2.0/24

The router interface configuration data in the topology diagram is as follows:

The PC configuration data in the topology diagram is as follows:

Jiaotong University configuration:

Ethernet port:
Router>enable   // Enter privileged mode from normal mode
Router#configure terminal / / enter global configuration mode
Router(config)#interface f0/0 / / enter the configuration Ethernet port mode
Router(config-if)#ip address 192.168.1.1 255.255.255.0 / / configure the IP address of the interface
Router(config-if)#no shutdown / / activate the interface
Router(config-if)#^z / / directly retreat to privileged mode
Router#

WAN port:
Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int s0/0 / / enter the WAN port configuration mode
Router(config-if)#ip address 192.168.2.1 255.255.255.0 / / configure the IP address of the interface
Router(config-if)#clock rate 64000 / / it is the DCE terminal. Configure the clock frequency
Router(config-if)#no shutdown / / activate the interface
Router(config-if)#^z / / directly retreat to privileged mode
Router#

Major configuration:

Ethernet port:
Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int f0/0 / / enter the configuration Ethernet port mode
Router(config-if)#ip address 192.168.3.1 255.255.255.0 / / configure the IP address of the interface
Router(config-if)#no shutdown / / activate the interface
Router(config-if)#^z / / directly retreat to privileged mode
Router#

WAN port:
Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int s0/0 / / enter the WAN port configuration mode
Router(config-if)#ip address 192.168.2.2 255.255.255.0 / / configure the IP address of the interface
Router(config-if)#no shutdown / / activate the interface
Router(config-if)#^z / / directly retreat to privileged mode
Router#

Configuration succeeded

Q: in reality, the connection between Jiaotong University and Chongqing University is remote. The connection is either through the optical fiber interface of the router or through the WAN interface, the so-called serial port (as shown in the topology diagram). Generally, it is not connected through twisted pair (why?).

Because the twisted pair signal has large attenuation.

Q: now PCs and gateways in Jiaotong University can ping each other, and so can Chongqing University. However, you cannot Ping major PCs from Jiaotong University's PCs, and vice versa, that is, you cannot cross subnets. Why?

Because there is no other party's path in the routing table.

Static routing

Static routing is a non adaptive routing protocol, which is manually configured by network managers and cannot be changed according to the change of network topology. Therefore, static routing is simple and efficient, and is suitable for networks with very simple structure.
In the current simple topology, we can use static routing, that is, we can directly tell the router how to get to a network.
When the basic configuration of the above router is successful, use the following command to configure the static routing protocol:

Static routing configuration of Jiaotong University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2 / / tell the router of Jiaotong University that the next hop of the network to 192.168.3.0 is 192.168.2.2
Router(config)#Exit / / exit to privileged mode
Router#show ip route / / view the route table

Routing table

Chongqing University router static routing configuration

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1 / / tell the Chongqing University router that the next hop to 192.168.1.0 is 192.168.2.1
Router(config)#Exit / / exit to privileged mode
Router#show ip route / / view the route table

Routing table

Check the routing table and you can see a route marked S, which means Static.

So far, these PC s can ping each other!

be careful
Our topology simulates only three networks. In reality, the number of networks connected by the router is very large. We also need to configure a default route, otherwise other networks cannot reach! Of course, our topology can be ignored.
Router(config)#ip route 0.0.0.0 0.0.0.0 ... // By default, forward all to This IP

Dynamic routing RIP

Dynamic routing protocol adopts adaptive routing algorithm, which can re optimize the computer routing according to the change of network topology.
The full name of RIP is Routing Information Protocol, which is the representative of distance vector routing (although it is eliminated at present, it can be used as our learning object). Using rip protocol only needs to tell the router which networks are directly connected, and then rip automatically constructs the routing table according to the algorithm.
Because the network we simulated is very simple, we can't use static and dynamic routes at the same time, otherwise we can't see the effect. Therefore, we need to clear the static routes just configured.
Clear static routing configuration:

  • Turn off the router directly. It is equivalent to not saving any configuration, and then reconfiguring IP and other parameters of each interface according to the previous basic configuration (this method is recommended, and you can get familiar with the interface configuration command again);
  • Use the no command to clear the static route. In the global configuration mode, Jiaotong University router uses no ip route 192.168.3.0
    255.255.255.0 192.168.2.2, used by Chongqing University Router: no ip route 192.168.1.0 255.255.255.0 192.168.2.1. It is equivalent to using the no command to cancel the static routing command just configured.

RIP routing configuration of Jiaotong University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#router rip / / enable the RIP routing protocol. Note the router command
Router(config-router)#Network 192.168.1.0 / / network 192.168.1.0 is directly connected to me
Router(config-router)#Network 192.168.2.0 / / network 192.168.2.0 is directly connected to me
Router(config-router)#^z / / directly retreat to privileged mode
Router#show ip route / / view the route table

Routing table

RIP routing configuration of Chongqing University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#router rip / / enable the RIP routing protocol. Note the router command
Router(config-router)#Network 192.168.3.0 / / network 192.168.3.0 is directly connected to me
Router(config-router)#Network 192.168.2.0 / / network 192.168.2.0 is directly connected to me
Router(config-router)#^z / / directly retreat to privileged mode
Router#show ip route / / view the route table

Routing table

Looking at the routing table, you can see a route marked R, which means RIP.

So far, these PC s can ping each other!

Secret script
You can use debug ip rip to start RIP diagnosis in privileged mode. At this time, you will see the distance vector information constantly sent between routers to judge whether the network state has changed, so as to update the routing table. This command will constantly display relevant information and disturb our input. You can use no debug ip rip to turn off RIP diagnosis

Dynamic routing OSPF

OSPF (Open Shortest Path First) is an internal gateway protocol (IGP) used to make routing decisions in a single Autonomous System (AS). OSPF has better performance than RIP and is a widely used routing protocol for intra domain routing.
Similarly, we need to clear the RIP route just configured.
Clear RIP routing configuration:
Turn off the router directly. It is equivalent to that no configuration is saved, and then each interface reconfigures IP and other parameters according to the previous basic configuration
Use the no command to clear the RIP route. In the global configuration mode, all routers use the: no router rip command to clear

OSPF routing configuration of Jiaotong University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#router ospf 1 / / enable OSPF routing protocol. The process number is 1 (you can ignore the concept of process number temporarily)
Router(config-router)#Network 192.168.1.0 0.0.255 area 0 / / all hosts belonging to the 192.168.1.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF
Router(config-router)#Network 192.168.2.0 0.0.255 area 0 / / all hosts belonging to the 192.168.2.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF
Router(config-router)#^z / / directly retreat to privileged mode
Router#show ip route / / view the route table

Routing table

OSPF routing configuration of Chongqing University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#router ospf 1 / / enable OSPF routing protocol. The process number is 1
Router(config-router)#Network 192.168.3.0 0.0.255 area 0 / / all hosts belonging to the 192.168.3.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF
Router(config-router)#Network 192.168.2.0 0.0.255 area 0 / / all hosts belonging to the 192.168.2.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF
Router(config-router)#^z / / directly retreat to privileged mode
Router#show ip route / / view the route table

Routing table

Looking at the routing table, you can see a route marked O, which means OSPF.

So far, these PC s can ping each other!

Secret script
In privileged mode, you can use debug ip ospf events to turn on OSPF diagnosis (no debug ip ospf events to turn off diagnosis), and you can see the Hello information sent between routers to diagnose whether the current link has changed for routing adjustment (event triggering rather than timing update!).

Port based network address translation PAT

Network Address Translation (NAT) is widely used by various Internet service providers, namely ISP s, in their networks, including WiFi networks. The reason is very simple. NAT not only perfectly solves the problem of insufficient lP address, but also can effectively avoid attacks from outside the network and hide and protect computers inside the network.
NAT can be implemented in three ways:

  • Static conversion: Static NAT
  • Dynamic conversion: Dynamic NAT
  • Port multiplexing: OverLoad

Port multiplexing is the most used and flexible. OverLoad refers to not only changing the source IP address of data packets sent to the Internet, but also changing its source port, that is, Port Address Translation (PAT).
Using port multiplexing, all hosts in the internal network can share a legal external IP address to access the Internet, so as to save IP address resources to the greatest extent. At the same time, it can hide all hosts inside the network to effectively avoid attacks from the Internet. Therefore, port multiplexing is the most widely used method in the network.
We still use the topology of Chongqing Jiaotong University and Chongqing University for PAT experiment. We need to ensure that the routing of the two schools has been configured successfully. Whether static routing or dynamic routing is used, we give a complete configuration process as follows: set the routers of the two schools to use OSPF protocol, simulate Jiaotong University to use internal IP address (192.168.1.0 / 24), and simulate Chongqing University to use external IP address (8.8.8.0 / 24), The external IP address (202.202.240.0 / 24) is used between the two routers to implement PAT at the exit of Jiaotong University, that is, the WAN port.

The PC configuration data in the topology diagram is as follows:

Please note that the network configuration of the two pcs of Chongqing University has changed. We simulate it as an external / public IP address!

The router interface configuration data in the topology diagram is as follows:

Please note that the network configuration of the two interfaces of Chongqing University router and the WAN port of Jiaotong University has changed, then configure OSPF routing, and finally implement PAT at the WAN port of Jiaotong University router!

The router interface configuration of Jiaotong University is as follows:

Ethernet port:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int f0/0 / / enter the configuration Ethernet port mode
Router(config-if)#ip address 192.168.1.1 255.255.255.0 / / configure IP address
Router(config-if)#no shutdown / / activate the interface
 WAN port:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int s0/0 / / enter the WAN port configuration mode
Router(config-if)#ip address 202.202.240.1 255.255.255.0 / / configure IP address
Router(config-if)#clock rate 64000 / / it is the DCE terminal. Configure the clock frequency
Router(config-if)#no shutdown / / activate the interface

The router interface configuration of Chongqing University is as follows:

Ethernet port:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int f0/0 / / enter the configuration Ethernet port mode
Router(config-if)#ip address 8.8.8.1 255.255.255.0 / / configure IP address
Router(config-if)#no shutdown / / activate the interface
 WAN port:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#int s0/0 / / enter the WAN port configuration mode
Router(config-if)#ip address 202.202.240.2 255.255.255.0 / / configure IP address
Router(config-if)#no shutdown / / activate the interface

OSPF routing configuration of Jiaotong University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#router ospf 1 / / enable OSPF routing protocol. The process number is 1 (you can ignore the concept of process number temporarily)
Router(config-router)#Network 192.168.1.0 0.0.255 area 0 / / all hosts belonging to the 192.168.1.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF
Router(config-router)#Network 202.202.240.0 0.0.255 area 0 / / all hosts belonging to the 202.202.240.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF

Routing table

OSPF routing configuration of Chongqing University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#router ospf 1 / / enable OSPF routing protocol. The process number is 1
Router(config-router)#Network 202.202.240.0 0.0.255 area 0 / / all hosts belonging to the 202.202.240.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF
Router(config-router)#Network 8.8.8.0 0.0.255 area 0 / / all hosts belonging to the 8.8.8.0/24 network in autonomous domain 0 (reverse mask) participate in OSPF

At this point, these PCs can ping each other! For example, using PC0 (192.168.1.2) to Ping PC2 (8.8.8.2) of Chongqing University within Jiaotong University should be successful.

Next, we will look at the routers of Chongqing University as the backbone routers in the Internet, so these routers will not forward packets with internal / private IP addresses (directly discarded). We simulate the process of packet loss by implementing access control ACL on Chongqing University router, that is, discarding packets from Jiaotong University (private IP address).

Packet loss configuration of Chongqing University Router:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#Access list 1 deny 192.168.1.0 0.0.255 / / create ACL 1, discard / do not forward all packets from the 192.168.1.0/24 network
Router(config)#Access list 1 allow any / / add ACL 1 rules and forward packets from all other networks
Router(config)#int s0/0 / / configure WAN port
Router(config-if)#IP access group 1 in / / implement the rules in ACL 1 on the WAN port for incoming packets. In fact, if the WAN port receives packets from 192.168.1.0/24 IP, it will be discarded

At this time, it is not successful to ping the PC2 (8.8.8.2) of Chongqing University by using the PC0 (192.168.1.2) inside Jiaotong University. The Destination host unreachable message will be displayed.

Secret script
While ping ing, you can see very clearly by using Simulation in CPT software: the WAN port of Chongqing University router discards the packet from Jiaotong University!

Next, let's start implementing PAT. That is, we will convert the internal / private IP address to the external / public IP address at the exit of Jiaotong University router, so that the source IP of the packet will not be discarded by Chongqing University router, so the network is connected.

Router PAT configuration of Jiaotong University:

Router>en   // Enter privileged mode from normal mode
Router#conf t / / enter global configuration mode
Router(config)#Access list 1 permit 192.168.1.0 0.0.255 / / create ACL 1 to allow all packets from the 192.168.1.0/24 network
Router(config)#ip nat inside source list 1 interface s0/0 overload / / the IP from the ACL will implement PAT on the WAN interface
Router(config)#int f0/0 / / configure Ethernet port
Router(config-if)#ip nat inside / / configure the Ethernet port as the internal port of PAT
Router(config)#int s0/0 / / configure WAN port
Router(config-if)#ip nat outside / / configure the WAN port as the external port of PAT

Now, it is OK to ping the PC2 (8.8.8.2) of Chongqing University by using the PC0 (192.168.1.2) inside Jiaotong University again.

Secret script
After the ping is successful, use show ip nat translations in the privileged configuration mode of Jiaotong University router to view the translation process!

Virtual LAN VLAN

In the actual network (such as the network of our university), you can see that routers are generally located at the boundary of the network, and almost all of them are connected by switches.
As we analyzed earlier, the switch is connected to the same subnet! Obviously, broadcasting and even broadcasting storm in such a large-scale subnet will seriously affect the network performance and even paralysis.
In addition, we already know that in fact, the school is divided into N subnets, so these switches are not connected to a subnet! How to explain such contradictory things? We actually use VLAN enabled switches! The aforementioned switch is only an ordinary layer 2 switch (or we use it as a layer 2 switch).
VLAN (Virtual Local Area Network) is Virtual Local Area Network. By dividing VLANs, we can divide a physical network into multiple logical network segments, that is, multiple subnets.
After the VLAN is divided, the network broadcast storm can be eliminated, the network security can be enhanced, and it is convenient for unified management.

Build a topology in CPT as shown in the following figure:

Cisco 2960 switch is a VLAN supporting switch with 24 100M and 2 1000M Ethernet ports. By default, all interfaces are in VLAN 1, so the connected computers are in the same VLAN and can communicate.
Next, the 24 100M interfaces of the switch are divided into three parts and divided into three different VLAN s. The id numbers are set to 10, 20 and 30 respectively, and aliases (computer, communication and electronic) are set to facilitate differentiation and management.

Switch VLAN configuration:

Switch>en
Switch#conf t
Switch(config)#vlan 10 / / create a VLAN with id 10 (by default, all interfaces of the switch belong to VLAN 1 and cannot be used)
Switch(config-vlan)#name computer / / set the alias of VLAN
Switch(config-vlan)#exit
Switch(config)#int vlan 10 / / the VLAN is a subnet. Set its IP as the subnet gateway
Switch(config-if)#ip address 192.168.0.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#vlan 20 / / create a VLAN with id 20
Switch(config-vlan)#name communication / / set alias
Switch(config-vlan)#exit
Switch(config)#int vlan 20
Switch(config-if)#ip addr 192.168.1.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#vlan 30 / / create a VLAN with id 20
Switch(config-vlan)#name electronic / / set alias
Switch(config-vlan)#exit
Switch(config)#int vlan 30
Switch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#exit
Switch(config)#int range f0/1-8 / / group configuration interface (1-8)
Switch(config-if-range)#switchport mode access / / set to access mode
Switch(config-if-range)#switchport access vlan 10 / / classified into VLAN 10
Switch(config-if-range)#exit
Switch(config)#int range f0/9-16
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 20
Switch(config-if-range)#exit
Switch(config)#int range f0/17-24
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 30
Switch(config-if-range)#^Z
Switch#show vlan / / view the VLAN partition

So far, we have divided three VLANs on the switch (excluding the default VLAN 1).
The network configuration of PC under each VLAN and the connected switch interface are as follows:

At this time, you can use the ping command to test. You will find that only PC s in the same VLAN can communicate, and the broadcast is limited to the VLAN.

reflection
Why can't PC s in different VLAN s communicate? What does the gateway do here? Where is our gateway? How do I initiate a broadcast test?

By dividing VLANs, ports in the same vlan can communicate directly without routers, while routers are required to route between different VLANs. As the entrance and exit of communication between VLANs, the gateway should be at the location of the router. The broadcast test is carried out in each vlan. vlan is used to isolate broadcast and avoid broadcast storm.

Virtual LAN management VTP

In the previous experiment, we planned and divided VLANs on the switch. However, in practical application, we will never allow arbitrary VLAN division on these switches that support VLAN, which will cause management confusion! VLAN division must be uniformly planned and managed, which requires VTP protocol.
VTP (VLAN Trunk Protocol) is the VLAN relay protocol. VTP maintains the uniformity of VLAN configuration through ISL frame or Cisco private DTP frame (refer to relevant materials). It is also known as virtual LAN trunk protocol. It is Cisco private protocol. VTP uniformly manages, adds, deletes and adjusts VLANs, and automatically broadcasts information to other switches in the network.
In addition, VTP reduces the configurations that may cause security problems. As long as the corresponding settings are made in the VTP Server, the VTP Client will automatically learn the VLAN information on the VTP Server.
To demonstrate VTP, rebuild the following topology:

As the trunk line, the two 2960 switches and the core 3560 switch should be connected by Gbit port. Although this is not necessary, in reality, this connection performance is the best.
3560 switch is the core switch in the network. We regard it as VTP Server, and VTP domain and VLAN will be created and managed on it.
The two 2960 switches are the convergence layer / access layer switches in the LAN. They will act as VTP clients and can decide the VTP domain and VLAN to join.

At present, the network belongs to VLAN 1, that is, these PC s can communicate with each other. As mentioned earlier, in reality, we must divide VLANs for performance, management and security.
Now our requirement is to create two VLANs, and then let PC0 and PC1 belong to VLAN 2, and PC1 and PC3 belong to VLAN 3.
We will do the following work on the core switch 3560:

  • Set to server mode and VTP domain to cqjtu
  • New VLAN 2, network number 192.168.1.0/24, gateway 192.168.1.1
  • New VLAN 3, network number 192.168.2.0/24, gateway 192.168.2.1

3560 VTP Server configuration:

Switch>en
Switch#conf t
Switch(config)#hostname 3560 / / change the switch name (optional)
3560(config)#vtp domain cqjtu / / set the VTP domain name to cqjtu
3560(config)#vtp mode server / / set it to VTP server mode
3560(config)#VLAN 2 / / create a new VLAN 2
3560(config-vlan)#name computer / / set the alias of VLAN 2 (optional)
3560(config-vlan)#exit
3560(config)#VLAN 3 / / rebuild VLAN 3
3560(config-vlan)#name communication / / set the alias of VLAN 2 (optional)
3560(config-vlan)#exit
3560(config)#int vlan 2 / / configure interface VLAN 2, which will be the gateway of the subnet (on the left)
3560(config-if)#ip address 192.168.1.1 255.255.255.0
3560(config-if)#exit
3560(config)#int vlan 3 / / configure interface VLAN 3, which will be the gateway of the subnet (on the right)
3560(config-if)#ip address 192.168.2.1 255.255.255.0

We will do the following work on the left switch 2960A:

  • Join a VTP domain named cqjtu
  • Configure the Gigabit interface g0/1 connected to the core switch 3560 as trunk mode
  • Divide interface f0/1 into VLAN 2
  • Divide interface f0/2 into VLAN 3

2960A (left) VTP Client configuration:

Switch>en
Switch#conf t
Switch(config)#hostname 2960A / / change the switch name (optional)
2960A(config)#vtp domain cqjtu / / join a VTP domain named cqjtu
2960A(config)#vtp mode client / / set the mode to VTP client
2960A(config)#int g0/1 / / configure the g0/1 Gigabit interface connected to the core switch 3560
2960A(config-if)#switchport mode trunk / / set the interface to trunk mode
2960A(config-if)#switchport trunk allowed vlan all / / allow trunking for all VLANs
2960A(config-if)#exit
2960A(config)#int f0/1 / / configure interface 1
2960A(config-if)#switchport mode access / / set the interface to normal access mode
2960A(config-if)#switchport access vlan 2 / / divide the interface into VLAN 2
2960A(config-if)#exit
2960A(config)#int f0/2 / / configure interface 2
2960A(config-if)#switchport mode access / / set the interface to normal access mode
2960A(config-if)#switchport access vlan 3 / / divide the interface into VLAN 3

We will do the same on the right switch 2960B:

  • Join a domain named cqjtu VTP
  • Configure the Gigabit interface g0/1 connected to the core switch 3560 as trunk mode
  • Divide interface f0/1 into VLAN 2
  • Divide interface f0/2 into VLAN 3

2960B (right) VTP Client configuration:

Switch>en
Switch#conf t
Switch(config)#hostname 2960B / / change the switch name (optional)
2960B(config)#vtp domain cqjtu / / join a VTP domain named cqjtu
2960B(config)#vtp mode client / / set the mode to VTP client
2960B(config)#int g0/1 / / configure the g0/1 Gigabit interface connected to the core switch 3560
2960B(config-if)#switchport mode trunk / / set the interface to trunk mode
2960B(config-if)#switchport trunk allowed vlan all / / allow trunking for all VLANs
2960B(config-if)#exit
2960B(config)#int f0/1 / / configure interface 1
2960B(config-if)#switchport mode access / / set the interface to normal access mode
2960B(config-if)#switchport access vlan 2 / / divide the interface into VLAN 2
2960B(config-if)#exit
2960B(config)#int f0/2 / / configure interface 2
2960B(config-if)#switchport mode access / / set the interface to normal access mode
2960B(config-if)#switchport access vlan 3 / / divide the interface into VLAN 3

So far, each switch is configured.

Secret script
At this time, in the privileged mode of the three switches, you can use the show vtp status command to view the VTP status and the show vlan command to view the VLAN status

The switches, interfaces and network configurations connected to each PC are as follows:

The VTP configuration is now complete. The same VLAN can be ping ed, but different VLANs can't (even under the same switch, such as PC0 to PC1), and it can facilitate unified planning and management.

Communication between VLAN s

VTP only provides convenience for us to divide and manage VLANs. According to the above tests, we still can't communicate between VLANs.
Because by default, communication between VLANs is not allowed. At this time, we need the so-called single arm router to forward it between VLANs!
The core switch 3560 we use is a layer 3 switch, which can work in the network layer, also known as the routing switch, that is, it has the routing function and can carry out this forwarding operation.

3560 switch configuration:

3560>en
3560#conf t
3560(config)#int g0/1 / / configure the interface connecting the 2960A switch on the left
3560(config-if)#switchport trunk encapsulation dot1q / / encapsulating VLAN protocol
3560(config-if)#switchport mode trunk / / set to relay mode
3560(config-if)#switchport trunk allowed vlan all / / forward between all VLANs
3560(config-if)#exit
3560(config)#int g0/2 / / configure the interface connecting the 2960B switch on the right
3560(config-if)#switchport trunk encapsulation dot1q / / encapsulating VLAN protocol
3560(config-if)#switchport mode trunk / / set to relay mode
3560(config-if)#switchport trunk allowed vlan all / / forward between all VLANs
3560(config-if)#exit
3560(config)#ip routing / / enable routing forwarding

So far, PC s in each VLAN can communicate normally.

Simple configuration of DHCP, DNS and Web server

Dynamic host configuration DHCP, domain name resolution DNS and Web services play a great role in daily applications. Let's build the following simple topology for practice.

In this topology, both servers and clients are connected to the same switch. For simplicity, the Server-PT serves as DHCP, DNS and Web servers at the same time. Each client does not need to be configured and will automatically obtain the network configuration.
Click the Server icon in the CPT topology diagram, set its static IP address to 19.89.6.4/24, and then select Service for the following related configurations:


PC0 and PC1 automatically get network configuration

have a try

  • Check each PC first to see if you can get the network configuration
  • Because we set the IP addresses of Google and Baidu to 19.89.6.4, namely server Pt, in the DNS server, if you open the browser of PC0, enter www.google Com or www.baidu.com COM, we should all see the default server Pt Web
    Home page of the server (you can also edit it)

WLAN Preliminary Configuration

WLAN, namely WiFi, is also widely used in various scenarios.
Let's practice the related configuration by building a home WLAN with the following topology:

Secret script
Notebook and desktop computers only have wired network cards by default. Please shut down first, delete the wired network card in the shutdown state, add a wireless network card, and then turn on.

Generally, we need to configure the basic network configuration of the wireless router (IP, mask, gateway, DNS, etc., which are mostly obtained automatically in reality), then configure the wireless access part of the wireless router, such as connection password and encryption type, and turn on the DHCP function. Please refer to relevant materials for configuration.

Keywords: network

Added by willcodeforfoo on Sat, 08 Jan 2022 10:08:23 +0200