当前位置:网站首页>The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch

The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch

2022-04-23 19:19:00 It's quite bald, Qi Qi

This blog continues to explain layer 3 switches and dynamic routing in computer networks RIP Protocol experiments .

First, let's introduce the layer 3 switch , What we did before vlan The experiment uses a two-layer switch , Its function is to pc Connect the machine . On this basis, the layer 3 switch adds the function of connecting different LANs similar to routers , In LAN internal network, three-layer switch can be used to replace router , However, the interconnection between LAN and public network can not completely replace the work of router . What we used before vlan, When given a network number , In fact, it can represent a local area network .

Say again RIP agreement , Actually RIP The protocol is the algorithm that the router automatically configures the routing table . The static routing table we configured before requires us to manually enter , When multiple routers are connected, it will be very cumbersome , And when the connection is disconnected due to a problem with the line or equipment , The routing table can be adjusted dynamically , send pc Normal communication .

 Insert picture description here
 Insert picture description here

After talking about the principle , Let's start with the basics of the configuration experiment ip.

 Insert picture description here
Layer 3 switch configuration :

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name v10
Switch(config-vlan)#exit
Switch(config)#vlan 50
Switch(config-vlan)#name v50
Switch(config-vlan)#exit
Switch(config)#int f0/5
Switch(config-if)#switchport access vlan 50 ## take f0/5 Port join vlan50
Switch(config-if)#exit
Switch(config)#int f0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#

Router Router0 Set up :

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int f 1/0
Router(config-if)#ip addr 192.168.1.1 255.255.255.0 ## Set the port ip And mask 
Router(config-if)#no sh ##no shutdown Abbreviation , Open port 

Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet1/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/0, changed state to up

Router(config-if)#exit
Router(config)#int se 2/0
Router(config-if)#ip addr 192.168.2.1 255.255.255.0
Router(config-if)#no sh

%LINK-5-CHANGED: Interface Serial2/0, changed state to down
Router(config-if)#exit
Router(config)#

The rest Router1 Also set as above , It's just a show here .

After configuring the above, let's start with the... In the layer 3 switch vlan No. configuration ip.

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int vlan 10 ## Enter into vlan 10 And configure ip
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up

Switch(config-if)#ip addr 192.168.1.2 255.255.255.0 ## You can find that it is actually related to the port of the router ip equally , Its function is to interface vlan 10 The router address is 192.168.1.2 The interface of 
Switch(config-if)#no sh
Switch(config-if)#exit
Switch(config)#int vlan 50
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan50, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan50, changed state to up

Switch(config-if)#ip addr 192.168.5.1 255.255.255.0
Switch(config-if)#no sh
Switch(config-if)#exit
Switch(config)#ip routing ## This step is very important , Is equivalent to vlan in ip Update the information and put it in the table 
Switch(config)#

We can check the success through the command .

Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, Vlan10      ## These two lines indicate success 
C    192.168.5.0/24 is directly connected, Vlan50

Switch#

End of configuration vlan Of ip after , We can divide different LANs and communicate through three-tier switches , Next, turn on the layer 3 switch and router RIP agreement .

The network number of each network segment :
 Insert picture description here

First, turn on the protocol of the layer 3 switch :

Switch#en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#router rip ## Configuration command 
Switch(config-router)#network 192.168.1.0 ## Declare the direct network segment of this machine 
Switch(config-router)#network 192.168.5.0
Switch(config-router)#exit
Switch(config)#

Next, the router Router 0 Open agreement :

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.2.0
Router(config-router)#exit
Router(config)#

Router Router 1 similar , There's no show here . When we're done, let's look at the routing table .
Three layer switch :

Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, Vlan10
R    192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:18, Vlan10  ## Yes R These two items indicate success 
R    192.168.3.0/24 [120/2] via 192.168.1.1, 00:00:18, Vlan10
C    192.168.5.0/24 is directly connected, Vlan50

Switch#

Router 0 Routing table :

Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet1/0
C    192.168.2.0/24 is directly connected, Serial2/0
R    192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:18, Serial2/0
R    192.168.5.0/24 [120/1] via 192.168.1.2, 00:00:16, FastEthernet1/0

Router#

And then pc See if you can ping through .

 Insert picture description here

ping The experiment proved our success , If you do real machine experiments , I'm still saying , Remember to turn off the firewall !

版权声明
本文为[It's quite bald, Qi Qi]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210600172028.html