单臂路由
要求:配置vlan后可以互相ping
交换机配置
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]interface Ethernet 0/0/2
[Huawei-Ethernet0/0/2]port link-type access
[Huawei-Ethernet0/0/2]port default vlan 10
[Huawei-Ethernet0/0/2]q
[Huawei]interface Ethernet 0/0/3
[Huawei-Ethernet0/0/3]port link-type access
[Huawei-Ethernet0/0/3]port default vlan 20
[Huawei-Ethernet0/0/3]quit
[Huawei]interface Ethernet 0/0/1
[Huawei-Ethernet0/0/1]port link-type trunk
[Huawei-Ethernet0/0/1]port trunk allow-pass vlan 10 20
[Huawei-Ethernet0/0/1]display this
#
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
return
[Huawei-Ethernet0/0/1]quit
[Huawei]
<Huawei>save
路由器配置
<Huawei>undo terminal monitor
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]interface Ethernet 0/0/0.1
[Huawei-Ethernet0/0/0.1]dot1q termination vid 10
[Huawei-Ethernet0/0/0.1]ip address 192.168.10.254 255.255.255.0
[Huawei-Ethernet0/0/0.1]arp broadcast enable
[Huawei-Ethernet0/0/0.1]display this
#
interface Ethernet0/0/0.1
dot1q termination vid 10
ip address 192.168.10.254 255.255.255.0
arp broadcast enable
#
return
[Huawei-Ethernet0/0/0.1]quit
[Huawei]interface Ethernet 0/0/0.2
[Huawei-Ethernet0/0/0.2]dot1q termination vid 20
[Huawei-Ethernet0/0/0.2]ip address 192.168.20.254 255.255.255.0
[Huawei-Ethernet0/0/0.2]arp broadcast enable
[Huawei-Ethernet0/0/0.2]quit
[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.10.254/24 up up
Ethernet0/0/0.2 192.168.20.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.10.0/24 Direct 0 0 D 192.168.10.254 Ethernet0/0/0.1
192.168.10.254/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.1
192.168.20.0/24 Direct 0 0 D 192.168.20.254 Ethernet0/0/0.2
192.168.20.254/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0.2
测试
PC>ping 192.168.20.20
Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break
From 192.168.20.20: bytes=32 seq=1 ttl=127 time=78 ms
From 192.168.20.20: bytes=32 seq=2 ttl=127 time=63 ms
From 192.168.20.20: bytes=32 seq=3 ttl=127 time=78 ms
From 192.168.20.20: bytes=32 seq=4 ttl=127 time=63 ms
From 192.168.20.20: bytes=32 seq=5 ttl=127 time=109 ms
--- 192.168.20.20 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 63/78/109 ms