Cisco configures one-arm routing between VLANs

Cisco configures one-arm routing between VLANs

Why configure one-arm routing

The number of physical interfaces connected to different VLANs on the router is limited, and the number of ports will be exhausted soon as the number of VLANs increases. However, VLAN relay allows a single router physical interface to connect to the traffic of multiple VLANs, that is, there is a single-arm routing technology.

example topology

In this article, the topology shown in the following figure is taken as an example to configure single-arm routing

Among them, Fa0/2 is under VLAN10, and Fa0/3 is under VLAN20

configuration

switch configuration

Create VLANs

S1(config)#vlan 10
S1(config-vlan)#vlan 20
S1(config-vlan)#exit

Configure Fa0/1 as a trunk port

S1(config)#interface f0/1
S1(config-if)#switchport mode trunk
S1(config-if)#exit

Configure Fa0/2 and Fa0/3 as access mode, and set VLAN

S1(config)#interface f0/2
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 10
S1(config-if)#exit
S1(config)#interface f0/3
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 20
S1(config-if)#exit

router configuration

A physical port of a router receives multiple VLAN traffic by assigning sub-ports.

Enable the physical port (this step is very important, it is best to activate the parent port first and then configure the sub-port to prevent forgetting)

R1(config)#interface g0/0
R1(config-if)#no shutdown
R1(config-if)#exit

Configure sub-port VLAN numbers, encapsulate in 802.1q format, and assign ipv4 addresses.

The naming convention of the subport is 父端口名称.VLAN号, although how to write the VLAN number has no effect on the final effect, but in order to know the corresponding VLAN through the name at a glance during future maintenance, it is strongly recommended to use this format

R1(config)#interface g0/0.10
R1(config-subif)#encapsulation dot1q 10
R1(config-subif)#ip address 172.17.10.1 255.255.255.0
R1(config-subif)#exit
R1(config)#interface g0/0.20
R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#ip address 172.17.20.1 255.255.255.0
R1(config-subif)#exit

PC configuration

For PC configuration, nothing more than setting the IPv4 address, subnet mask and default gateway

The default gateway address is the IPv4 address of the corresponding routing subport in the VLAN.

The configuration of PC0 is shown in the figure below

The IPv4 address of PC1 is 172.17.20.23/24, and the default gateway is 172.17.20.1, and the configuration steps are omitted here

verify

Check VLAN

S1#show vlan

The command output is as follows

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                                Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                                Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                Fa0/24, Gig0/1, Gig0/2
10   VLAN0010                         active    Fa0/2
20   VLAN0020                         active    Fa0/3
1002 fddi-default                     active    
1003 token-ring-default               active    
1004 fddinet-default                  active    
1005 trnet-default                    active    

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0   
1003 tr    101003     1500  -      -      -        -    -        0      0   

Verify Routing Table

R1#show ip route | begin Gateway

Output result:

Gateway of last resort is not set

     172.17.0.0/16 is variably subnetted, 4 subnets, 2 masks
C       172.17.10.0/24 is directly connected, GigabitEthernet0/0.10
L       172.17.10.1/32 is directly connected, GigabitEthernet0/0.10
C       172.17.20.0/24 is directly connected, GigabitEthernet0/0.20
L       172.17.20.1/32 is directly connected, GigabitEthernet0/0.20

Ping test

PC0 terminal pings the default gateway

C:\>ping 172.17.10.1

PC0 terminal pings PC2

C:\>ping 172.17.20.23

If successful, there will be Replay from xxx.xxx.xxx.xxx bytes = xx time<xms TTL=xxxa format of words

Tracert test

Also type the following command in the PC0 terminal

C:\>tracert 172.17.20.23

The result is as follows

Tracing route to 172.17.20.23 over a maximum of 30 hops: 

  1   0 ms      0 ms      0 ms      172.17.10.1
  2   0 ms      0 ms      0 ms      172.17.20.23

Trace complete.

Guess you like

Origin blog.csdn.net/qq_42759112/article/details/128018474