9 / 9
一、網絡規劃1、設備一台路由器
一台二層交換機
兩台PC
2、地址規劃路由器(AR1):
ge 0/0/0 IP:192.168.10.1/24 vlan1
ge 0/0/1 IP:192.168.20.1/24 vlan2
交換機(L2SW):
eth 0/0/1 eth 0/0/3 屬于vlan10
eth 0/0/2 eth 0/0/4 屬于vlan20
PC:
PC1(CLIENT1): IP:192.168.10.100/24
gw :192.168.10.1/24
vlan 10
PC2(CLIENT2): IP:192.168.20.100/24
gw :192.168.20.1/24
vlan 20
3、網絡拓撲圖二、交換機配置
<Huawei>sys
Enter system view, return user view with Ctrl Z.
[Huawei]sysname L2-sw
[L2-sw]
[L2-sw]vlan batch 10 20
驗證
[L2-sw]disp vlan
[L2-sw]interface Eth0/0/1
[L2-sw-Ethernet0/0/1]port link-type access
[L2-sw-Ethernet0/0/1]port default vlan 10
驗證
[L2-sw-Ethernet0/0/1]disp this
[L2-sw]int Eth0/0/2
[L2-sw-Ethernet0/0/2]port link-type access
[L2-sw-Ethernet0/0/2]port default vlan 20
[L2-sw-Ethernet0/0/2]disp this
#
interface Ethernet0/0/2
port link-type access
port default vlan 20
#
return
[L2-sw-Ethernet0/0/2]
配置
[L2-sw]int eth 0/0/3
[L2-sw-Ethernet0/0/3]port link-type access
[L2-sw-Ethernet0/0/3]port default vlan 10
[L2-sw-Ethernet0/0/3]dis th
[L2-sw]int eth 0/0/4
[L2-sw-Ethernet0/0/4]port link-type access
[L2-sw-Ethernet0/0/4]port default vlan 20
[L2-sw-Ethernet0/0/4]dis this
[L2-sw]disp vlan
三、路由器配置
路由器的接口地址就是pc網關對應的地址,華為路由器默認端口是開啟的
<Huawei>sys
Enter system view, return user view with Ctrl Z.
[Huawei]sysname R1
[R1]
[R1]int GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.10.1 255.255.255.0
[R1-GigabitEthernet0/0/0]dis th
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1]dis th
[R1-GigabitEthernet0/0/1]disp ip routing-table
上圖路由表中Direct是直連路由,127開頭的是協議自己的回環,是設備自己産生的,不用管的。
四、驗證在Pc1上ping 192.168.20.100,也就是Pc2 是通的。
在pc2上ping 192.168.20.100 ,也就是Pc1,是通的。
五、整體查看接口配置
查看交換機接口的整體配置情況
[L2-sw]disp current-configuration interface
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
port link-type access
port default vlan 10
#
interface Ethernet0/0/2
port link-type access
port default vlan 20
#
interface Ethernet0/0/3
port link-type access
port default vlan 10
#
interface Ethernet0/0/4
port link-type access
port default vlan 20
由此可以看到,路由器和交換機用兩條線相連,可以實現不同vlan之間的通信,并且在交換機和路由器的接口上都是用的access模式。
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!