Network (2) VLAN technology and network layer analysis

VLAN technology and applications

1 Broadcast Domain

The broadcast domain refers to the range that receives the same broadcast message. Any device in this range sends a broadcast and all other devices can receive it. By default, all interfaces of the switch belong to the same broadcast domain

2 VLAN Overview

VLAN, Virtual LAN (Virtual LAN)

All interfaces of the switch belong to the same broadcast domain by default. As the number of access devices increases, broadcasts in the network increase, reducing network efficiency. VLANs can be used to divide broadcast domains to avoid this problem.

VLAN splits broadcast domains

Function (advantages) of VLAN:Broadcast control, increased security, improved bandwidth utilization, reduced data transmission delay

VLAN classification based on interface

3 Divide VLAN

Create the following VLAN on the switch, add the port to the specified VLAN according to topology diagram-1 and configure the server IP address to achieve communication with the VLAN host

Create a vlan and add the interface. Since all interfaces are in VLAN1 by default and VLAN1 exists by default, you only need to configure VLAN2 and VLAN3.

<Huawei>system-view
[Huawei]vlan 2 //Create vlan2, if you want to delete it, you can use undo vlan 2
[Huawei]display vlan //View vlan list
[Huawei-vlan2]quit
[Huawei]interface ethernet 0/0/3 //Enter interface 3
[Huawei-Ethernet0/0/3]port link-type access //Set the interface type to access link
[Huawei-Ethernet0/0/3]port default vlan 2 //Add the interface to vlan2
[Huawei-Ethernet0/0/3]quit
[Huawei]interface ethernet 0/0/4 //Enter interface 4
[Huawei-Ethernet0/0/4]port link-type access //Set the interface type to access link
[Huawei-Ethernet0/0/4]port default vlan 2 //Add the interface to vlan2
[Huawei-Ethernet0/0/4]quit
[Huawei]vlan 3 //Create vlan3
[Huawei-vlan3]quit
[Huawei]interface ethernet 0/0/5 //Enter interface 5
[Huawei-Ethernet0/0/5]port link-type access //Set the interface type to access link
[Huawei-Ethernet0/0/5]port default vlan 3 //Add the interface to vlan3
[Huawei-Ethernet0/0/5]quit
[Huawei]interface ethernet 0/0/6 //Enter interface 6
[Huawei-Ethernet0/0/6]port link-type access //Set the interface type to access link
[Huawei-Ethernet0/0/6]port default vlan 3 //Add the interface to vlan3. If you add the wrong vlan, type the correct command again

Multi-switch VLAN division

[Huawei]vlan batch 2 3 //Create vlan in batches. If you want to delete it, you can use undo vlan batch 2 3
[Huawei]port-group 1 //Create (enter) interface group 1
group-member Ethernet 0/0/3 Ethernet 0/0/4 //Add members 3 and 4 to the interface group
port link-type access //Set the interface type to access link
port default vlan 2 //Add all interfaces in the interface group to vlan2
[Huawei-port-group-1]quit
[Huawei]port-group 2 //Create (enter) interface group 2
group-member Ethernet 0/0/5 Ethernet 0/0/6 //Add members 5 and 6 to the interface group
port link-type access
port default vlan 3
[Huawei-port-group-2]undo group-member Ethernet 0/0/7 //If the interface is added incorrectly, for example, port 7 is accidentally added to interface group 2, you can use this command to delete it. Use the undo command, which is equivalent to Cancel

Two Trunk

1 Trunk principle

VLAN communication between switches

Devices in the same VLAN will be connected to different switches

How to achieve the same VLAN communication between switches?

One link per VLAN?

How to achieve the same VLAN communication between switches?

Using only one link, how is data from multiple VLANs identified?

VLAN ID

The switch tags each data frame destined for other switches with a VLAN tag.

2 Configure trunk relay chain

Implement same-VLAN communication across switches through configuration

Note: The following configuration needs to be completed based on case 2

access access link can carry data of 1 vlan

Trunk trunk link can carry data of multiple vlans

1) sw1 configuration

[Huawei]interface ethernet 0/0/7
port link-type trunk //Configure as a trunk link
port trunk allow-pass vlan all //Release all vlan data
2) sw2 configuration

[Huawei]interface ethernet 0/0/7
port link-type trunk //Configure as a trunk link
port trunk allow-pass vlan all //Release all vlan data
display vlan //Query the vlan list, you can see that in any vlan, there is interface No. 7

If the interface configuration is chaotic and needs to be restored:
[Huawei]clear configuration interface Ethernet 0/0/7 //Clear configuration
[Huawei]interface ethernet0/0/7 //Enter the interface
[Huawei-Ethernet0/0/7]undo shutdown //Open the interface

3 Link Aggregation

Eth-trunk

  • Multiple lines are load balanced and bandwidth is increased
  • Fault tolerance, when one line fails, the entire network will not be interrupted.

Link aggregation configuration

Use the previous case to configure link aggregation and bundle multiple links (network cards) together to achieve the purpose of increasing reliability and link bandwidth.

Create a link aggregation interface and bundle the physical interface

1) sw1 configuration

[Huawei]interface eth-trunk 1 //Create (enter) link aggregation interface No. 1
trunkport Ethernet 0/0/7 0/0/8 //Bundle interfaces 7 and 8
port link-type trunk //Configure as a trunk link
port trunk allow-pass vlan all //Release all vlan data
2) sw2 configuration

[Huawei]interface eth-trunk 1 //Create (enter) link aggregation interface No. 1
trunkport Ethernet 0/0/7 0/0/8 //Bundle interfaces 7 and 8
port link-type trunk //Configure as a trunk link
port trunk allow-pass vlan all //Release all vlan data

Use display vlan to see that ports 7 and 8 in the list have disappeared and been replaced by Eth-Trunk1

Three Network Layer Analysis

1 Functions of the network layer

IP address defined

Connect different media types (different ranges of networks, different hardware, different systems)

Selecting the path for data to pass through the network (routing)

2 Network layer protocol

(1)ICMP (Internet Control Message Protocol) Internet Control Message Protocol

Transported via IP datagrams, used to send error and control information

Common ping feedback results

  • The connection is established successfully, Reply from target address
  • Destination host unreachable, Destination host unreachable
  • Request timed out, Request timed out

(2)ARP (Address Resolution Protocol) Address Resolution Protocol

When sending data on the network, the target IP and target mac address are required. However, since only the target IP address is known when sending, and its mac address is not known, ARP can be used to parse the target mac address based on the IP address information to ensure smooth communication. conduct

Four Routing Principles and Configuration

1 Routing Overview

Send packets from one network to another

Routers can choose paths based on routing tables

  • Each router maintains a routing table, which is the key for the router to forward data packets.
  • Each routing table record indicates: which interface should be used to reach a certain network segment.

2 Routing table

Direct connection routing, configure the IP address of the interface and automatically generate it after turning it on.

Static, default route

  • Manually specified by the administrator on the router

Dynamic Routing

  • Automatically set by the router through routing protocols based on changes in network topology or traffic
  • Suitable for ISP service providers, WAN, and other large networks

3 Static routing

Use the ip route-static command

Specify the destination IP network

Basic format: [Huawei] ip route-static target network ID subnet mask next hop

4 Connect to the Internet using a router

VLAN, Trunk, etc. can be configured on the switch to meet the basic requirements for building a network, but data cannot be transmitted further. For example, different VLANs cannot communicate with each other, so the network layer and related equipment are required.

[Huawei]interface GigabitEthernet 0/0/0 //Enter interface 0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.1.254 24 //Configure ip
[Huawei-GigabitEthernet0/0/0]quit
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24
<Huawei>display ip interface brief //View all IP configurations of the device
[Huawei-GigabitEthernet0/0/1]undo ip address //If the ip configuration is wrong, use this command to delete it

After that, configure the IP and gateway of the two PCs to communicate with each other.

The IP of pc1 is 192.168.1.1 and the gateway is 192.168.1.254

The IP of pc2 is 192.168.2.2 and the gateway is 192.168.2.1

A gateway is a way for a device to connect to another network, allowing a router (a device with routing functions) to

display ip routing-table | include /24 //View routing table

5 Configure static routing

Add routers and PCs to transform the previous topology into the following state. The ultimate goal is to interconnect the entire network.

First configure all IP addresses of the device as before

second router
[Huawei]interface GigabitEthernet 0/0/0 //Enter interface 0
[Huawei-GigabitEthernet0/0/0]ip address 192.168.2.2 24 //Configure ip
[Huawei-GigabitEthernet0/0/0]quit
[Huawei]interface GigabitEthernet 0/0/1 //Enter interface 0
[Huawei-GigabitEthernet0/0/1]ip address 192.168.4.254 24 //Configure ip
[Huawei-GigabitEthernet0/0/1]quit
[Huawei]interface GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 192.168.3.254 24
<Huawei>display ip interface brief //View all IP configurations of the device

pc configuration:
The gateway of 192.168.4.1 is 4.254
The gateway of 192.168.3.1 is 3.254
Configure static routing on the first router:
[Huawei]ip route-static 192.168.3.0 24 192.168.2.2 //Add a static route, you can go to network segment 3.0, mask 24, next hop 2.2
[Huawei]undo ip route-static 192.168.3.0 24 192.168.2.2 //If the route configuration is wrong, delete it
[Huawei]ip route-static 192.168.4.0 24 192.168.2.2 //Add a static route, you can go to network segment 4.0, mask 24, next hop 2.2

Configure static routing on the second router:
[Huawei]ip route-static 192.168.1.0 24 192.168.2.1 //To add a static route, you can go to network segment 1.0, mask 24, next hop 2.1
display ip routing-table | include /24 //View routing table