一、交换机接口模式
1、划分端口类型access
进入某个端口 int g 0/0/0
设置端口类型access,可加入某个vlan
Port link-type access
划分到vlan2 port default vlan 2
2、划分端口类型trunk
进入某个端口int g 0/0/1
设置端口类型trunk,可加入多个vlan
Port link-type trunk
允许通过vlan2,port trunk allow-pass vlan 2
允许通过所有vlan,port trunk allow-pass vlan all
二、进入系统视图(任务视图)
1、
2、给路由器起名sysname +名字
3、退出当前视图quit简写:q
4、指路命令
ip route-static 要去的目标网段 子网掩码 该路由接口的下一跳ip地址
创建vlan
vlan 2
单臂路由
子接口int g 0/0/0.1
与vlan关联 dot1q termination vid 2
启用arp广播 arp broadcast enable
1、查看所有接口状态
display interface brief
2、查看所有vlan
display vlan
3、查看路由表
display ip routing-table
4、显示当前配置
display this
4、创建vlan10到20
vlan batch 10 to 20
5、设置vlan 名字 name ***
6、关闭信息中心功能
[huawei]undo info-center enable 简写:un in en
三、dhcp命令
int g0/0/0.1
dhcp select global
路由器AR2220
[Huawei]un in en //关闭提示信息
[Huawei]int g 0/0/0.1 //进入g0/0/0/0.1的子接口
[Huawei-GigabitEthernet0/0/0.1]dot1q termination vid 2 //给子接口封装dot1q协议,设置vlan2数据可以通过
[Huawei-GigabitEthernet0/0/0.1]ip address 192.168.1.1 24//给子接口配上ip
[Huawei-GigabitEthernet0/0/0.1]arp broadcast enable//启动ARP的广播功能
[Huawei-GigabitEthernet0/0/0.1]q //退出
[Huawei]int g 0/0/0.2//进入g0/0/0/0.2的子接口
[Huawei-GigabitEthernet0/0/0.2]dot1q termination vid 3//给子接口封装dot1q协议,设置vlan3数据可以通过
[Huawei-GigabitEthernet0/0/0.2]ip address 192.168.2.1 24//给子接口配上ip
[Huawei-GigabitEthernet0/0/0.2]arp broadcast enable//启动ARP的广播功能
[Huawei-GigabitEthernet0/0/0.2]q//退出
[Huawei-GigabitEthernet0/0/0.3]dot1q termination vid 4//给子接口封装dot1q协议,设置vlan4数据可以通过
[Huawei-GigabitEthernet0/0/0.3]ip address 192.168.3.1 24//给子接口配上ip
[Huawei-GigabitEthernet0/0/0.3]arp broadcast enable//启动ARP的广播功能
[Huawei-GigabitEthernet0/0/0.3]q//退出
[Huawei]dhcp enable//开启dhcp功能
[Huawei] ip pool a //创建地址池a
[Huawei-ip-pool-a]network 192.168.1.0 mask 255.255.255.0//设置地址池范围
[Huawei-ip-pool-a]gateway-list 192.168.1.1//默认网关
[Huawei-ip-pool-a]dns-list 8.8.8.8 114.114.114.114//设置DNS
[Huawei-ip-pool-a]int g0/0/0.1//进入0.1子接口
[Huawei-GigabitEthernet0/0/0.1]dhcp select global//将dhcp设置为全局模式
[Huawei-GigabitEthernet0/0/0.1]q//退出
[Huawei]ip pool b//创建地址池b
[Huawei-ip-pool-b]network 192.168.2.0 mask 255.255.255.0//设置地址池范围
[Huawei-ip-pool-b]gateway-list 192.168.2.1//默认网关
[Huawei-ip-pool-b]dns-list 8.8.8.8 114.114.114.114//设置DNS
[Huawei-ip-pool-b]int g0/0/0.2//进入0.2子接口
[Huawei-GigabitEthernet0/0/0.2]dhcp select global//将dhcp设置为全局模式
[Huawei-GigabitEthernet0/0/0.2]q//退出
[Huawei]ip pool c//创建地址池c
[Huawei-ip-pool-c]network 192.168.3.0 mask 255.255.255.0//设置地址池范围
[Huawei-ip-pool-c]gateway-list 192.168.3.1//默认网关
[Huawei-ip-pool-c]dns-list 8.8.8.8 114.114.114.114//设置DNS
[Huawei-ip-pool-c]int g0/0/0.3//进入0.3子接口
[Huawei-GigabitEthernet0/0/0.3]dhcp select global//将dhcp设置为全局模式
交换机s5700
[Huawei]vlan 2
[Huawei-vlan2]vlan 3
[Huawei-vlan3]vlan 4//创建vlan2、3、4
[Huawei-vlan4]q
[Huawei]un in en//关闭提示信息
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk//更改端口的属性,改成trunk口可加入多个vlan
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int g0/0/2
[Huawei-GigabitEthernet0/0/2]port link-type access//更改端口的属性,改成access口可加入某个vlan
[Huawei-GigabitEthernet0/0/2]port default vlan 2
[Huawei-GigabitEthernet0/0/2]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]port link-type access
[Huawei-GigabitEthernet0/0/3]port default vlan 3
[Huawei-GigabitEthernet0/0/3]q
[Huawei]int g0/0/4
[Huawei-GigabitEthernet0/0/4]port link-type access
[Huawei-GigabitEthernet0/0/4]port default vlan 4
[Huawei-GigabitEthernet0/0/4]q
[Huawei-GigabitEthernet0/0/4]port trunk allow-pass vlan all//允许所有vlan通过别忘了!!