D-LINK网络交换机的CLI的配置说明书

来源:百度文库 编辑:神马文学网 时间:2024/04/30 07:07:44

D-LINK网络交换机的CLI的配置说明书

 

Show 命令可以查看交换机的各项的配置(交换机无法查看整体的当前和保存的配置信息)

Create 命令可以创建交换的信息

Config 命令可以对这些参数进行配置

Delete命令可以删除所配制的参数

Reboot 命令对交换机进行重新启动

Save 命令保存交换机的配置信息的修改

Reset 命令清空配置信息

reset system 不仅清空运行时配置 ,还将把曾经保存过的配置全部清空,

reset config仅清空运行时配置.

Create account [admin|user]  创建admin或user级别的用户,回车输入两次密码创建输入为空密码

Create account 修改已创建的username用户,回车输入旧密码,在输入两次新密码

Show account    可以看到你所创建的用户

Show switch      可以查看交换机的信息

Show iproute      查看路由表

Show vlan          查看VLAN条目

[enable|disable] telnet 23                此命令开启|删除telnet功能

enable mac_notification                   默认是关闭MAC地址通告的

 

show ipif    查看交换机的配置接口信息

config ipif System ipaddress 10.1.1.1/8   修改System接口的IP地址 注意接口名System的大小写

 

备份/恢复配置

download configuration 192.168.0.157 c:/xuekang/setting.txt   从192.168.0.157上下载配置文件

upload  configuration 192.168.0.157 c:/xuekang/setting.txt       到192.168.0.157上上穿配置文件

端口镜像的设定

config mirror port 1:5 [add|delete] sourece port 1:1-1:5  把1-5断口加到5端口上做镜像(默认关闭)

链路聚合配置

create link_aggregation group_id 1                 创建一个聚合组1

config link_aggregation group_id 1 master_port 5 ports 5-7,9

创建MAC地址的绑定

create arpentry 192.168.0.157 00-56-b5-45-B5-4H   为主机绑定IP

delete arpentry 192.168.0.157  删除IP的绑定

show arpentry                 查看某些主机的绑定

 

CLI SWITCH LAYER3 VLAN 设定(以下Command 請注意大小寫)

 

config vlan default delete 1-24      ->将default Vlan 移除,否則Port 在不带

tag 的狀況下,将無法继续以下的Vlan 設定。

create vlan vlan1 tag 10                                                                                                               ->新增一個Vlan;Vlan Name 为Vlan1,Vlan Tag(等于VID) 为10。

create vlan vlan2 tag 20                                                                                                               ->新增一個Vlan;Vlan Name 为Vlan2,Vlan Tag(等于VID) 为为20。

create vlan vlan3 tag 30                                                                                                               ->新增一個Vlan;Vlan Name 为Vlan3,Vlan Tag(等与VID) 为30。

config vlan vlan1 add untagged 1-8                                                                                        ->設定Vlan1 的Port 范围为Port 1-8,且不带Tag。

config vlan vlan2 add untagged 9-16                                                                                      ->設定Vlan2 的Port 范围为Port 9-16,且不带Tag。

config vlan vlan3 add untagged 17-24                                                                                    ->設定Vlan3 的Port 范围为Port 17-24,且不带Tag。注:untagged为tagged是为trunk口  trunk端口可立属于多个VLAN中。

 

create ipif if_vlan1 192.168.0.253/24 vlan1 state enable    

->針对Vlan1 指定一個IP Interface(if_vlan1),IP 位址为192.168.0.253。(这个虚口就是接外网的接口)

create ipif if_vlan2 192.168.10.254/24 vlan2 state enable                                                                 ->針对Vlan2 指定一個IP Interface(if_vlan2),IP 位址为192.168.10.254。

create ipif if_vlan3 192.168.20.254/24 vlan3 state enable   

->針对Vlan3 指定一個IP Interface(if_vlan3),IP 位址为192.168.20.254。

 

create iproute default 192.168.0.254                                                                                              ->設定Default route 位置为最上端gateway 192.168.0.254.

save                       >储存設定

 

QOS的配置

Config bandwidth_control 1-10 tx_rate 10                         设定端口1-10流量为10

 

访问控制列表(ACL)的配置

create access_profile[ethernet { vlan | source_mac | destination_mac |

  802.1p | ethernet_type} | ip { vlan|source_ip_mask | destination_ip_mask | dscp | [ icmp { type | code} | igmp {type} |  tcp { src_port_mask |  flag_mask [ all | { urg | ack | psh | rst |syn | fin } ] } | dst_port_mask ] | udp {src_port_mask | dst_port_mask } | protocol_id { user_mask } } } ] { profile_id }

以下为ACL配置事例:

要求:3326S交换机上所作的vlan 规划:将提供QQ/FTP/WWW以及连接上网服务的路由器的端口划分为Vlan10,并将其作为“公共端口”来使用(假设在3326S上使用1-5端口);将财务部、人事部以及其他未做特殊要求的部分设定为Vlan20/Vlan30和Vlan50,分别使用交换机的6-10,11-15,21-24端口,他们之间不能够互相访问,但都可以访问服务器所在的Vlan10;最后,将客户服务器划分为Vlan40,使用交换机的16-20端口,该Vlan与其他各个Vlan之间均不能够通讯(包括公共端口所在的Vlan10)。

具体配置:

VLAN和IP的创建在这里就不在具体述说了

ACL的设定为:

#Create access_profile ip source_ip_mask 255.255.255.0 destination_ip_mask 255.255.255.0 deny profile_id 100                 在access_prolile id为100的限制规则前提下,进行各个Vlan之间访问权限的设定   

#config access_profile profile_id 100 add access_id 101 ip source_ip192.168.20.2 destination_ip 192.168.30.2

#config access_profile profile_id 100 add access_id 102 ip source_ip192.168.20.2 destination_ip 192.168.40.2

#config access_profile profile_id 100 add access_id 103 ip source_ip192.168.20.2 destination_ip 192.168.50.2

         以上设定设定使Vlan20不能够同Vlan30/40/50通讯,只能访问Vlan10的服务器

#config access_profile profile_id 100 add access_id 104 ip source_ip 192.168.30.2 destination_ip 192.168.40.2

#config access_profile profile_id 100 add access_id 105 ip source_ip 192.168.30.2 destination_ip 192.168.50.2

以上设定使Vlan30不能够同Vlan40/50通讯,只能访问Vlan10的服务器( 由于ACL的限制是双向的,故就不用再设定Vlan30不能和Vlan20通讯了,因为在(1)中的Vlan20已经做了这个控制)

#config access_profile profile_id 100 add access_id 106 ip source_ip 192.168.40.2 destination_ip 192.168.50.2

#config access_profile profile_id 100 add access_id 107 ip source_ip 192.168.40.2 destination_ip 192.168.10.2

                        设定使Vlan40不能够同Vlan10和Vlan50通讯

 

show access_profile { profile_id { access_id }