当前位置:文档之家› 华为交换机基本配置命令

华为交换机基本配置命令

华为交换机基本配置命令华为交换机基本配置命令一、单交换机VLAN划分以下是单交换机VLAN划分的基本命令:system:进入系统视图。

system-view:进入系统视图。

quit:退出系统视图。

undovlan20:删除vlan20.XXX:交换机命名。

dispvlan:显示vlan。

vlan20:创建vlan(也可进入vlan20)。

porte1/0/1toe1/0/5:把端口1-5放入VLAN20中。

对于5700系列交换机,单个端口放入VLAN的命令如下:XXX]intg0/0/1XXX]portlink-type access(注:接口类型access,hybrid、trunk)XXX]portdefaultvlan10而批量端口放入VLAN的命令如下:XXX]port-group1XXX-port-group-1]group-XXXXXX-port-group-1]porthybriduntaggedvlan3如果需要删除group(组)vlan200内的15端口,可以使用以下命令:XXX]intg0/0/15XXX-XXX]XXX通过group端口限速设置的命令如下:XXX]Port-group2XXX]group-memberg0/0/2tog0/0/23XXX]qoslroutboundcir2000cbs要显示vlan里的端口20,可以使用以下命令:dispvlan20如果需要进入端口24,可以使用以下命令:inte1/0/24要删除当前VLAN端口10,可以使用以下命令:XXX如果需要显示当前配置,可以使用以下命令:dispcurr如果需要保存配置,可以使用以下命令:save如果需要通过关闭日志信息命令改变DS模块来实现关闭配置后的确认信息显示,可以使用以下命令:info-XXXoff如果需要通过打开日志信息命令改变DS模块来实现打开配置后的确认信息显示,可以使用以下命令:info-XXX二、配置交换机支持XXX以下是配置交换机支持XXX的基本命令:system:进入系统视图。

XXX:交换机命名。

intvlan1:进入VLAN1.配置IP地址:IP地址为192.168.3.100,子网掩码为255.255.255.0.进入虚拟终端:使用用户名intvty4.设置口令模式:n-mode password,并设置口令为autpassword。

设置用户级别:使用user privilege level 3命令配置用户级别。

查看当前配置:使用disp n命令查看当前配置。

查看交换机VLANIP配置:使用disp ip int命令查看交换机VLANIP配置。

删除配置:必须退到用户模式,使用reset n命令删除配置。

重启交换机:使用reboot命令重启交换机。

跨交换机VLAN的通讯:在SW1上,建立VLAN10和VLAN20,并将端口5和端口15分别加入对应的VLAN,将端口24设为TRUNK端口并允许所有VLAN使用。

在SW2上,建立VLAN10并将端口20加入VLAN10,将端口24设为TRUNK端口并允许所有VLAN使用。

使用disp int e1/0/24命令查看端口24是否为TRUNK,并使用undo port trunk permit vlan all命令删除该句。

路由的配置命令:进入系统模式,使用sysname命令命名,进入端口1/0并设置IP地址为192.168.3.100,使用undoshutdown命令打开端口。

使用disp ip int命令查看IP接口情况,或使用disp ip int brief命令查看IP接口情况。

进入口令模式:使用用户名intvty4.n-mode password (authpass) is used to enter password mode。

To set the password。

use set n password simple .User privilege level 3 is used to enter the third level of privilege。

To save n。

use save。

To delete n in user mode。

use reset n。

To configure remote login password。

use undo shutdown。

To configure IP routes。

use inte1/4 and input the n ork segment as ip route 192.168.3.0 255.255.255.0 192.168.12.1 (next hop: the interface of the next router)。

For the default route。

useip route 0.0.0.0 0.0.0.0 192.168.12.1.To display the route list。

use disp ip rout。

The router n uses a straight-through cable。

ForWAN0.connect WAN0 to WAN0.and for WAN1.connect WAN1to WAN1.The gateway of the computer should be set to the interface address of the router。

To configure VLAN-VLAN n on a layer 3 switch。

use the following steps on SW1: enter system view with system。

namethe system with sysname。

create VLAN10 with vlan10.create VLAN20 with vlan20.enter port 20 with inte1/0/20.put port 20 in VLAN10 with port access vlan10.enter port 24 with inte1/0/24.setport 24 as a trunk port with port link-type trunk。

permit all VLANs to use port 24 with port trunk permit vlan all (or only allow vlan10 to use it with port trunk permit vlan10)。

One the same steps except for setting the port to access VLAN10 with port access vlan10 on inte1/0/5.Finally。

on SW1.create a virtual interface for VLAN10 with int vlan10.set the address for the virtual interface VLAN10 with ip address 192.168.10.254 255.255.255.0.create a virtual interface for VLAN20 with int vlan20.and set the address for the virtual interface VLAN20 with ip address 192.168.20.254 255.255.255.0.六、动态路由RIPR1:进入e1/0端口,设置IP地址为192.168.3.1,子网掩码为255.255.255.0.进入e2/0端口,设置IP地址为192.168.5.1,子网掩码为255.255.255.0.开启RIP动态路由,并定义IP地址为192.168.3.0和192.168.5.0.使用disp ip route命令查看路由接口。

R2:进入e1/0端口,设置IP地址为192.168.4.1,子网掩码为255.255.255.0.进入e2/0端口,设置IP地址为192.168.5.2,子网掩码为255.255.255.0.开启RIP动态路由,并定义IP地址为192.168.4.0和192.168.5.0.使用disp ip route命令查看路由接口。

注意:vlan10里的计算机的网关设为192.168.10.254,vlan20里的计算机的网关设为192.168.20.254)七、IP访问列表进入e1/0端口,设置IP地址为192.168.3.1,子网掩码为255.255.255.0.进入e2/0端口,设置IP地址为192.168.1.1,子网掩码为255.255.255.0.进入e3/0端口,设置IP地址为192.168.2.1,子网掩码为255.255.255.0.创建一个基本访问列表,编号为2001.拒绝地址为192.168.1.0网段的数据通过,允许地址为192.168.3.0网段的数据通过。

在接口下应用访问控制列表。

启用防火墙,并设置默认允许。

使用dis acl 2001命令显示信息。

使用undo acl number 2001命令删除2001控制列表。

创建一个扩展访问控制列表,编号为3001.规则:禁止源IP为192.168.3.0/0.0.0.255,目的IP为192.168.2.0/0.0.0.255,目的端口为FTP的TCP数据包通过。

该规则必须在r-acl-adv-3001下执行。

命令:permit ip source and n any (rulepermitip)。

应在接口E3/0下启用防火墙,并在防火墙入站规则packet-filter 3001中执行。

标准访问IP列表(三层交换机):允许A组机器访问服务器内资料,但不允许B组机器访问(服务器无限制)。

sysvlan10name servervlan20name XXXvlan30name studentinte1/0/5port access vlan10inte1/0/10port access vlan20inte1/0/15port access vlan30int vlan10ip address 192.168.10.1 255.255.255.0no shutdownint vlan20ip address 192.168.20.1 255.255.255.0int vlan30ip address 192.168.30.1 255.255.255.0acl number 2001rule 1 deny source 192.168.30.0/0.0.0.255rule 2 permit source anydisplay acl 2001inte1/0/10port access vlan20packet-filter outbound ip-group 2001 rule 1出口允许A机器访问B机器的FTP,但不允许访问WWW,机器没有任何限制。

相关主题