laitimes

Understand the switch configuration in one article, this example is very classic

author:Network Engineer - Director Guo

1. Switch VLAN configuration examples

Regarding the basic commands of Ruijie switch configuration, we have summarized it before, and here we will look at the configuration of Ruijie switch VLAN in the form of examples.

Example: As shown below

Understand the switch configuration in one article, this example is very classic

The corresponding IP subnets of the 3 VLANs are 192.168.10.0/24, 192.168.20.0/24, and 192.168.30.0/24 respectively.

# Core Switch Configuration:

Ruijie>enable 
Ruijie#configure terminal
Ruijie(config)#vlan 10             //创建VLAN 10
Ruijie(config-vlan)#vlan 20         //创建VLAN 20
Ruijie(config-vlan)#vlan 30        //创建VLAN 30
Ruijie(config-vlan)#exit
Ruijie(config)#interface range GigabitEthernet 0/2-4       //配置该端口Gi 0/2-4 都为trunk 口
Ruijie(config-if-range)#switchport mode trunk
Ruijie(config-if-range)#exit
Ruijie(config)#interface vlan 10      //进入vlan10
Ruijie(config-if)#ip address 192.168.10.1 255.255.255.0    //配置vlan 10的网关地址
Ruijie(config-if)#interface vlan 20      //进入vlan20
Ruijie(config-if)#ip address 192.168.20.1 255.255.255.0       // 配置vlan 20的网关地址
Ruijie(config-if)#interface vlan 30        //进入vlan 30
Ruijie(config-if)#ip address 192.168.30.1 255.255.255.0     // 配置vlan 20的网关地址
Ruijie(config-if)#end      //退出到特权模式
Ruijie#write             //确认配置正确,保存配置
           

Create three VLANs on the core switch, configure gateway interfaces for each VLAN, and configure corresponding IP addresses to facilitate communication between VLANs.

# Configuration on Access Switch A:

Ruijie>enable 
Ruijie#configure terminal
Ruijie(config)#vlan 10
Ruijie(config-vlan)#vlan 20
Ruijie(config-vlan)#exit
Ruijie(config)#interface range GigabitEthernet 0/2-12   
Ruijie(config-if)#switchport access vlan 10         //将端口Gi0/2-12 分配给VLAN 10
Ruijie(config-if)#interface range GigabitEthernet 0/13-24
Ruijie(config-if)#switchport access vlan 20         // 将端口Gi0/13-24 分配给VLAN 20
Ruijie(config-if)#exit
Ruijie(config)#interface GigabitEthernet 0/1
Ruijie(config-if)#switchport mode trunk           //指定上连核心交换机的trunk 口
Ruijie(config-if)#end                  //退出到特权模式
Ruijie#write           //确认配置正确,保存配置           

This section divides the VLAN of Switch A and each port, sets port 0/1 to trunk mode, and uses trunk to configure the interface between switches to allow multiple VLANs to pass through. The same is true for the Switch B and Switch C in the back.

Common single VLAN interfaces use access, which belongs to the communication between only one VLAN.

# Configuration on Access Switch B:

Ruijie>enable 
Ruijie#configure terminal
Ruijie(config)#vlan 10
Ruijie(config-vlan)#vlan 20
Ruijie(config-vlan)#vlan 30
Ruijie(config-vlan)#exit
Ruijie(config)#interface range GigabitEthernet 0/2-8   
Ruijie(config-if)#switchport access vlan 10         //将端口Gi0/2-8 分配给VLAN 10
Ruijie(config-if)#interface range GigabitEthernet 0/9-16
Ruijie(config-if)#switchport access vlan 20         // 将端口Gi0/9-16 分配给VLAN 20
Ruijie(config-if)#interface range GigabitEthernet 0/17-24
Ruijie(config-if)#switchport access vlan 30         // 将端口Gi0/17-24 分配给VLAN 30
Ruijie(config-if)#exit
Ruijie(config)#interface GigabitEthernet 0/1
Ruijie(config-if)#switchport mode trunk           //指定上连核心交换机的trunk 口
Ruijie(config-if)#end                  //退出到特权模式
Ruijie#write           //确认配置正确,保存配置           

# Configuration on Access Switch C:

Ruijie>enable 
Ruijie#configure terminal
Ruijie(config)#vlan 20
Ruijie(config-vlan)#vlan 30
Ruijie(config-vlan)#exit
Ruijie(config)#interface range GigabitEthernet 0/2-12   
Ruijie(config-if)#switchport access vlan 20         //将端口Gi0/2-12 分配给VLAN 10
Ruijie(config-if)#interface range GigabitEthernet 0/13-24
Ruijie(config-if)#switchport access vlan 30         // 将端口Gi0/13-24 分配给VLAN 30
Ruijie(config-if)#exit
Ruijie(config)#interface GigabitEthernet 0/1
Ruijie(config-if)#switchport mode trunk           //指定上连核心交换机的trunk 口
Ruijie(config-if)#end                  //退出到特权模式
Ruijie#write           //确认配置正确,保存配置           

It can be found that the configurations of SwitchA, SwitchB, and SwitchC are almost the same, but the port assignment of the vlan is different, and the rest are basically repeated commands.

In this way, the communication between the three VLANs is realized, and each switch creates each VLAN, and the key is to configure the core switch, and configure the gateway IP address between each VLAN on the core switch to facilitate communication between them.

Pay attention to the good of the industry: IT operation and maintenance base camp, and get the 60 G "Network Engineering System Gift Package"

Read on