【软考网络工程师】华为路由器&交换机配置

写在前面

还有几天就软考了,考个证混混分。

ENSP工具版本: v1.2.00.510

DHCP

案例

目的: 对交换机配置DHCP,实现PC自动获取IP地址。

设备概述: 设置两个vlan,分别为vlan10 和 vlan 20。然后将两个PC分别划分到两个vlan里。设置两个交换机S5700,分别为辅助交换机(acsw)和核心交换机(coresw)。

拓扑

DHCP拓扑

具体配置过程

acsw:

<Huawei>system-view
[Huawei]undo info-center enable // 关闭日志通知
[Huawei]sysname acsw
[acsw]vlan batch 10 20
[acsw]int g0/0/1 // 有些地方命令直接简写执行了,勿喷
[acsw-GigabitEthernet0/0/1]port link-type access // 配置acsw与PC1连接方式为access
[acsw-GigabitEthernet0/0/1]port default vlan 10 // 默认vlan为vlan 10
[acsw-GigabitEthernet0/0/1]quit
[acsw]int g0/0/2
[acsw-GigabitEthernet0/0/2]port link-type access
[acsw-GigabitEthernet0/0/2]port default vlan 20
[acsw-GigabitEthernet0/0/2]quit
[acsw]int g0/0/3
[acsw-GigabitEthernet0/0/3]port link-type trunk 
[acsw-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20
[acsw-GigabitEthernet0/0/3]q

PC1:

PC1DHCP模式

PC2:

PC2DHCP模式

coresw:

<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname coresw
[coresw]vlan batch 10 20
[coresw]int g0/0/1
[coresw-GigabitEthernet0/0/1]port link-type trunk
[coresw-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[coresw-GigabitEthernet0/0/1]q
[coresw]dhcp enable
[coresw]ip pool vlan10
[coresw-ip-pool-vlan20]? // 这里看一下都有那些选项可以配置
ip-pool view commands:
  configuration        Configuration interlock
  display              Display current system information
  dns-list             Configure DNS servers
  domain-name          Configure domain name 
  excluded-ip-address  Mark disable IP addresses 
  gateway-list         Configure the gateway
  lease                Configure the lease of the IP pool
  lock                 Lock the IP pool
  mtrace               Trace route to multicast source
  nbns-list            Configure the windows's netbios name servers 
  netbios-type         Netbios node type
  network              Add a network
  next-server          The address of the server to use in the next step of the
                       client's bootstrap process.
  option               Configure the DHCP options
  option121            DHCP option 121 
  option184            DHCP option 184
  ping                 Send echo messages
  quit                 Exit from current command view
  reset                Reset operation
  return               Exit to user view
  screen-width         Set screen width
  set                  Set
  stack                Stack 
  static-bind          Static bind
  test-aaa             Accounts test
  trace                Trace route (switch) to host on Data Link Layer
  tracert              Trace route to host
  undo                 Cancel current configuration
  vpn-instance         Config VPN instance

[coresw-ip-pool-vlan10]network 192.168.10.0 mask 24
[coresw-ip-pool-vlan10]gateway-list 192.168.10.254 // 设置vlan10的网关
[coresw-ip-pool-vlan10]excluded-ip-address 192.168.10.150 192.168.10.200 // 设置不用于分配的IP范围
[coresw-ip-pool-vlan10]lease day 3 // 也可以同时设置 hour、minute
[coresw-ip-pool-vlan10]dns-list 8.8.8.8 // 由于用不到DNS,就随便配了
[coresw-ip-pool-vlan10]q
[coresw]interface vlanif 10
[coresw-Vlanif10]ip address 192.168.10.254 24
[coresw-Vlanif10]q
[coresw]int Vlanif 20
[coresw-Vlanif20]ip address 192.168.20.254 24
[coresw-Vlanif20]q
[coresw]ip pool vlan20
[coresw-ip-pool-vlan20]network 192.168.20.0 mask 24
[coresw-ip-pool-vlan20]gateway-list 192.168.20.254
[coresw-ip-pool-vlan20]dns-list 8.8.8.8
[coresw-ip-pool-vlan20]excluded-ip-address 192.168.20.150 192.168.20.200 
[coresw-ip-pool-vlan20]lease day 3
[coresw-ip-pool-vlan20]q
[coresw]int vlanif 10
[coresw-Vlanif10]dhcp select global // 选择全局地址池
[coresw-Vlanif10]q
[coresw]int vlanif 20
[coresw-Vlanif20]dhcp select global
[coresw-Vlanif20]q

检验

在PC1终端中输入ipconfig,可以看到华为DHCP默认将最大的可分配IP分配给当前主机:192.168.10.253

PC1分配地址

PC2同理:

PC2分配地址

ACL

案例

要求:

ACL要求

设备概述:

设置两台PC,分别属于不同子网,要求PC1所在子网不得访问服务器,PC2所在子网可以访问服务器。同时外界网络无法访问服务器。设置一台服务器。设置两台路由器AR2220。其中AR2220端口不够的可以自行添加:

ACLAR2220添加端口

拓扑

ACL拓扑

具体配置过程

PC1:

ACLPC1配置

PC2:

ACLPC2配置

Server1:

ACLServer1配置

AR1:

<Huawei>system-view
[Huawei]sysname AR1
[AR1]undo info-center enable
[AR1]display acl all // 查看所有acl规则
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.2.254 24
[AR1-GigabitEthernet0/0/0]q
[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip address 192.168.3.254 24
[AR1-GigabitEthernet0/0/1]q
[AR1]int g4/0/0
[AR1-GigabitEthernet4/0/0]ip address 10.10.10.1 24
[AR1-GigabitEthernet4/0/0]q
[AR1]acl 3000 // 2000-2999为基础acl配置,3000-3999为高级acl配置	
[AR1-acl-adv-3000]rule 10 deny ip source 192.168.2.0 0.0.0.255 destination 192.1
68.4.4 0 // 不允许子网192.168.2.0/24访问金融服务器
[AR1-acl-adv-3000]rule 20 permit ip source 192.168.3.0 0.0.0.255 destination 192
.168.4.4 0 // 允许子网192.168.3.0/24访问金融服务器
[AR1-acl-adv-3000]rule 30 deny ip source any destination 192.168.4.4 0 // 在前面的规则都不匹配时,不允许任何源ip访问服务器
[AR1-acl-adv-3000]q
[AR1]int g0/0/2
[AR1-GigabitEthernet0/0/2]ip address 192.168.4.254 24
[AR1-GigabitEthernet0/0/2]traffic-filter outbound acl 3000
[AR1-GigabitEthernet0/0/2]q
[AR1]display acl all // 可以验证acl规则是否配置成功
 Total quantity of nonempty ACL number is 1 

Advanced ACL 3000, 3 rules
Acl's step is 5
 rule 10 deny ip source 192.168.2.0 0.0.0.255 destination 192.168.4.4 0 (4 match
es)
 rule 20 permit ip source 192.168.3.0 0.0.0.255 destination 192.168.4.4 0 (5 mat
ches)
 rule 30 deny ip destination 192.168.4.4 0 

[AR1]

AR2:

<Huawei>system-view
[Huawei]undo info-center enable
[Huawei]sysname AR2
[AR2]int g0/0/
专题一. 交换机与路由器的基本配置 交换机的基本配置 C2950# config terminal 进入全局配置模式 show interface fastethernet0/1 查看端口0/1的配置结果 show interface fastethernet0/1 status 查看端口0/1的状态 show mac-address-table 查看整个MAC地址表 clear mac-address-table restricted static 清除限定性地址 C2950(config)# hostname 2950A 设置主机名为2950A interface f0/23 进入端口23的配置模式 enable password cisco 设置enable password为cisco enable secret cisco1 设置enable secret为cisco1 ip address 192.168.1.1 255.255.255.0 设置交换机IP地址 ip default-gateway 192.168.1.254 设置默认网关 ip domain-name cisco.com 设置域名 ip name-server 200.0.0.1 设置域名服务器 mac-address-table aging-time 100 设置超时是时间为100s mac-address-table permanent 0000.0c01.cc f0/3 加入永久地址 mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址 C2950(config-if)#speed ? 查看speed命令的子命令 speed 100 设置该端口速率为100Mb/s dulplex full/half/auto 设置该端口为全双工 description TO_PC1 设置该端口描述为TO_PC1 二.路由器的基本配置 interface fastethernet0/1 进入接口F0/1子配置模式 interface Ethernet0 进入以太网口0子配置模式 no shutdown 激活接口 ip address 192.168.1.2 255.255.255.0 设置接口的IP地址 show running-config 检查配置结果 show sessions 查看终端服务器的会话 专题二 配置VTP和STP 一. 配置VTP 2950A #vlan database 进入VLAN配置子模式 show vtp status 查看VTP设置信息 show vlan 查看VLAN配置信息 copy running-config startup-config 保存配置文件 2950A(vlan)#vtp server/client 设置本交换机为server/client模式 vtp pruning 启动修剪功能 vtp domain vtpserver 设置域名 vlan 2 创建VLAN2,系统将自动命名
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TurkeyMan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值