1, Connect two PC s directly 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.
Configure two PC s
PC0 | PC1 |
---|---|
192.168.10.1 | 192.168.10.2 |
ping each other
Done.
2, Building LAN with switches
Build a LAN with the following topology:
The basic network configuration of each PC is shown in the following table:
Build and configure according to the previous ip:
1.PC0 can ping PC1, but not PC2 and PC3
2.PC3 can ping PC2, but not PC0 and PC1
3. The four PCs can ping each other; Because when the subnet mask is 255.255.255.0, PC0, PC1, PC2 and PC3 are under two different subnets. After changing to 255.255.0.0, the four PCs are under the same subnet, so they can ping each other.
4. The network connected by the layer-2 switch needs to be configured with a gateway. After the layer-2 switch is configured with a gateway, it can establish a transmission connection between the two networks, so as to establish a cascaded, point-to-point transmission connection across multiple networks between hosts on different networks.
The Hub hub can only broadcast the received frames from other ports, and the switch will judge the received frames and forward them to the corresponding ports.
3, Switch interface address list
Layer 2 switch is a plug and play multi interface device. It has three processing methods for received frames: broadcasting, forwarding and discarding (please find out when and what operations). Then, to forward successfully, the switch must have an interface address list, i.e. 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. You can see that the MAC Table of the initial switch is empty, that is, it does not know how to forward frames (how will it handle?). After accessing (ping) PC1 with PC0, Check the MAC Table of the switch again. Now there are corresponding records. Please think about how to get them. 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!
Initial situation:
After accessing pc1 with pc0, view it again
It can be seen from the above figure that the MAC table of the switch is empty at first, that is, it does not know how to forward frames, so it will broadcast the received frames; If you receive a reply from a port, you can know that the MAC address of the frame coexists in its MAC table.
After accessing (ping) PC1 with PC0, check the MAC table of the switch. Now there are corresponding records, which is the MAC address obtained through ARP (address resolution protocol).
I call this simulation mode, which can run step by step and facilitate us to observe the process in the middle.
4, 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:
Build your own as follows:
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:
Your own diagram is as follows:
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:
Your own diagram is as follows:
5, Preliminary router configuration
We simulate the connection between Chongqing Jiaotong University and Chongqing University, and construct the following topology:
To configure the router of Jiaotong University, first turn off the switch, drag WIC-1T to the specified position, and then turn on the switch.
Configure it
Configure the entire 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 assign the network number
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 and assign the network number
192.168.3.0/24, the router interface is also the gateway of Chongqing University network, and 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
Note II
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?).
A: the transmission distance of twisted pair is limited
Let's take the WAN port connection through the router as an example to make relevant configuration. Please note: the router we selected does not have a WAN module (WIC-1T, etc.) by default. You need to turn off the router, add it, and then turn it on.
Note III
In the simulated WAN connection, pay attention to the DCE and DTE terminals (there is a prompt on the line when connecting, and the DCE terminal with a clock flag. Please refer to relevant data for the concepts of DCE and DTE). The clock frequency of 64000 needs to be configured at the DCE terminal
Note IV
The router has a variety of command line configuration modes, and each mode corresponds to different prompts and corresponding permissions.
Please pay attention to entering configuration related commands in the correct mode.
**-User mode: user mode
- Privileged mode: privileged mode
- Global configuration mode: global configuration mode
- Interface mode: interface configuration mode
- Subinterface mode: subinterface configuration mode**
Note V
In reality, it is obvious that the new router cannot be configured remotely. We must connect with the console interface of the router through the serial port of the notebook and make the initial configuration (note that the bit rate is set to 9600) before we can configure remotely through the network. This is also the intention of the notebook connection drawn on the upper left of the figure above.
Note VI
In the CLI interface of the router, you can see that after the router is started successfully, because there is NO configuration, you will be prompted whether to carry out dialog configuration (Would you like to enter the initial configuration dialog?). Because there are many steps, please select NO
For example, the preliminary configuration of Jiaotong University router can be as follows:
The router interface configuration data in the topology diagram is as follows:
The basic configuration of Jiaotong University router is as follows:
Ethernet port:
WAN port:
The basic configuration of Chongqing University router is as follows:
Ethernet port:
WAN port:
At this point, the basic configuration of the router is completed. Please continue to configure each PC according to the PC configuration table above.
ping test after configuration:
A: This is because PCs in Jiaotong University belong to the same subnet and are connected by switches. PCs in Chongqing University also belong to another subnet and are connected by switches; However, University A and University B are connected through a router. Because the routing table of the router is not initialized, the PC in university a cannot communicate with the PC in University B.
6, 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
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
Check the routing table and you can see a route marked S, which means Static.
So far, these PC s can ping each other!
7, 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 the IP of each interface according to the previous basic configuration
And other parameters (this method is recommended. 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, and Chongqing University router uses 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
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
Looking at the routing table, you can see a route marked R, which means RIP.
So far, these PC s can ping each other!
8, 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
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
Looking at the routing table, you can see a route marked O, which means OSPF.
So far, these PC s can ping each other!
9, 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:
The router interface configuration data in the topology diagram is as follows:
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
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.
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.
10, Virtual LAN VLAN
In the actual network, 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 VLAN, 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.
A: the network segments of PC s in a non VLAN are different, so they cannot communicate with each other; VLAN is a data link layer protocol, which is responsible for dividing the broadcast domain without considering IP; the gateway is used for protocol conversion, and a gateway must be required for communication between different network segments. If it is necessary to initiate broadcast test, a three-layer switch is required.
11, Virtual LAN management VTP
In the previous experiment, we planned and divided VLANs on switches. However, in practical application, we will never allow arbitrary VLAN division on these switches that support VLANs, which will cause management confusion! VLAN division must be planned and managed uniformly, 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 called virtual LAN trunk protocol. It is a Cisco private protocol. VTP uniformly manages, adds, deletes and adjusts VLAN, 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:
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.
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.
Be sure to switch the 1 and 2 interfaces of the multi-layer switch to trunk, otherwise it will not be connected all the time.
12, 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.
When the above test is performed using CPT simulation (PC0 ping PC1), we can clearly see that all ICMP packets are forwarded by 3560 switches, which is very easy to form a bottleneck.
13, 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:
The configuration is as follows:
Check each PC first to see if you can get the network configuration
It can be seen that both PC0 and PC1 computers are automatically assigned network configurations such as IP address, mask, default gateway and DNS server by DHCP.
14, 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:
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.
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.
The configured PC0 and laptop Pt wireless networked computers can automatically obtain the network configuration, and PC0 can ping laptop Pt
summary
Through the simulation experiment of computer network in CPT network simulation tool, from the simplest direct communication to routing communication and subsequent protocols, I gradually understand how computer network and modern computer communication network use a series of protocols such as ARP, OSPF, PAT and DHCP, so that I can further study computer network, At the same time, I also think the design of computer network is really interesting. In addition, the teacher's usual explanation is very in place. To tell the truth, this teacher is one of the few teachers who can make me not distracted in class but attracted by the content since I went to college.