In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
HR-- > route / switch
say
How the switch works:
1. Form the MAC table
2. Find the MAC table
Basic theoretical knowledge must form a fixed answer pattern; in peacetime, with your comrades-in-arms, you should practice more.
Switch
Unable to split broadcast domain
VLAN
The same VLAN can communicate with each other.
Different VLAN cannot communicate with each other.
Member hosts of the same VLAN can be in different physical locations (different switching devices)
Trunk: trunk link / trunk link
Interconnection between switches:
The same link requires multiple VLAN traffic to be carried at the same time.
How to distinguish the traffic of different VLAN-marking
1. ISL:inter-switch link, privately owned by Cisco
ISL head + L2+L3+L4+Data+FCS+ISL tail
2. 802.1q: public protocol
DMAC + SMAC + Tag + Type
4Byte
Where represents the vlan-id
For 12bit
Access: access port
The port / link on the switch used to connect non-"switch" devices
This type of link can only transmit data from one VLAN at a time.
And the data cannot carry a label.
Hybrid: promiscuous port
This type of port exists only on Huawei devices and is the default mode for each port
The port in this mode can simulate the function of both access and trunk links.
When forwarding data frames, the processing of labels in data frames is very flexible.
How the port of the switch handles labels:
1. Incoming data
# if there is no label for the data received, the port's
The VLAN number represented by PVID, tagging the data
Command: display port vlan
# if the data received carries a label, it will be received directly
Do not do any processing to the label, keep the original appearance.
2. Outgoing data
# first of all, determine the port from which the current data frame should go out:
Command: display vlan
% check the VLAN corresponding to the tags carried by the data:
& untagged: if sent on this type of port, the label will be killed.
& tagged: if it is sent on this type of port, it will carry a label.
Core worksheet of the switch:
Display mac-address-table / / displays the MAC address table of the switch
=
GARP: generic attribute Registration Protocol (equivalent to VTP-virtual trunk protocol in Cisco)
-gvrp
GARP vlan registration protocol
-function: between switches, through the trunk link, automatically learn VLAN information to ensure that the VLAN database of each switch in the exchange network is completely synchronized;-configuration: 1, global open 2, open on the trunk link
=
The premise that a route entry is placed in the routing table:
The next hop must be reachable
Floating static route:
-definition
Configure a static route, but the administrative distance is greater than the default AD value.
-effect
In order to back up the link
-configuration
Ip route x.x.x.x y.y.y.y n.n.n.n {ad}
Note-ad should be larger than the default AD (Cisco is 1, Huawei is 60;)
Ip route-static x.x.x.x y.y.y.y n.n.n.n preference {value} Route Type:
Directly connected route
Non-directly connected route
Static state
Dynamic
IGP (Interior Gateway routing Protocol)
DV- distance Vector routing Protocol
RIP
IGRP
EIGRP
LS- link-state routing protocol
ISIS
OSPF
EGP (external Gateway routing Protocol)
BGP
Composition of route entries:
Type prefix / mask attribute next pop-out port
S 192.168.1.0/24 [1/0] 192.168.2.3 gi0/0
When going to the same destination network segment, there may be multiple route entries
The router will select an optimal entry to put in the routing table (RIB/FIB)
1. First compare the AD value. The smaller the better.
2. If the AD is the same, compare Metric. The smaller the better.
3. If both are the same, they will all be put into the routing table to form a load balance.
192.168.1.0/24 [1/0]
192.168.0.0/24 [2/1]
192.168.1.0/25 [1/8]
Note:
When a router receives an IP packet, it chooses the best one in the routing table
To forward entries, the principles used in this case are:
The longest matching principle!
192.168.1.1-> 192.168.3.1
S 192.168.0.0 255.255.255.0 192.168.4.1 2 X
S 0.0.0.0 0.0.0.0 192.168.5.1 Y
S 192.168.3.0 255.255.255.0 192.168.6.1 3 Y
=
The router acts as the gateway to the VLAN:
Multilayer switches act as gateways for VLAN:
# physical interface
& enable the routing function globally
Gateway (config) # ip routing / / enable routing
& set the port to a layer 3 port and configure the gateway IP address
Gateway (config) # interface fas0/24
Gateway (config-if) # no shutdown
Gateway (config-if) # no switchport / / disable layer 2 function and enable layer 3 function
Gateway (config-if) # ip address 192.168.10.254 255.255.255.0
# Virtual Interface (SVI) switch has a virtual port for each VLAN, which can be configured with an IP address, which is called SVI (switch virtual interface). This port represents the gateway of VLAN. VLAN10 VLAN 20 interface vlan 10 / / SVI called VLAN10; no shutdown ip address 192.168.10.254 255.255.255.0 exit / / the IP address of this port is the gateway IP address of all hosts in VLAN10 Interface vlan 20 no shutdown ip address 192.168.20.254 255.255.255.0 exit
Ideas for inter-VLAN routing configuration:
1. Configure terminal equipment
PC-1: 192.168.10.1 255.255.255.0
192.168.10.254
PC-2: 192.168.20.1 255.255.255.0
192.168.20.254
2. Configure network equipment
# configure switching equipment (SW2)
1. Create a VLAN
Vlan 10
Vlan 20
2. Configure port mode
Interface gi0/0/1
Port link-type access
Interface gi0/0/2
Port link-type access
3. Add the port to a specific VLAN
Interface gi0/0/1
Port default vlan 10
Interface gi0/0/2
Port default vlan 20
4. Configure the interconnection link between switches (trunk)
Interface gi0/0/24
Port link-type trunk
Port trunk allow-pass vlan all
# configure routing device (SW1)
1. Configure the interconnection links between switches
Interface gi0/0/24
Port link-type trunk
Port trunk allow-pass vlan all
2. Create a corresponding VLAN
Vlan 10
Vlan 20
3. Configure the SVI interface corresponding to each VLAN (gateway IP address for each VLAN)
Interface vlanif 10
No shutdown
Ip address 192.168.10.254 255.255.255.0
Interface vlanif 20
No shutdown
Ip address 192.168.20.254 255.255.255.0
3. Verify, test, save
SW2: display vlan | display port vlan-> look at trunk
SW1:display port vlan-> look at trunk
Display vlan-> look at the VLAN created on the switch. There must be 10 Universe 20.
Display ip interface brief-> look at the SVI port of each VLAN
Display ip routing-table-> View the routing table
PC-1: ping 192.168.10.254
Ping 192.168.20.254
Ping 192.168.20.1
Save
Case study:
1 case 1: configure default rout
1.1 question
Configure interface IP address and realize network-wide interworking through static route and default route configuration.
1.2 scenario
Use eNSP to build the experimental environment, as shown in figure-1.
1.3 steps
To implement this case, you need to follow these steps.
[R1] ip route-static 0.0.0.0 0.0.0.0 192.168.2.2
[R3] ip route-static 0.0.0.0 0.0.0.0 192.168.3.2
[R2] ip route-static 192.168.1.0 255.255.255.0 192.168.2.1
[R2] ip route-static 192.168.4.0 255.255.255.0 192.168.3.1
3) Test network interworking
2 case 2: configure floating routing
2.1 question
1) configure interface IP address and configure floating route to achieve link redundancy
2) verify the effect of floating routing
2.2 scenario
Use eNSP to build the experimental environment, as shown in figure-2.
2.3 steps
To implement this case, you need to follow these steps.
[R1] ip route-static 192.168.4.0 255.255.255.0 192.168.2.2 preference 80
[R1] ip route-static 192.168.4.0 255.255.255.0 192.168.3.2 preference 90
[R2] ip route-static 192.168.1.0 255.255.255.0 192.168.2.1 preference 80
[R2] ip route-static 192.168.1.0 255.255.255.0 192.168.3.1 preference 90
3) Test
Disconnect the main link and test the connectivity of the network.
3 case 3: communication between layer 3 switching VLAN
3.1 question
Realize the communication between different VLAN.
3.2 scenario
Use eNSP to build the experimental environment, as shown in figure-3.
3.3 steps
To implement this case, you need to follow these steps.
System-view
[Huawei] vlan 2
[Huawei] vlan 3
[Huawei] interface Ethernet0/0/1
[Huawei-Ethernet0/0/1] port link-type access
[Huawei-Ethernet0/0/1] port default vlan 1
[Huawei] interface Ethernet0/0/2
[Huawei-Ethernet0/0/2] port link-type access
[Huawei-Ethernet0/0/2] port default vlan 2
[Huawei] interface Ethernet0/0/3
[Huawei-Ethernet0/0/3] port link-type access
[Huawei-Ethernet0/0/3] port default vlan 3
[Huawei] dis port vlan
Port Link Type PVID Trunk VLAN List
Ethernet0/0/1 access 1-
Ethernet0/0/2 access 2-
Ethernet0/0/3 access 3-
Ethernet0/0/4 hybrid 1-
Ethernet0/0/5 hybrid 1-
Ethernet0/0/6 hybrid 1-
Ethernet0/0/7 hybrid 1-
Ethernet0/0/8 hybrid 1-
Ethernet0/0/9 hybrid 1-
Ethernet0/0/10 hybrid 1-
Ethernet0/0/11 hybrid 1-
Ethernet0/0/12 hybrid 1-
Ethernet0/0/13 hybrid 1-
Ethernet0/0/14 hybrid 1-
Ethernet0/0/15 hybrid 1-
Ethernet0/0/16 hybrid 1-
Ethernet0/0/17 hybrid 1-
Ethernet0/0/18 hybrid 1-
Ethernet0/0/19 hybrid 1-
Ethernet0/0/20 hybrid 1-
Ethernet0/0/21 hybrid 1-
Ethernet0/0/22 hybrid 1-
GigabitEthernet0/0/1 hybrid 1-
GigabitEthernet0/0/2 hybrid 1-
2) configure VLAN gateway
[Huawei] int Vlanif 1
[Huawei-Vlanif1] ip add 192.168.1.254 24
[Huawei] int Vlanif 2
[Huawei-Vlanif2] ip add 192.168.2.254 24
[Huawei] int Vlanif 3
[Huawei-Vlanif3] ip add 192.168.3.254 24
[Huawei] dis ip routing-table
Route Flags: r-relay, D-download to fib
Routing Tables: Public
Destinations: 8 Routes: 8
Destination/Mask Proto Pre Cost Flags NextHop Interface
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.254 Vlanif1
192.168.1.254/32 Direct 0 0 D 127.0.0.1 Vlanif1
192.168.2.0/24 Direct 0 0 D 192.168.2.254 Vlanif2
192.168.2.254/32 Direct 0 0 D 127.0.0.1 Vlanif2
192.168.3.0/24 Direct 0 0 D 192.168.3.254 Vlanif3
192.168.3.254/32 Direct 0 0 D 127.0.0.1 Vlanif3
3) Test the interworking between PC
4 case 4: communication between multi-switch VLAN
4.1 question
Realize the communication between different VLAN of multi-switch.
4.2 Plan
Use eNSP to build the experimental environment, as shown in figure-4.
4.3 steps
To implement this case, you need to follow these steps.
1) configure VLAN on layer 2 switches SW1 and SW2
[SW1] vlan 2
[SW1] vlan 3
[SW1] interface Ethernet0/0/1
[SW1-Ethernet0/0/1] port link-type access
[SW1-Ethernet0/0/1] port default vlan 1
[SW1] interface Ethernet0/0/2
[SW1-Ethernet0/0/2] port link-type access
[SW1-Ethernet0/0/2] port default vlan 2
[SW1] interface Ethernet0/0/3
[SW1-Ethernet0/0/3] port link-type access
[SW1-Ethernet0/0/3] port default vlan 3
[SW1] int g0/0/1
[SW1-GigabitEthernet0/0/1] port link-type trunk
[SW1-GigabitEthernet0/0/1] port trunk allow-pass vlan all
[SW2] vlan 4
[SW2] vlan 5
[SW2] interface Ethernet0/0/1
[SW2-Ethernet0/0/1] port link-type access
[SW2-Ethernet0/0/1] port default vlan 4
[SW2] interface Ethernet0/0/2
[SW2-Ethernet0/0/2] port link-type access
[SW2-Ethernet0/0/2] port default vlan 5
[SW2] int g0/0/1
[SW2-GigabitEthernet0/0/1] port link-type trunk
[SW2-GigabitEthernet0/0/1] port trunk allow-pass vlan all
2) configure layer 3 switch
[SW3] vlan batch 1 to 5
[SW3] int g0/0/1
[SW3-GigabitEthernet0/0/1] port link-type trunk
[SW3-GigabitEthernet0/0/1] port trunk allow-pass vlan all
[SW3] int g0/0/2
[SW3-GigabitEthernet0/0/2] port link-type trunk
[SW3-GigabitEthernet0/0/2] port trunk allow-pass vlan all
[SW3] int Vlanif 1
[SW3-Vlanif1] ip add 192.168.1.254 24
[SW3] int Vlanif 2
[SW3-Vlanif2] ip add 192.168.2.254 24
[SW3] int Vlanif 3
[SW3-Vlanif3] ip add 192.168.3.254 24
[SW3] int Vlanif 4
[SW3-Vlanif1] ip add 192.168.4.254 24
[SW3] int Vlanif 5
[SW3-Vlanif2] ip add 192.168.5.254 24
3) Test the interworking between PC
5 case 5: layer 3 switching configuration routing
5.1 question
Configure routing on the layer 3 switch to realize the interworking of the whole network.
5.2 scenario
Use eNSP to build the experimental environment, as shown in figure-5.
5.3 steps
To implement this case, you need to follow these steps.
1) switch configuration see case 4
2) configure routin
[SW3] vlan 6
[SW3] int g0/0/3
[SW3-GigabitEthernet0/0/3] port link-type access
[SW3-GigabitEthernet0/0/3] port default vlan 6
[SW3] int Vlanif 6
[SW3-Vlanif6] ip add 192.168.6.254 24
[SW3] ip route-static 192.168.7.0 255.255.255.0 192.168.6.1
[R1] int g0/0/0
[R1-GigabitEthernet0/0/0] ip add 192.168.6.1 24
[R1] int g0/0/1
[R1-GigabitEthernet0/0/1] ip add 192.168.7.254 24
[R1] ip route-static 0.0.0.0 0.0.0.0 192.168.6.254
[R1] dis ip ro
Route Flags: r-relay, D-download to fib
Routing Tables: Public
Destinations: 11 Routes: 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 192.168.6.254 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.6.0/24 Direct 0 0 D 192.168.6.1 GigabitEthernet
0/0/0
192.168.6.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.6.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.7.0/24 Direct 0 0 D 192.168.7.254 GigabitEthernet
0/0/1
192.168.7.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.7.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
3) Test the interworking between PC
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.