肥仔教程网

SEO 优化与 Web 开发技术学习分享平台

锐捷网络设备常用命令整理(交换机、路由器、防火墙)

一、基础命令

  1. 模式切换
   enable                  # 进入特权模式
   configure terminal      # 进入全局配置模式
   exit                    # 返回上一级模式
   end                     # 直接退出到特权模式
  1. 查看配置
   show running-config     # 查看当前运行配置
   show startup-config     # 查看启动配置
   show version            # 查看设备版本信息
   show interface [接口名]  # 查看接口状态(如 GigabitEthernet 0/1)
  1. 保存配置
   write                   # 保存配置到启动文件

二、交换机常用命令

1. VLAN 配置

vlan [VLAN ID]            # 创建 VLAN
name [VLAN名称]           # 为 VLAN 命名
interface vlan [VLAN ID]  # 进入 VLAN 接口配置模式
  ip address [IP] [掩码]   # 配置 VLAN 接口 IP(用于三层交换)
exit

# 将端口加入 VLAN
interface [接口名]         # 进入接口配置模式(如 GigabitEthernet 0/1)
  switchport mode access  # 设置为接入模式
  switchport access vlan [VLAN ID]  # 将端口加入指定 VLAN
  switchport mode trunk   # 设置为 Trunk 模式
  switchport trunk allowed vlan [VLAN列表]  # 允许 Trunk 通过的 VLAN(如 10,20)

2. 生成树协议(STP/MSTP)

spanning-tree mode mstp   # 启用 MSTP 模式
spanning-tree mst configuration
  instance 1 vlan 10,20   # 将 VLAN 映射到实例
exit

3. 端口聚合(LACP)

interface range [端口列表]  # 选中多个端口(如 GigabitEthernet 0/1-2)
  channel-group [组号] mode active  # 创建聚合组(LACP)
exit
interface port-channel [组号]  # 进入聚合接口配置
  switchport mode trunk      # 配置聚合接口为 Trunk

4. 端口安全

interface [接口名]
  port-security enable       # 启用端口安全
  port-security max-mac-count [数量]  # 限制最大 MAC 地址数

三、路由器常用命令

1. 接口 IP 配置

interface [接口名]          # 进入接口配置(如 FastEthernet 0/0)
  ip address [IP] [掩码]    # 配置接口 IP
  no shutdown              # 启用接口

2. 静态路由

ip route [目标网络] [掩码] [下一跳IP/出接口]  # 添加静态路由

3. 动态路由协议(OSPF)

router ospf [进程号]        # 启用 OSPF 进程
  network [网络地址] [反掩码] area [区域号]  # 宣告网络

4. NAT 配置

# 配置 NAT 地址池
ip nat pool [池名] [起始IP] [结束IP] netmask [掩码]

# 配置 NAT 规则(PAT)
ip nat inside source list [ACL号] pool [池名] overload
interface [内网接口]
  ip nat inside
interface [外网接口]
  ip nat outside

四、防火墙常用命令

1. 安全区域(Zone)

zone [区域名]              # 创建安全区域(如 trust、untrust)
  add interface [接口名]    # 将接口加入区域

2. 安全策略

policy from [源区域] to [目标区域]  # 创建策略
  action permit            # 允许流量
  service [服务名]         # 指定服务(如 HTTP、ICMP)
  exit

3. ACL 配置

ip access-list extended [ACL名称]  # 创建扩展 ACL
  permit ip [源IP] [目标IP]       # 允许特定流量
  deny ip any any              # 拒绝其他流量

4. VPN 配置(IPSec)

# 配置 IPSec 提议
ipsec proposal [提议名]
  esp encryption aes       # 设置加密算法
  esp authentication sha1  # 设置认证算法
exit

# 配置隧道接口
interface tunnel [编号]
  tunnel source [接口/IP]  # 隧道源地址
  tunnel destination [IP]  # 隧道目标地址

五、高级功能

1. QoS 配置

class-map [类名]           # 定义流量分类
  match access-group [ACL号]
policy-map [策略名]        # 定义 QoS 策略
  class [类名]
    bandwidth [百分比]      # 分配带宽
interface [接口名]
  service-policy [策略名]  # 应用策略到接口

2. SNMP 配置

snmp-server community [团体名] ro  # 配置只读团体名
snmp-server host [IP] [团体名]    # 指定 SNMP 管理服务器

3. 日志管理

logging host [IP]          # 配置日志服务器
logging trap informational # 设置日志级别

六、故障排查

ping [IP]                 # 测试连通性
traceroute [IP]           # 追踪路径
show arp                  # 查看 ARP 表
show mac-address-table    # 查看 MAC 地址表(交换机)
show ip route             # 查看路由表
show log                  # 查看日志
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
最新留言