侧边栏壁纸
博主头像
ERSHI的个人网站

记录一下

  • 累计撰写 2 篇文章
  • 累计创建 5 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

网络设备基础操作复习

ERSHI
2025-02-17 / 0 评论 / 0 点赞 / 37 阅读 / 0 字

网络设备基础操作复习

以下是思科模拟器中网络设备操作的整理指南,按模块化分类便于操作:
(注:基于海峡出版发行集团的《福建省中职复习丛书-计算机类》网络设备操作部分)

一、模式切换

用户模式 (User EXEC) 切换到特权模式:  
Router> enable  

特权模式 (Privileged EXEC) 切换到全局配置模式:  
Router# configure terminal  

全局配置模式 (Global Configuration) 返回特权模式:  
Router(config)# exit  

直接退出到特权模式 (快捷键):  
Router(config)# [Ctrl+Z]  

二、VLAN 设置

  1. 创建 VLAN
   Switch(config)# vlan 10
   Switch(config-vlan)# name vlan10
  1. 查看 VLAN
   Switch# show vlan brief

三、端口配置

  1. 配置端口 IP(路由端口)

    Router(config)# interface GigabitEthernet0/0
    Router(config-if)# ip address 192.168.1.1 255.255.255.0
    Router(config-if)# no shutdown
    
  2. 修改端口模式(交换端口)

    Switch(config)# interface FastEthernet0/1
    Switch(config-if)# switchport mode access      # Access 模式
    Switch(config-if)# switchport mode trunk       # Trunk 模式
    
  3. 绑定 VLAN

    Switch(config-if)# switchport access vlan 10   # Access 端口绑定 VLAN 10
    
  4. 添加端口注释

    Switch(config-if)# description "Connected to PC1"
    

四、单臂路由(Router-on-a-Stick)

  1. 配置子接口
    Router(config)# interface GigabitEthernet0/0.10
    Router(config-subif)# encapsulation dot1Q 10  # 封装 VLAN 10
    Router(config-subif)# ip address 192.168.10.1 255.255.255.0
    
  2. 启用物理接口
    Router(config)# interface GigabitEthernet0/0
    Router(config-if)# no shutdown
    

五、路由协议配置

  1. 静态路由
    Router(config)# ip route 192.168.2.0 255.255.255.0 10.0.0.2  # 目标网段+下一跳
    Router(config)# ip route 192.168.2.0 255.255.255.0 FastEthernet0/1 # 目标网段+端口类型
    
  2. 缺省路由
    Router(config)# ip route 0.0.0.0 0.0.0.0 10.0.0.1
    
  3. RIPv2 路由
    Router(config)# router rip
    Router(config-router)# version 2
    Router(config-router)# no auto-summary
    Router(config-router)# network 192.168.1.0
    
  4. OSPF 路由
    Router(config)# router ospf 1
    Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
    

六、路由重分布(Redistribution)

  1. 静态路由重分布到 OSPF

    Router(config-router)# redistribute static subnets
    
  2. OSPF 重分布到 RIP

    Router(config-router)# redistribute ospf 1 metric 5
    
  3. RIP 重分布到 OSPF

    Router(config-router)# redistribute rip subnets
    

七、密码与安全配置

  1. Console 密码

    Router(config)# line console 0
    Router(config-line)# password cisco
    Router(config-line)# login
    
  2. 远程登录(VTY)密码

    Router(config)# line vty 0 4
    Router(config-line)# password telnet123
    Router(config-line)# login
    
  3. 本地用户密码(加密)

    Router(config)# username admin secret mypassword
    

八、DHCP服务配置(更新:添加地址排除)

# █ 第一步:排除指定IP范围(需在创建地址池前配置)
Router(config)# ip dhcp excluded-address 192.168.1.20 192.168.1.100  # 排除20-100的地址

# █ 第二步:创建DHCP地址池并分配参数
Router(config)# ip dhcp pool LAN_POOL
Router(dhcp-config)# network 192.168.1.0 255.255.255.0  # 定义地址池范围
Router(dhcp-config)# default-router 192.168.1.1        # 指定默认网关
Router(dhcp-config)# dns-server 8.8.8.8              # 设置DNS服务器

验证命令

# 查看已排除的地址段
Router# show ip dhcp excluded-addresses
  Exclusion range: 192.168.1.20 - 192.168.1.100

# 查看地址池分配情况
Router# show ip dhcp pool LAN_POOL
  Pool LAN_POOL :
    Utilization mark (high/low) : 100% / 0%
    Subnet size (first/next) : 0 / 0
    Total addresses : 254
    Leased addresses : 0
    Pending event : none
    #---- 关键输出 ----
    1 subnet is currently in the pool :
    Current index        IP address range                    Leased/Excluded/Total
    192.168.1.1          192.168.1.1    - 192.168.1.254      0     81 / 254

配置说明

  1. 排除逻辑

    • excluded-address命令需在ip dhcp pool前配置
    • 可排除单个IP(如ip dhcp excluded-address 192.168.1.5)或连续范围
    • 被排除的地址不会被自动分配给客户端(常预留用于服务器、打印机等静态设备)
  2. 完整流程示例

    # 需求:
    # 原网络:192.168.1.0/24
    # 排除地址:192.168.1.1(网关) + 192.168.1.201-254(其他用途)
    
    Router(config)# ip dhcp excluded-address 192.168.1.1          # 排除网关
    Router(config)# ip dhcp excluded-address 192.168.1.201 192.168.1.254
    Router(config)# ip dhcp pool OFFICE_POOL
    Router(dhcp-config)# network 192.168.1.0 255.255.255.0
    Router(dhcp-config)# default-router 192.168.1.1
    # 此时分配的IP范围为:192.168.1.2 - 192.168.1.200
    

常见问题

Q1:为什么排除配置后某些地址仍被分配?
→ 检查命令是否在ip dhcp pool之前配置,且地址范围未冲突。

Q2:如何保留多个不连续IP段?
→ 多次执行ip dhcp excluded-address命令:

Router(config)# ip dhcp excluded-address 192.168.1.10
Router(config)# ip dhcp excluded-address 192.168.1.50 192.168.1.60


九、PPP协议配置

  1. PPP基础链路配置(封装PPP协议)
    在需要配置PPP的串口或广域网接口上启用PPP封装:

    Router(config)# interface Serial0/0/0
    Router(config-if)# encapsulation ppp		# 必须步骤:将接口封装为PPP协议
    Router(config-if)# no shutdown
    
  2. PAP验证配置(单向认证)
    步骤1:服务端配置(被认证方)

    Router(config)# username Client1 password Cisco123		# 存储客户端用户名密码
    Router(config)# interface Serial0/0/0
    Router(config-if)# ppp authentication pap		# 启用PAP认证(作为服务端)
    

    步骤2:客户端配置(主动发送认证)

    Router(config)# interface Serial0/0/0
    Router(config-if)# ppp pap sent-username Client1 password Cisco123	# 发送认证信息
    
  3. CHAP双向认证配置
    步骤1:双方配置用户名密码(必须互设对方用户名)

    RouterA(config)# username RouterB password Cisco123		# 本端名需要与对方配置的用户名匹配
    RouterB(config)# username RouterA password Cisco123		# 两端的密码必须一致
    

    步骤2:接口启用CHAP

    RouterA(config)# interface Serial0/0/0
    RouterA(config-if)# ppp authentication chap		# 两端均需配置此命令
    
  4. CHAP单向认证(一端认证对端)
    场景:RouterA需要认证RouterB,但RouterB不需要认证RouterA

    RouterA(config)# username RouterB password Cisco123		# 仅A端存储B的用户名
    RouterA(config)# interface Serial0/0/0
    RouterA(config-if)# ppp authentication chap		# A端开启认证
    
    RouterB(config)# interface Serial0/0/0
    RouterB(config-if)# ppp chap hostname RouterB		# 声明本端主机名(与A存储的用户名匹配)
    RouterB(config-if)# ppp chap password Cisco123		# 提供密码(必须与A端存储的密码一致)
    

关键验证命令

# 查看PPP会话状态
Router# show interface serial0/0/0	
# 输出中包含 "LCP Open" 和 "IPCP Open" 表示PPP协商成功

0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区