5台客户端,通过两台交换机,⼀台核⼼交换机,和⼀台路由器成功实现互通。
⾸先配置各个客户端的IP,以及⽹关,按照顺序:
P1:ip:10.0.1.2 ⼦⽹掩码:255.255.255.0 ⽹关:10.0.1.1
P2:ip:10.0.2.2 ⼦⽹掩码:255.255.255.0 ⽹关:10.0.2.1
P3:ip:10.0.3.2 ⼦⽹掩码:255.255.255.0 ⽹关:10.0.3.1
P4:ip:10.0.4.2 ⼦⽹掩码:255.255.255.0 ⽹关:10.0.4.1
P5:ip:10.0.5.2 ⼦⽹掩码:255.255.255.0 ⽹关:10.0.5.1
配置LSW2,设置端⼝G0/0/2,G0/0/3的接⼝模式为ACCESS,并分配到两个VLAN中:vlan2,vlan3.设置G0/0/1的接⼝模式为TRUNK。
<huawei>undo terminal monitor
<huawei>sys
[huawei]
#
vlan batch 2 to 3 //新建vlan2,vlan3
#
interface GigabitEthernet0/0/1
port link-type trunk //更改端⼝类型为trunk用路由器连接两台电脑
port trunk allow-pass vlan all //设置权限为所有vlan都可以连接
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 2
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 3
同样配置LSW3,设置端⼝G0/0/2,G0/0/3的接⼝模式为ACCESS,并分配到两个VLAN中:vlan 4,vlan 5.设置G0/0/1的接⼝模式为TRUNK。
完成之后配置核⼼交换机LSW1,设置G0/0/2,G0/0/3的接⼝模式为TRUNK。然后新建2到6的vlan,并设置各vlan的IP地址为各个⽹关地址.设置G0/0/1的接⼝模式为ACCESS,并添加到VLAN 6中.最后设置交换机的静态路由地址
#
sysname Huawei
#
vlan batch 2 to 6
#
interface Vlanif1
#
interface Vlanif2
ip address 10.0.1.1 255.255.255.0
#
interface Vlanif3
ip address 10.0.2.1 255.255.255.0
#
interface Vlanif4
ip address 10.0.3.1 255.255.255.0
#
interface Vlanif5
ip address 10.0.4.1 255.255.255.0
#
interface Vlanif6
ip address 10.0.6.1 255.255.255.0 //这个容易出错,不要设成10.0.5.1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access //只需通⾏⽹段vlan 6,不必设置成trunk
port default vlan 6
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan all
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan all
#
ip route-static 10.0.5.0 255.255.255.0 10.0.6.2
#
最后设置路由器AR2,设置两个接⼝的IP,以及静态路由地址。
#
interface GigabitEthernet0/0/0
ip address 10.0.6.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.5.1 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.0.6.1 //任何⽹段都跳到10.0.6.1
#
测试各客户端的连通性。
发布评论