- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
01-Downlink Layer 2 Switch Configuration Examples | 168.73 KB |
Contents
Introduction
The following information provides an example of connecting the router to Layer 2 switches.
Prerequisites
This document is not restricted to specific software or hardware versions. Procedures and information in the examples might be slightly different depending on the software or hardware version of the device.
The configuration examples were created and verified in a lab environment, and all the devices were started with the factory default configuration. When you are working on a live network, make sure you understand the potential impact of every command on your network.
This document assumes that you have basic knowledge of VLAN.
Software version used
This configuration example was created and verified on MSR830-10HI Release 6749P21.
Configuration example
Network configuration
As shown in Figure 1, connect the router to switch 1 and switch 2. Connect host A and host B to switch 1 and switch 2, respectively. Configure the network to meet the following requirements:
· Host A obtains an IP address from VLAN 10, and host B obtains an IP address from VLAN 20.
· Gateways for VLAN 10 and VLAN 20 are located on the router, which also acts as the DHCP server to allocate IP addresses to hosts.
Data plan
Table 1 Network planning
Network |
Configuration |
VLAN 10 |
· Network: 192.168.10.0/24 · Gateway location: Router · Gateway interface IP address: 192.168.10.1/24 |
VLAN 20 |
· Network: 192.168.20.0/24 · Gateway location: Router · Gateway interface IP address: 192.168.20.1/24 |
VLAN 1 (interconnect VLAN for the router and switches) |
· Network: 192.168.1.0/0 · Interconnect interface IP address on the router: 192.168.1.1/24. · Interconnect interface IP address on switch 1: 192.168.1.2/24 · Interconnect interface IP address on switch 2: 192.168.1.3/24 |
Table 2 VLAN planning for interfaces
Device |
VLAN planning for interfaces |
Router |
· Connect GE4 to switch 1, configure it as a trunk port, set the PVID to 1, and assign it to VLAN1 and VLAN 10. · Connect GE5 to switch 2, configure it as a trunk port, set the PVID to 1, and assign it to VLAN1 and VLAN 20. |
Switch 1 |
· Connect GE1/0/1 to the router, configure it as a trunk port, set the PVID to 1, and assign it to VLAN1 and VLAN 10. · Connect GE1/0/2 to host A, configure it as an access port, and assign it to VLAN 10. |
Switch 2 |
· Connect GE1/0/1 to the router, configure it as a trunk port, set the PVID to 1, and assign it to VLAN1 and VLAN 20. · Connect GE1/0/2 to host B, configure it as an access port, and assign it to VLAN 20. |
Analysis
· Configure VLANs on the router and switches, and configure a DHCP server on the router to automatically allocate IP addresses to hosts.
Restrictions and guidelines
· In this example, the default IP address for VLAN 1 on the router is 192.168.0.1/23. You must change the default IP address for VLAN 1 on the router and switches as planned.
· After changing the default IP address of VLAN 1 on the router, use the new IP address to log in to the router management Web page.
Prerequisites
· Connect the PC to the router's LAN port with cables and configure a static IP address 192.168.0.X/23 on the PC. Then, open a browser and enter the router's management IP address https://192.168.0.1 to access the Web page.
· Ensure that serial port terminal software is installed on the PC, and connect the PC to the console ports of the switches with serial console cables. Launch the terminal software and configure the parameters to access the backend interfaces of switches.
Procedures
Configuring the router
1. Change the default IP address of VLAN 1:
# Change the default IP address of VLAN 1 to 192.168.1.1/24 as planned. Perform the following tasks:
a. From the navigation pane, select Network > LAN Settings.
b. Click the Edit icon in the Actions column for VLAN-interface1.
c. In the Interface IP address field, enter 192.168.1.1.
d. In the Subnet mask field, enter 255.255.255.0.
e. Unselect the Enable DHCP option to disable DHCP.
f. Use the default settings for the other parameters, and click Apply.
Figure 2 Editing LAN settings
2. Add VLAN 10:
# Add VLAN 10, configure the interface IP address, and enable DHCP on the interface.
a. From the navigation pane, select Network > LAN Settings.
b. Click Add.
c. In the LAN interface type field, select VLAN interface.
d. In the VLAN ID field, enter 10.
e. In the Interface IP address field, enter 192.168.10.1.
f. In the Subnet mask field, enter 255.255.255.0.
g. Enable DHCP.
h. Use the default settings for the other parameters, and click Apply.
Figure 3 Adding VLAN 10
3. Create VLAN 20.
# Add VLAN 20, configure the interface IP address, and enable DHCP on the interface.
a. From the navigation pane, select Network > LAN Settings.
b. Click Add.
c. In the LAN interface type field, select VLAN interface.
d. In the "VLAN ID" configuration item, enter 20.
e. In the Interface IP address field, enter 192.168.20.1.
f. In the Subnet mask field, enter 255.255.255.0.
g. Enable DHCP.
h. Use the default settings for the other parameters, and click Apply.
Figure 4 Adding VLAN 20
4. Configure GE4:
# Assign GE4 to both VLAN 1 and VLAN 10.
a. From the navigation pane, select Network > LAN Settings.
b. Click the VLAN Division tab.
c. Click the Edit icon in the Actions column for GE4.
d. Select VLAN 10.
e. Use the default settings for the other parameters, and click Apply.
5. Configure the GE5 interface.
# Assign GE4 to both VLAN 1 and VLAN 20.
a. From the navigation pane, select Network > LAN Settings.
b. Click the VLAN Division tab.
c. Click the Edit icon in the Actions column for GE5.
d. Select VLAN 20.
e. Use the default settings for the other parameters, and click Apply.
Configuring switch 1
1. Configure VLAN:
Configure the IP address for VLAN 1 and create VLAN 10.
<L2 switch 1> system-view
[L2 switch 1] interface vlan 1
[L2 switch 1-interface1] ip address 192.168.1.2 24
[L2 switch 1-interface1] quit
[L2 switch 1] VLAN 10
[L2 switch 1-VLAN10] quit
2. Configure GE1/0/1:
# Configure GE1/0/1 as a trunk port and assign it to VLAN 1 and VLAN 10.
[L2 switch 1] interface gigabitethernet 1/0/1
[L2 switch 1-GigabitEthernet1/0/1] port link-type trunk
[L2 switch 1-GigabitEthernet1/0/1] port trunk permit VLAN 1 10
[L2 switch 1-GigabitEthernet1/0/1] quit
3. Configure GE1/0/2:
# Configure GE1/0/2 as an access port and assign it to VLAN 10.
[L2 switch 1] interface gigabitethernet 1/0/2
[L2 switch 1-GigabitEthernet1/0/2] port link-type access
[L2 switch 1-GigabitEthernet1/0/2] port access vlan 10
[L2 switch 1-GigabitEthernet1/0/2] quit
[L2 switch 1]
Configuring Switch 2
1. Configure VLAN:
Configure the IP address for VLAN 1 and create VLAN 20.
<L2 switch 2> system-view
[L2 switch 2] interface vlan 1
[L2 switch 2-interface1] ip address 192.168.1.3 24
[L2 switch 2-interface1] quit
[L2 switch 2] VLAN 20
[L2 switch 2-VLAN20] quit
2. Configure GE1/0/1:
# Configure GE1/0/1 as a trunk port and assign it to VLAN 1 and VLAN 20.
[L2 switch 2] interface gigabitethernet 1/0/1
[L2 switch 2-GigabitEthernet1/0/1] port link-type trunk
[L2 switch 2-GigabitEthernet1/0/1] port trunk permit VLAN 1 20
[L2 switch 2-GigabitEthernet1/0/1] quit
3. Configure GE1/0/2:
# Configure GE1/0/2 as an access port and assign it to VLAN 20.
[L2 switch 2] interface gigabitethernet 1/0/2
[L2 switch 2-GigabitEthernet1/0/2] port link-type access
[L2 switch 2-GigabitEthernet1/0/2] port access vlan 20
[L2 switch 2-GigabitEthernet1/0/2] quit
Verifying the configuration
Verify that host A can obtain an IP address from VLAN 10 and host B can obtain an IP address from VLAN 20.