undo info-center enable (un in en) 关闭消息日志sysname <设备名> 设备命名system-view 进入系统视图quit 返回上一级视图return 直接返回到用户视图save 保存
同时操作多个接口视图port-group group-member <接口类型> x/y/z to <接口类型> x/y/z
Telnet
user-interface vty <id> <id> 进入 vty 视图(0 4 为 5 个)user-interface maximum-vty 最大同时登录数量
参观/监控级
authentication-mode password 密码认证模式user privilege level <0/1> 预设 0 参观级,1 监控级
管理级
authentication-mode aaa aaa 认证模式aaa 进入 aaa 视图local-user <用户名> password <cipher/plain> <密码> privilege level <权限等级> 配置用户账户和权限等级local-user <用户名> service-type telnet 服务类型 Telnet
Vlan
vlan batch 创建 vlan,后面跟所有需要创建的 vlanid ,空格分割
配置接口
interface <接口> 进入接口视图port link-type <access/trunk/hybrid> 配置端口类型
Access
port default vlan <vlanid> 配置 pvid
Trunk
port trunk pvid vlan <vlanid> 配置 pvidport trunk allow-pass vlan 配置放行 vlan,后面跟所有需要放行的 vlanid,空格分割
若题目要求中没有放行 vlan 1,则需要手动 undo port trunk allow-pass vlan 1
Hybrid
port hybrid pvid vlan <vlanid> 配置 pvidport hybrid untagged vlan 配置剥离 vlan tag,后面跟所有需要放行的 vlanid,空格分割port hybrid tagged vlan 配置添加 vlan tag,后面跟所有需要放行的 vlanid,空格分割
untagged 的朝向 PC,tagged 朝向交换机
IP 位址
interface <接口> 进入接口视图ip address <IP 位址> <掩码>
STP
stp mode <模式> STP 模式
mstp默认stprstp
stp instance <实例 ID> cost <开销值> 链路堵塞 开销stp bpdu-protection BPDU 保护stp priority <优先级> 设置优先级stp root <优先根/备份根> 设置根桥
primary优先secondary备份
边缘端口和保护
interface <接口> 进入接口视图stp edged-port enable 边缘端口stp root-protection 根保护stp loop-protection 环路保护
Vlan 间路由
单臂路由
interface <接口>.<子接口编号> 进入子接口视图
配置 IP 位址dot1q termination vid <vlanid> 封装并承载 Vlan 流量arp broadcast enable 开启 ARP 广播
三层交换
interface vlanif <vlanid> 进入 Vlanif 视图
配置 IP 位址
链路聚合
interface eth-trunk <ID> 进入 Eth-Trunk 视图mode <模式> 制定聚合模式
manual load-balance手动负载分担模式lacp-static静态 LACP 模式(LACP)
配置成员接口
interface <接口> 进入接口视图eth-trunk <ID> 加入聚合组
修改 IP 位址时,如果是路由器设备,
遇到 Error: The layer-3 interface can not add into a layer-2 trunk
则需要 undo portswitch 关闭二层模式
需要在设置模式和配置成员接口前执行,如果已经执行了需要 undo <命令>
LACP
系统视图下
lacp priority <优先级> LACP 系统优先级max active-linknumber <最大活动接口数> 活动接口上线阈值
接口视图下
lacp priority <优先级> LACP 接口优先级lacp preempt LACP 抢占
enable开启delay <时间>抢占延迟
静态路由
ip route-static <目标网段> <掩码> <下一跳> preference <优先级> 静态路由
<目标网段 = 0.0.0.0> <掩码 = 0>默认路由
动态路由
RIP
rip <进程号> 创建 RIP 进程undo summary 关闭自动汇总version <版本号> 指定 RIP 版本network <网段> 宣告网段import-route <来源> 在 RIP 网络中引入路由
direct直连路由static静态路由ospf <进程号> cost <开销值>OSPF 路由
default-route originate 发布默认路由
OSPF
ospf <进程号> [router-id <ID>] 创建 OSPF 进程,配置 Router-ID(进入进程视图)router id <ID> 设置 Router-IDarea <区域ID> 创建区域(进入区域视图)
进程视图下
import-route rip <进程号> 引入 RIP 路由default-route-advertise [always] 配置 OSPF 发布默认路由silent-interface <接口> 配置 OSPF 被动静态接口preference <优先级> 设置优先级
区域视图下
network <网络地址> <反掩码> 宣告网段authentication-mode 区域认证模式
simple <plain/cipher> <口令>简单模式md5 <验证字标识符 ID> <口令>MD5 模式
接口视图下
ospf dr-priority <优先级> 设置优先级,数字越大优先级越高ospf authentication-mode 链路认证模式
simple <plain/cipher> <口令>简单模式md5 <验证字标识符 ID> <口令>MD5 模式
VRRP
interface <接口> 进入接口视图vrrp vrid <备份组ID>
virtual-ip <虚拟 IP>创建备份组priority <优先级>设置优先级,数字越大优先级越高track interface <监视接口号> reduced <裁剪优先级值>接口监视authentication-mode <认证方式> <密码>认证
ACL
acl <ACL 编号> 创建 ACL
题目要求只允许 = 要先 rule <规则 ID> deny all
基本 ACL(编号范围 2000-2999)
rule <规则 ID> <permit/deny> source <源位址> <反掩码> 定义 ACL 规则
高级 ACL(编号范围 3000-3999)
rule <规则 ID> <permit/deny> <协议> source <源位址> <反掩码> destination <目的位址> <反掩码> detination-port <操作符> <端口号/服务名> 定义 ACL 规则
调用 ACL
接口下调用
interface <接口> 进入接口视图traffic-filter <inbound/outbound> acl <ACL 编号> 调用 ACL
vty 下调用
user-interface vty <id> <id> 进入 vty 视图acl <ACL 编号> <inbound/outbound> 调用 ACL
PPP 认证
认证方
interface <接口> 进入接口视图link-protocol ppp 指定协议为 PPPppp authentication-mode <pap/chap> 指定认证方式quit 退出视图aaa 进入 aaa 视图local-user <用户名> password <cipher/plain> <密码> 配置用户账户local-user <用户名> service-type ppp 服务类型 PPP
被认证方
PAP
interface <接口> 进入接口视图link-protocol ppp 指定协议为 PPPppp pap local-user <用户名> password <cipher/plain> <密码>
CHAP
interface <接口> 进入接口视图ppp chap user <用户名>ppp chap password <cipher/plain> <密码>
DHCP
dhcp enable 开启设备 DHCP
接口 DHCP
interface <接口> 进入接口视图dhcp select interface 启用接口 DHCPdhcp server lease day <天数> hour <小时> minute <分钟> 租期dhcp server gateway-list <IP 位址> 网关位址dhcp server excluded-ip-address <开始 IP> <结束 IP> IP 位址排除范围dhcp server dns-list <IP 位址> DNS 位址
全局 DHCP
ip pool <名称> 创建 IP 池network <网段> mask <掩码> 可分配网段lease day <天数> hour <小时> minute <分钟> 租期gateway-list <IP 位址> 网关位址excluded-ip-address <开始 IP> <结束 IP> IP 位址排除范围dns-list <IP 位址> DNS 位址quit 退出视图interface <接口> 进入接口视图dhcp select global 启用全局 DHCP
IPv6
ipv6 开启 IPv6 功能interface <接口> 进入接口视图ipv6 enable 开启 IPv6
自动生成链路
ipv6 address auto link-local
手动配置位址
ipv6 address <IPv6 位址> <前缀长度>
EUI-64 方式配置位址
ipv6 address <位址前缀> <前缀长度> eui-64
NAT
静态 NAT
interface <接口> 进入接口视图nat static global <公有 IP> inside <私有 IP>
动态 NAT / NAPT
nat address-group <地址池编号> <开始 IP> <结束 IP> 创建位址池acl <ACL 编号> 创建 ACLrule <规则 ID> <permit/deny> source <源位址> <反掩码> 配置 ACLinterface <接口> 进入接口视图nat outbound <ACL 编号> address-group <位址池编号> [no-pat] 关联 ACL 与位址池
Easy-IP
acl <ACL 编号> 创建 ACLrule <规则 ID> <permit/deny> source <源位址> <反掩码> 配置 ACLinterface <接口> 进入接口视图nat outbound <ACL 编号> 配置 Easy-IP
NAT Server
interface <接口> 进入接口视图nat server protocol <协议> global <公有 IP> <服务端口号/关键字> inside <私有 IP> <服务端口号/关键字>quit 退出视图nat alg <服务> enable 开启 NAT ALG
检验检查命令
display this 显示当前视图下配置display interface eth-trunk <ID> 显示链路聚合配置display eth-trunk <ID> 显示链路聚合配置display port vlan 显示 VLAN 配置display ip interface brief 显示 IP 位址配置摘要display ip routing-table 显示路由表display stp 显示 STP 配置display stp brief 显示 STP 配置摘要display stp interface <接口> 显示接口 STP 配置display ospf interface 显示 OSPF 配置display ospf peer [brief] 显示 OSPF 邻居状态display ip routing-table protocol ospf 显示 OSPF 路由表display vrrp 显示 VRRP 配置display vrrp brief 显示 VRRP 配置摘要display vrrp interface <接口> [brief] 查看 VRRP 工作状态display acl all 查看所有 ACL 规则display ip pool 查看 DHCP 位址池display ipv6 interface <接口> 查看 IPv6 接口配置display ipv6 interface brief 查看 IPv6 配置display nat static 查看静态 NAT 配置display nat outbound 查看 NAT Outbound 配置display nat server 查看 NAT Server 配置