当前位置:网站首页>Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
2022-06-24 07:16:00 【Network technology alliance station】
Router (Router), It's connecting to the local area networks on the Internet 、 Wan devices , It will automatically select and set the route according to the channel , With the best path , Send signals back and forth , Routers work on the network layer , Used to communicate across network segments , The router has the ability to determine the network address and select IP The function of the path , It can be used in a multi network environment , Build flexible connections , Different data grouping and media access methods can be used to connect various subnets , Routers only accept information from the origin or other routers , An Internet device belonging to the network layer , Therefore, the router is one of the essential network devices in the Internet .
A word description , Extract from 《 Network equipment configuration and management 》 Streamline the content , Part of the content comes from Huawei 《HCIP Safety certification 》 Course notes , Suitable for learning interview , The architecture diagram , And build a process to plan and experiment for yourself .
Router , Its most important function is routing , Routing refers to the behavior that the router selects the best path to transmit the data across the network to the destination address when it receives the data , Each router is responsible for routing or forwarding its own local data , The data is relayed to the target host through multiple routers , Routing workflow includes two aspects: routing selection and routing forwarding .
Basic routing configuration
Routers are different from switches , The switch can work without configuration , But the router must be configured before it can be used normally , The login mode of the router is basically the same as that of the switch , The following will use an example to implement the basic configuration of the router , Include the host name of the configured router , password , Console port ,WAN Interface and LAN Interfaces, etc. , To implement a basic routing structure .
First, we prepare two routers (1841 model ), It should be noted that the line type selected for the connection between the equipment , Generally, routers and PC Use cross lines between , The two routers are connected by serial lines , Configure the following topology :
But when actually connecting two routers , Found no Serial Interface , This is because the router of this model does not provide serial port by default , We can choose from the Cisco simulator WIC-2T modular , And drag it into the empty slot , Restart the switch to complete the configuration .
Next, let's take a look at the network topology , Specific configuration parameters of each device , Including the type ,IP Address , Default gateway and other information .
[ Equipment name ] [ Device interface ] [IP Address ] [ The default gateway ]
PC1 --- 192.168.1.2/24 192.168.1.1
PC2 --- 192.168.2.2/24 192.168.2.1
Router0 Fa0/0 192.168.1.1/24 ---
Serial0/0/0 10.10.10.10/24 ---
Router1 Fa0/0 192.168.2.1/24 ---
Serial0/0/0 10.10.10.20/24 ---Enable remote login by routing : Here we will enable Router1 The remote login function of the router , And set a login password as lyshark.
Router# enable Router# configure terminal Router(config)# hostname Router0 // The configuration host name is Router0 Router0(config)# enable secret lyshark // Configure the privileged mode password to lyshark Router0(config)# line console 0 // Enable Console Router0(config-line)# password lyshark // Set the console login password Router0(config-line)# login // Allow users to log in Router0(config-line)# exit Router0(config)# line vty 0 2 // The configuration number is 0-2 Of 3 Virtual login terminals Router0(config-line)# password lyshark // Configure terminal login password Router0(config-line)# login // Enable login terminal
To configure WAN Interface : The router goes through WAN Interface to the Internet , And common WAN The interfaces are all serial interfaces Serial Express , You can use show controller Command judgment Serial 0/0/0 Is it DCE End , Then decide whether to configure .
Router0> show controller Serial0/0/0 Interface Serial0/0/0 Hardware is PowerQUICC MPC860 DCE V.35, clock rate 2000000 // The judgment here is DEC End
Display the contents according to the above annotations Srial0/0/0 by DCE port , Next, you need to configure the clock frequency for the two routes .
#---- stay Router0 On the operation ------------------------- Router0> enable Router0# configure terminal Router0(config)# interface Serial0/0/0 // Select serial interface Srial0/0/0 Router0(config-if)# ip address 10.10.10.10 255.255.255.0 // Configure external network IP Address Router0(config-if)# clock rate 64000 // The configuration frequency is always 6400 Router0(config-if)# no shutdown // Open port
#---- stay Router1 On the operation ------------------------- Router1> enable Router1# configure terminal Router1(config)# interface Serial0/0/0 Router1(config-if)# ip address 10.10.10.20 255.255.255.0 Router1(config-if)# clock rate 64000 Router1(config-if)# no shutdown
To configure LAN Interface : LAN Interface is used to specify the address of Intranet communication , Next, configure the two routers .
#---- stay Router0 On the operation ------------------------- Router0> enable Router0# configure terminal Router0(config)# interface fa0/0 // Select Ethernet interface fa0/0 Router0(config)# ip address 192.168.1.1 255.255.255.0 Router0(config)# no shutdown
#---- stay Router1 On the operation ------------------------- Router1> enable Router1# configure terminal Router1(config)# interface fa0/0 Router1(config)# ip address 192.168.2.1 255.255.255.0 Router1(config)# no shutdown
Check the configuration information : Finally, you can use show ip route command , View the routing information of the router , Determine if the network is properly connected .
Router0# 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
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Serial0/0/0 // Internet address
C 192.168.1.0/24 is directly connected, FastEthernet0/0 // Intranet address Check the interface information : You can also use show ip interface brief command , View the interface information of the router .
Router0# show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.1.1 YES manual up up Serial0/0/0 10.10.10.10 YES manual up up Serial0/0/1 unassigned YES unset administratively down down Vlan1 unassigned YES unset administratively down down
Finally, test the communication : In the router Route0 On can ping through Route1, Each host can also ping A router that connects its own network segment .
Router0# ping 10.10.10.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.20, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/6 ms
The configuration of the above small experiment is successful , But here's a question , That's it PC0PingPC1 Unable to communicate , This involves the problem that the router does not have corresponding routing entries , These problems will be explained in the following small experiments .
Configure static routing
Static routing needs to be manually configured by the administrator according to the actual needs , The router will not automatically generate the required static route , Static routing includes the destination node or destination network IP Address , It can also include the next jump IP Address , And the data packet outgoing interface when the static route is used on the router , However, to manually configure a static route, the administrator needs to know the topology of the network well to complete the configuration , When the network is large, it still needs to spend a lot of experience and time to maintain , So not all networks are suitable for configuring static routing .
In general, static routing can be considered in the following cases
- The topology of the network is relatively simple , For example, a router and a switch , Static routing can be used .
- The network security requirements are high , The network administrator needs to control the link or the routing table , You can use static routing .
- The network only passes through a single network ISP Access Internet, Then ISP Is the only outlet of the network , Therefore, there is no need to configure static routes .
- Limited routing resources , Unable to run Routing Protocol , under these circumstances , You need to manually configure the routing entries to update the routing table data .
Next, the configuration process of static routing is introduced with an example , Select... In the Cisco simulator 2 platform 1841 Router , Build the network according to the following network topology , Then configure static routing for each router , Realize data exchange between different networks .
Configure the client host : First, we configure according to the configuration requirements in the figure above IP Address gateway and other data , The following parameters are specific address plans .
[ Equipment name ] [ Device interface ] [IP Address ] [ The default gateway ]
PC0 --- 192.168.1.2/24 192.168.1.1
PC1 --- 192.168.1.3/24 192.168.1.1
PC2 --- 192.168.2.2/24 192.168.2.1
PC3 --- 192.168.2.3/24 192.168.2.1
Router0 Fa0/0 192.168.1.1/24 ---
Serial0/0/0 10.10.10.10/24 ---
Router1 Fa0/0 192.168.2.1/24 ---
Serial0/0/0 10.10.10.20/24 ---Configure router : Then we configure the address parameters for the router , ad locum fa0/0 The port is an intranet IP Address ,serial0/0/0 The port is an external network IP Address , The configuration should pay attention to the order , If the configuration is reversed, the effect will not be seen .
#---- stay Router0 On the operation ------------------------- Router0> enable Router0# configure terminal Router0(config)# interface fa0/0 // Configure intranet address Router0(config-if)# ip address 192.168.1.1 255.255.255.0 Router0(config-if)# no shutdown Router0(config)# interface serial0/0/0 // Configure the Internet address Router0(config-if)# clock rate 64000 Router0(config-if)# ip address 10.10.10.10 255.255.255.0 Router0(config-if)# no shutdown
#---- stay Router1 On the operation ------------------------- Router0> enable Router0# configure terminal Router1(config)# interface fa0/0 // Configure intranet address Router1(config-if)# ip address 192.168.2.1 255.255.255.0 Router1(config-if)# no shutdown Router1(config)# interface serial0/0/0 // Configure the Internet address Router1(config-if)# clock rate 64000 Router1(config-if)# ip address 10.10.10.20 255.255.255.0 Router1(config-if)# no shutdown
Check routing configuration : After configuring the above steps ,PC0 And PC1 The host is communicable ,Route0 And Route1 Can also communicate , but PC0 Can't be with PC3 signal communication , The reason is that the router is not configured with a static route , In this step, we only need to ensure that the same network segment can communicate .
#---- stay PC0 On the operation ------------------------- PC0> ping 192.168.1.1 PC0> ping 192.168.1.2 PC0> ping 192.168.1.3 Pinging 192.168.1.3 with 32 bytes of data: Reply from 192.168.1.3: bytes=32 time=0ms TTL=128
#---- stay Route0 On the operation ---------------------- Router0#ping 10.10.10.20 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.20, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/7/12 ms
Configure static routing : Next, we need to configure the routing entries on the two routers , Use ip route Command configuration , If you want to delete a route, you can use no ip route Command to delete the specified route entry .
#---- stay Router0 On the operation -------------------------
Router0> enable
Router0# configure terminal
[ Destination network ] [ Destination mask ] [ Next hop address ]
Router0(config)# ip route 192.168.2.0 255.255.255.0 10.10.10.20#---- stay Router1 On the operation ------------------------- Router1> enable Router1# configure terminal Router1(config)# ip route 192.168.1.0 255.255.255.0 10.10.10.10 // Specify the route on return
#---- Check the configuration parameters -------------------------
Router0# show ip interface brief // Display port ip
Router0# show ip route // Check routing parameters
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
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Serial0/0/0
C 192.168.1.0/24 is directly connected,FastEthernet0/0
S 192.168.2.0/24 [1/0] via 10.10.10.20The final test : After configuring the routing entries , We are PC0 On a host Ping testing PC3 The connectivity of , You will find two network segments that cannot be connected , Now we can communicate normally , This means that our routing configuration has taken effect .
PC0> ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=12ms TTL=126
Ping statistics for 192.168.2.2:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 12ms, Maximum = 12ms, Average = 12msThe above route configuration method , Suitable for small network environment , In a large network environment, this static route configuration is not suitable for maintenance , Once there is too much equipment , You may not be able to figure it out , So in the production environment , We will use dynamic routing to configure the router , Next, continue to learn how to configure dynamic routing .
RIP Dynamic routing
Dynamic routing is based on some kind of protocol , Common routing protocols include internal gateway protocol (IGP) And border gateway protocol (BGP), The internal gateway protocol is divided into routing information protocol (RIP) And open shortest path first protocol (OSPF) agreement .
among RIP( Routing information protocol ) Is the first widely used internal gateway routing protocol ,RIP Use hops to measure the distance to the destination address , Hops refers to the number of routers that data passes between the source address and the destination address . The number of hops from the router to the directly connected network is defined as 1, Each time you pass through a router, the value will increase 1,RIP The maximum number of hops allowed is 15 jump , exceed 15 The hopping network will be unreachable , therefore RIP Suitable for small network environment .
RIP The protocol defaults to every 30 Second, it will broadcast its own routing table with other connected networks , The router receiving the broadcast will compare the received information with its own routing table , Determine whether to add the routing entries in the routing table , at present RIP share 3 Medium version ,RIPv1,RIPv2,RIPng, among RIPng be applied to IPv6 In the network environment ,RIPv1 It's a classed routing protocol ,RIPv2 Is classless routing protocol .
Introduction to configuration parameters : First, we configure various basic parameters of the router according to the configuration requirements in the figure above , The following parameters are specific address plans .
[ Equipment name ] [ Device interface ] [IP Address ] [ The default gateway ]
Router1 Serial0/0/0 192.168.10.1/24 ---
Router2 Serial0/0/0 192.168.10.2/24 ---
Serial0/0/1 192.168.20.1/24 ---
Router3 Serial0/0/0 192.168.20.2/24 ---
Serial0/0/1 192.168.30.1/24 ---
Router4 Serial0/0/0 192.168.30.2/24 ---Configure router : Configure various parameters of the router according to the structure in the table above , It mainly configures the interface of the router IP Address .
Router>enable Router#configure terminal #---- stay Router1 On the operation ------------------------- Router1(config)# interface Serial0/0/0 Router1(config-if)# ip address 192.168.10.1 255.255.255.0 Router1(config-if)# no shutdown #---- stay Router2 On the operation ------------------------- Router2(config)# interface Serial0/0/0 Router2(config-if)# ip address 192.168.10.2 255.255.255.0 Router1(config-if)# no shutdown Router2(config)# interface Serial0/0/1 Router2(config-if)# ip address 192.168.20.1 255.255.255.0 Router1(config-if)# no shutdown #---- stay Router3 On the operation ------------------------- Router3(config)# interface Serial0/0/0 Router3(config-if)# ip address 192.168.20.2 255.255.255.0 Router1(config-if)# no shutdown Router3(config)# interface Serial0/0/1 Router3(config-if)# ip address 192.168.30.1 255.255.255.0 Router1(config-if)# no shutdown #---- stay Router4 On the operation ------------------------- Router4(config)#interface Serial0/0/0 Router4(config-if)#ip address 192.168.30.2 255.255.255.0 Router1(config-if)# no shutdown
Configure and enable RIP route : Enable and configure on each router RIP Dynamic routing .
Router>enable Router#configure terminal #---- stay Router1 Enable on RIP Route protocols and configure ------------------- Router1(config)# router rip // Enable RIP route Router1(config-router)# version 2 // Specify the use of RIP Version is RIPv2 Router1(config-router)# network 192.168.10.0 // Declaration and Router1 Directly connected network number Router1(config-router)# exit #---- stay Router2 Enable on RIP Route protocols and configure ------------------- Router2(config)# router rip Router2(config-router)# version 2 Router2(config-router)# network 192.168.10.0 // Declaration and Router2 Directly connected network number Router2(config-router)# network 192.168.20.0 // Declaration and Router3 Directly connected network number Router2(config-router)# exit #---- stay Router3 Enable on RIP Route protocols and configure ------------------- Router3(config)# router rip Router3(config-router)# version 2 Router3(config-router)# network 192.168.20.0 // Declaration and Router3 Directly connected network number Router3(config-router)# network 192.168.30.0 // Declaration and Router4 Directly connected network number Router3(config-router)# exit #---- stay Router4 Enable on RIP Route protocols and configure ------------------- Router4(config)# router rip Router4(config-router)# version 2 Router4(config-router)# network 192.168.30.0 // Declaration and Router4 Directly connected network number Router4(config-router)# exit
Check configuration information : When the configuration is complete , stay Router1 On the implementation show ip route Command view RIP Configuration result , as follows .
Router1#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.10.0/24 is directly connected, Serial0/0/0
R 192.168.20.0/24 [120/1] via 192.168.10.2, 00:00:01, Serial0/0/0 // R Indicates that the current is RIP route
R 192.168.30.0/24 [120/2] via 192.168.10.2, 00:00:01, Serial0/0/0 // The routing entry is RIP Automatically generated Test connectivity : At this point we are Router1 Routers Ping Router Router4 It's communicable , The configuration is successful .
Router1#ping 192.168.30.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.30.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 3/15/27 ms
OSPF Dynamic routing
In the above configuration test, we use RIP The protocol completes the data communication between routers , however RIP At most, the protocol only supports 15 Routing nodes , Although these nodes are sufficient in small and medium-sized networks , But in some large enterprises, more hops are often required , It is because of this demand that we OSPF The agreement was born .
OSPF( Open shortest paths take precedence ), This protocol is a protocol specification based on link state , Therefore, it can also be called link state protocol , and RIP The agreement is the same ,OSPF The protocol also uses hops to measure the path cost , But with the RIP The difference is ,OSPF The protocol is not limited by the number of physical hops , The path cost is related to the link cost in the network .
OSPF The protocol adopted FPS Algorithm to calculate the number of shortest paths ,SPF The algorithm takes each route as the root (ROOT), To calculate the distance between its packets reaching each target router , Each router is based on a unified database LSDB Calculate the way out from the topology of the domain , The structure is much like a tree , So it is called the shortest path tree .
OSPF The advantages of the agreement
- OSPF Adopted SPF Algorithm , Thus, the router loop can be avoided .
- OSPF Although the protocol also uses hops as the unit of measurement , But it is not limited by the number of physical hops .
- When the network link state changes ,OSPF Can quickly capture and apply , Fast convergence , The routing information flow is small .
- OSPF The routing protocol supports the routing authentication system , You can also define different authentication methods , Improved network security .
- OSPF The protocol provides better load balancing , Its data update is more intelligent , Accordingly, the bandwidth of network traffic is reduced .
In the configuration OSPF There is a small knowledge point to be added before routing , In the configuration test below, you will see, for example 0.0.0.255 Such a network number , This network number is called a wildcard mask , Generally, the wildcard mask can be used by ,255.255.255.255( Broadcast address ) Subtract the current 255.255.255.0( Subnet mask ), To obtain a , The wildcard mask of the small experiment here is 0.0.0.255 area 0.
Next, let's get down to business , We still use RIP Routing topology and IP The address configuration is the same , But here, when configuring dynamic routing , We use OSPF The way to configure , The process is as follows :
Configure router : First, configure various parameters of the router according to the structure in the table above .
Router>enable Router#configure terminal #---- stay Router1 On the operation ------------------------- Router1(config)# interface Serial0/0/0 Router1(config-if)# ip address 192.168.10.1 255.255.255.0 Router1(config-if)# no shutdown #---- stay Router2 On the operation ------------------------- Router2(config)# interface Serial0/0/0 Router2(config-if)# ip address 192.168.10.2 255.255.255.0 Router1(config-if)# no shutdown Router2(config)# interface Serial0/0/1 Router2(config-if)# ip address 192.168.20.1 255.255.255.0 Router1(config-if)# no shutdown #---- stay Router3 On the operation ------------------------- Router3(config)# interface Serial0/0/0 Router3(config-if)# ip address 192.168.20.2 255.255.255.0 Router1(config-if)# no shutdown Router3(config)# interface Serial0/0/1 Router3(config-if)# ip address 192.168.30.1 255.255.255.0 Router1(config-if)# no shutdown #---- stay Router4 On the operation ------------------------- Router4(config)# interface Serial0/0/0 Router4(config-if)# ip address 192.168.30.2 255.255.255.0 Router1(config-if)# no shutdown
Configure and enable OSPF route : Enable and configure on each router OSPF Dynamic routing .
Router>enable Router#configure terminal #---- stay Router1 Enable on OSPF Route protocols and configure ------------------- Router1(config)# router ospf 1 // Enable OSPF route , And set the process number to 1 Router1(config-router)# router-id 1.1.1.1 // by Router1 To configure RID Number Router1(config-router)# network 192.168.10.0 0.0.0.255 area 0 // Configure routing records Router1(config-router)# exit #---- stay Router2 Enable on OSPF Route protocols and configure ------------------- Router2(config)# router ospf 1 // Enable OSPF route , And set the process number to 1 Router2(config-router)# router-id 2.2.2.2 // by Router2 To configure RID Number Router2(config-router)# network 192.168.10.0 0.0.0.255 area 0 // Configure routing records Router2(config-router)# network 192.168.20.0 0.0.0.255 area 0 Router2(config-router)# exit #---- stay Router3 Enable on OSPF Route protocols and configure ------------------- Router3(config)# router ospf 1 // Enable OSPF route , And set the process number to 1 Router3(config-router)# router-id 3.3.3.3 // by Router3 To configure RID Number Router3(config-router)# network 192.168.20.0 0.0.0.255 area 0 Router3(config-router)# network 192.168.30.0 0.0.0.255 area 0 Router3(config-router)# exit #---- stay Router4 Enable on OSPF Route protocols and configure ------------------- Router3(config)# router ospf 1 // Enable OSPF route , And set the process number to 1 Router3(config-router)# router-id 4.4.4.4 // by Router4 To configure RID Number Router3(config-router)# network 192.168.30.0 0.0.0.255 area 0 Router3(config-router)# exit
Check configuration information : When the configuration is complete , stay Router1 On the implementation show ip route Command view OSPF Configuration result , as follows .
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.10.0/24 is directly connected, Serial0/0/0 // C Indicates that it is the default route of the machine
O 192.168.20.0/24 [110/128] via 192.168.10.2, 00:02:25, Serial0/0/0 // O Indicates that the current is OSPF route
O 192.168.30.0/24 [110/192] via 192.168.10.2, 00:01:55, Serial0/0/0 // The routing entry is OSPF Automatically generated Test connectivity : At this point we are Router1 Routers Ping Router Router4 It's communicable , The configuration is successful .
Router1#ping 192.168.30.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 192.168.30.2, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 3/15/27 ms
actual combat : To configure RIP Business environment
Next , We use layer-3 switches with routers , To realize a case of cross network segment communication , The configuration process is , First, configure the three-layer switch and divide it VLAN The level of , Next, configure Router0 There is no need to configure VLAN, The reason is that the layer-3 switch is connected with Router0 share VLAN, Finally, configure the Internet port Router1 Router , The topological structure is shown in the figure below :
Configure layer 3 switching : First, configure the layer 3 switch , establish 3 individual VLAN, And divided into three VLAN Virtual LAN .
Switch> enable Switch# configure terminal #---- Configure layer 3 switching VLAN10 And put the port fa0/1 Add to VLAN------------------- Switch(config)# vlan 10 // establish VLAN10 Switch(config-vlan)# interface fa0/1 // take Fa1 Two ports are added to VLAN10 Switch(config-if-range)# switchport mode access Switch(config-if-range)# switchport access vlan 10 // Add the port to VLAN10 Switch(config-if-range)# no shutdown // Enable port Switch(config-if-range)# exit #---- Configure layer 3 switching VLAN20 And put the port fa0/2 Add to VLAN------------------- Switch(config)# vlan 20 Switch(config-vlan)# interface fa0/2 Switch(config-if-range)# switchport mode access Switch(config-if-range)# switchport access vlan 20 Switch(config-if-range)# no shutdown Switch(config-if-range)# exit #---- Configure layer 3 switching VLAN30 And put the port fa0/3 Add to VLAN------------------- Switch(config)# vlan 30 Switch(config-vlan)# interface fa0/3 Switch(config-if)# switchport mode access Switch(config-if)# switchport access vlan 30 Switch(config-if)# no shutdown Switch(config-if)# exit
Configure layer 3 switching IP Address : Give the three assigned above VLAN A virtual LAN IP Address , Just specify the gateway addresses here .
Switch> enable Switch# configure terminal #---- For layer 3 exchange VLAN10 Add gateway to the host in ------------------- Switch(config)# interface vlan 10 // choice vlan10 Interface Switch(config-if)# ip address 192.168.1.1 255.255.255.0 // Configure the gateway address Switch(config-if)# no shutdown // Open port Switch(config-if)# exit #---- For layer 3 exchange VLAN20 Add gateway to the host in ------------------- Switch(config)# interface vlan 20 // choice vlan20 Interface Switch(config-if)# ip address 192.168.2.1 255.255.255.0 // Configure the gateway address Switch(config-if)# no shutdown // Open port Switch(config-if)# exit #---- For layer 3 exchange VLAN30 Add gateway to the host in ------------------- Switch(config)# interface vlan 30 // choice vlan30 Interface Switch(config-if)# ip address 192.168.3.1 255.255.255.0 // Configure the gateway address Switch(config-if)# no shutdown // Open port Switch(config-if)# exit
Configure router Router0: After configuring the gateway , Then configure the router Router0, Configure interface IP Address , Pay attention to DCE The interface needs to be configured with a clock .
Router> enable Router# configure terminal #---- Configure the routing fa0/0 Port of IP Address ------------------- Router0(config)# interface fa0/0 Router0(config-if)# ip address 192.168.3.2 255.255.255.0 Router0(config-if)# no shutdown Router0(config-if)# exit #---- Configure the routing fa0/1 Port of IP Address ------------------- Router0(config)# interface fa0/1 Router0(config-if)# ip address 192.168.4.1 255.255.255.0 Router0(config-if)# no shutdown Router0(config-if)# exit #---- Configure the routing se0/0/0 Connect the Internet port IP---------------- Router0(config)# interface se0/0/0 Router0(config-if)# ip address 1.1.1.1 255.0.0.0 Router0(config-if)# no shutdown Router0(config-if)# exit
Configure router Router1: Finally, configure the connecting router between the external network and the internal network Router1, Configure the external network interface IP Address and Intranet port address .
Router> enable Router# configure terminal #---- Configure router 1 The address of the intranet port ------------------- Router1(config)# interface se0/0/0 Router1(config-if)# ip address 1.1.1.2 255.0.0.0 Router1(config-if)# no shutdown Router1(config-if)# exit #---- Configure router 1 The Internet port address of ------------------- Router1(config)# interface fa0/0 Router1(config-if)# ip address 10.10.10.10 255.0.0.0 Router1(config-if)# no shutdown
Enable layer 3 switch routing : Enable the layer 3 switch routing function , And configuration RIP Dynamic routing , Indicate the network segment address of each router .
Switch(config)# ip routing Switch(config)# router rip Switch(config-router)# network 192.168.1.0 Switch(config-router)# network 192.168.2.0 Switch(config-router)# network 192.168.3.0 Switch(config-router)# network 192.168.4.0
Configure the layer-2 router RIP: Finally, you need to configure two routers and turn on their routing functions .
#---- Configure router Router0------------------- Router0(config)# router rip Router0(config-router)# network 192.168.3.0 Router0(config-router)# network 192.168.4.0 #---- Configure router Router1------------------- Router1(config)# route rip Router1(config-router)# network 192.168.3.0 Router1(config-router)# network 192.168.4.0 Router1(config-router)# network 192.168.4.0 Router1(config-router)# network 1.1.1.1
The above configuration process is all the experimental configuration process , After configuring the function , We first use ping Command to test whether the internal host can Ping through , The final result of the experiment is , All intranet hosts can realize communication , The external network host cannot communicate with the internal network host .
边栏推荐
- 【均衡器】LS均衡器,DEF均衡器以及LMMSE均衡器的误码率性能对比仿真
- 关于取模数据序号定位的说明 区码定位是指GBK编码
- Spark累加器和廣播變量
- 【Cnpm】使用教程
- [problem solving] virtual machine configuration static IP
- 两个链表的第一个公共节点_链表中环的入口(剑指offer)
- 0 foundation a literature club low code development member management applet (5)
- Coding helps promote the internationalization of Tencent games
- Mysql---三张表(student,课程,分数) 查询课程为数学的学生姓名,编号,成绩
- Mysql开启BINLOG
猜你喜欢

Arduino raised $32million to enter the enterprise market

【WordPress建站】5. 设置代码高亮

Huawei cloud database advanced learning

MAUI使用Masa blazor组件库

.NET7之MiniAPI(特别篇) :Preview5优化了JWT验证(上)

Big factories are not the only way to measure ability. The three years' experience of Shangcai's graduation

In JS, the regular expression verifies the hour and minute, and converts the input string to the corresponding hour and minute

JVM调试工具-jmap

JVM調試工具-Arthas

JVM debugging tool -arthas
随机推荐
[security] how to [host security - hybrid cloud version] support secure access to non Tencent virtual machines
两个链表的第一个公共节点_链表中环的入口(剑指offer)
智能视觉组A4纸识别样例
Leetcode概率题面试突击系列11~15
【问题解决】虚拟机配置静态ip
JVM debugging tool -jmap
Why use lock [readonly] object? Why not lock (this)?
【WordPress建站】5. 设置代码高亮
Huawei Cloud Database Advanced Learning
雲監控系統 HertzBeat v1.1.0 發布,一條命令開啟監控之旅!
【WordPress建站】6. 文章内容防复制
【Proteus】Arduino UNO + DS1307+LCD1602时间显示
OMX initialization process
基因检测,如何帮助患者对抗疾病?
Intranet learning notes (4)
Unexpected token u in JSON at position 0
LuChen technology was invited to join NVIDIA startup acceleration program
What is JSP technology? Advantages of JSP technology
Coding helps promote the internationalization of Tencent games
蓝牙耳机怎么连接电脑使用,win10电脑如何连接蓝牙耳机