实现不同网段的pc间通信:
pc1:192.168.0.3 24 网关: 192.168.0.254
pc2:192.168.1.3 24 网关: 192.168.1.254
配置交换机
[Huawei]interface GigabitEthernet0/0/2
[Huawei-GigabitEthernet0/0/2]display this
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
#
return
[Huawei-GigabitEthernet0/0/2]q
[Huawei]interface GigabitEthernet0/0/3
[Huawei-GigabitEthernet0/0/3]display this
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 20
#
return
[Huawei-GigabitEthernet0/0/3]q
[Huawei]interface GigabitEthernet0/0/1
[Huawei-GigabitEthernet0/0/1]display this
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[Huawei-GigabitEthernet0/0/1]
配置路由器:
pc1: vlan 10 interface Ethernet0/0/0.10
pc2: vlan 20 interface Ethernet0/0/0.1
[Huawei]interface Ethernet0/0/0.10
[Huawei-Ethernet0/0/0.10]display this
#
interface Ethernet0/0/0.10
dot1q termination vid 10
ip address 192.168.0.254 255.255.255.0
arp broadcast enable
#
return
[Huawei-Ethernet0/0/0.10]
[Huawei]interface Ethernet0/0/0.1
[Huawei-Ethernet0/0/0.1]display th
[Huawei-Ethernet0/0/0.1]display this
#
interface Ethernet0/0/0.1
dot1q termination vid 20
ip address 192.168.1.254 255.255.255.0
arp broadcast enable
#
return
[Huawei-Ethernet0/0/0.1]
查看配置结果:
[Huawei]display ip interface brief
*down: administratively down
!down: FIB overload down
^down: standby
(l): loopback
(s): spoofing
(d): Dampening Suppressed
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 9
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 10
Interface IP Address/Mask Physical Protocol
Ethernet0/0/0 unassigned up down
Ethernet0/0/0.1 192.168.1.254/24 up up
Ethernet0/0/0.10 192.168.0.254/24 up up
Ethernet0/0/1 unassigned down down
GigabitEthernet0/0/0 unassigned down down
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
GigabitEthernet0/0/3 unassigned down down
NULL0 unassigned up up(s)
Serial0/0/0 unassigned down down
Serial0/0/1 unassigned down down
Serial0/0/2 unassigned down down
Serial0/0/3 unassigned down down
查看路由表信息:
[Huawei]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 6 Routes : 6
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.0.0/24 Direct 0 0 D 192.168.0.3 Ethernet0/0/0.1
192.168.0.3/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.1
192.168.1.0/24 Direct 0 0 D 192.168.1.3 Ethernet0/0/0.2
192.168.1.3/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.2
配置pc:
pc1:
pc2:
查看效果:
pc1:
pc2: