07-VLAN Configuration

HomeSupportConfigure & DeployConfiguration ExamplesH3C Routers Easy and Effortless Routing Feature Configuration Examples-6W10007-VLAN Configuration
01-Enable Multiple Networks on a Switch to Access the Public Network Through the Router (Web)

Enable Multiple Networks on a Switch to Access the Public Network Through the Router (Web)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Copyright © 2024 New H3C Technologies Co., Ltd. All rights reserved

No part of this manual may be reproduced or transmitted in any form or by any means without prior written consent of New H3C Technologies Co., Ltd.

Except for the trademarks of New H3C Technologies Co., Ltd., any trademarks that may be mentioned in this document are the property of their respective owners.

The information in this document is subject to change without notice.



Introduction

The following information describes how to enable multiple networks on a switch to access the public network through the router.

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.

The following information is provided based on the assumption that you have basic knowledge of VLAN and static routing.

Example: Configuring multiple networks on a switch to access the public network through the router

Network configuration

As shown in Figure 1, Host A and Host B are connected to the switch. Host A belongs to VLAN 2, and Host B belongs to VLAN 3. The IP addresses for interfaces VLAN-interface 1, VLAN-interface 2, and VLAN-interface 3 on the switch are 192.168.1.254/24, 192.168.2.1/24, and 192.168.3.1/24, respectively. The IP address for interface VLAN-interface 1 on the device is 192.168.1.1/24. Configure network settings for Host A and Host B to access the Internet.

Figure 1 Network diagram

 

Software version used

This document applies to Comware 7-based MER router series. This configuration example was created and verified on R6749P14 of the MER8300 router.

Procedures

1.     Configuring Host A and Host B

Set the IP address of the Host A to 192.168.2.2/24, and set its gateway address to 192.168.2.1/24. Set the IP address of the Host B to 192.168.3.2/24, and set its gateway address to 192.168.3.1/24.

2.     Configuring the switch

# Create VLAN 2 and VLAN 3.

<Switch> system-view

[Switch] vlan 2 to 3

# Assign interface GigabitEthernet 1/0/2 to VLAN 2.

[Switch] interface gigabitethernet 1/0/2

[Switch-GigabitEthernet1/0/2] port access vlan 2

[Switch-GigabitEthernet1/0/2] quit

# Assign interface GigabitEthernet 1/0/3 to VLAN 3.

[Switch] interface gigabitethernet 1/0/3

[Switch-GigabitEthernet1/0/3] port access vlan 3

[Switch-GigabitEthernet1/0/3] quit

# Set the IP address of VLAN-interface 1 to 192.168.1.254/24.

[Switch] interface vlan-interface 1

[Switch-Vlan-interface1] ip address 192.168.1.254 255.255.255.0

[Switch-Vlan-interface1] quit

# Set the IP address of VLAN-interface 2 to 192.168.2.1/24.

[Switch] interface vlan-interface 2

[Switch-Vlan-interface2] ip address 192.168.2.1 255.255.255.0

[Switch-Vlan-interface2] quit

# Set the IP address of VLAN-interface 3 to 192.168.3.1/24.

[Switch] interface vlan-interface 3

[Switch-Vlan-interface3] ip address 192.168.3.1 255.255.255.0

[Switch-Vlan-interface3] quit

# Configure a default route.

<Switch> system-view

[Switch] ip route-static 0.0.0.0 0.0.0.0 192.168.1.1

3.     Configuring the device

# Log in to the web management interface of the router. From the left navigation pane, select Network > LAN Settings. Edit interface VLAN-interface 1.

 

# Set the IP address of VLAN-interface 1 to 192.168.1.1, set its subnet mask to 255.255.255.0, and then click Apply.

 

# The system displays a prompt message after the configuration is completed.

 

# From the left navigation pane, select Advanced Settings > Static Routing. Click Add.

 

# Set the destination IP address to 192.168.2.0, set the mask length to 24, and then click Apply.

 

# Set the destination IP address to 192.168.3.0, set the mask length to 24, and then click Apply.

 

# The system displays a prompt message after the configuration is completed.

 

Verifying the configuration

Verify that both Host A and Host B can access the Internet. (Details not shown.)

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网