作者:黑鸽子 | 来源:互联网 | 2023-08-31 12:59
网络拓扑设备配置pc1pc2pc3SW1system-view[Huawei]vlan10[Huawei-vlan10]q[Huawei]intGigabitEth
网络拓扑
设备配置
pc1
pc2
pc3
SW1
system-view
[Huawei]vlan 10
[Huawei-vlan10]q
[Huawei]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
return
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int GigabitEthernet 0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 1 10
[Huawei-GigabitEthernet0/0/3]dis this
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10
#
return
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip address 10.10.1.1 16
[Huawei-Vlanif10]dis this
#
interface Vlanif10
ip address 10.10.1.1 255.255.0.0
#
return
[Huawei-Vlanif10]q
[Huawei]int vlanif 1
[Huawei-Vlanif1]ip address 192.168.2.1 255.255.255.0
[Huawei-Vlanif1]dis this
#
interface Vlanif1
ip address 192.168.2.1 255.255.255.0
#
return
[Huawei-Vlanif1]q
[Huawei]ip route-static 20.20.0.0 16 192.168.2.2
[Huawei]ip route-static 30.30.30.0 24 192.168.2.2
[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
10.10.0.0/16 Direct 0 0 D 10.10.1.1 Vlanif10
10.10.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
20.20.0.0/16 Static 60 0 RD 192.168.2.2 Vlanif1
30.30.30.0/24 Static 60 0 RD 192.168.2.2 Vlanif1
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.2.0/24 Direct 0 0 D 192.168.2.1 Vlanif1
192.168.2.1/32 Direct 0 0 D 127.0.0.1 Vlanif1
sw2
system-view
[Huawei]vlan 10
[Huawei-vlan10]q
[Huawei]vlan 20
[Huawei-vlan20]q
[Huawei]int GigabitEthernet 0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access
[Huawei-GigabitEthernet0/0/2]port default vlan 10
[Huawei-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
return
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int GigabitEthernet 0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type trunk
[Huawei-GigabitEthernet0/0/3]port trunk allow-pass vlan 1 10 20
[Huawei-GigabitEthernet0/0/3]dis this
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int GigabitEthernet 0/0/4
[Huawei-GigabitEthernet0/0/4]port link-type access
[Huawei-GigabitEthernet0/0/4]port default vlan 20
[Huawei-GigabitEthernet0/0/4]dis this
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 20
#
return
[Huawei-GigabitEthernet0/0/4]q
[Huawei-Vlanif10]ip address 20.20.1.1 16
[Huawei-Vlanif10]dis this
#
interface Vlanif10
ip address 20.20.1.1 255.255.0.0
#
return
[Huawei-Vlanif10]q
[Huawei]int Vlanif 20
[Huawei-Vlanif20]ip address 30.30.30.1 255.255.255.0
[Huawei-Vlanif20]dis this
#
interface Vlanif20
ip address 30.30.30.1 255.255.255.0
#
return
[Huawei-Vlanif20]q
[Huawei]int Vlanif 1
[Huawei-Vlanif1]ip address 192.168.2.2 255.255.255.0
[Huawei-Vlanif1]dis this
#
interface Vlanif1
ip address 192.168.2.2 255.255.255.0
#
return
[Huawei-Vlanif1]q
[Huawei]ip route-static 10.10.0.0 16 192.168.2.1
[Huawei]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.0.0/16 Static 60 0 RD 192.168.2.1 Vlanif1
20.20.0.0/16 Direct 0 0 D 20.20.1.1 Vlanif10
20.20.1.1/32 Direct 0 0 D 127.0.0.1 Vlanif10
30.30.30.0/24 Direct 0 0 D 30.30.30.1 Vlanif20
30.30.30.1/32 Direct 0 0 D 127.0.0.1 Vlanif20
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.2.0/24 Direct 0 0 D 192.168.2.2 Vlanif1
192.168.2.2/32 Direct 0 0 D 127.0.0.1 Vlanif1
[Huawei]acl 3500
[Huawei-acl-adv-3500]rule 5 deny icmp source 30.30.30.0 0.0.0.255 destination 20
.20.0.0 0.0.255.255
[Huawei-acl-adv-3500]dis this
#
acl number 3500
rule 5 deny icmp source 30.30.30.0 0.0.0.255 destination 20.20.0.0 0.0.255.255
#
return
[Huawei-acl-adv-3500]q
Huawei]int GigabitEthernet 0/0/4
[Huawei-GigabitEthernet0/0/4]traffic-filter inbound acl 3500
[Huawei-GigabitEthernet0/0/4]dis this
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 20
traffic-filter inbound acl 3500
#
return
[Huawei-GigabitEthernet0/0/4]q
[Huawei]
PC2 ping PC1
PC3 ping PC1
PC3 ping PC2
PC2 ping PC3