yl197837 发表于 2018-7-25 07:50:27

1个拓扑和15个模块带你玩华为!!

  前言:努力的人最后都不会太差!!关注博客或者加Q:1445696451一起努力!!
  首先某公司的网落拓扑(模拟)如下:

  内网边界采用华为3206系列路由器,核心层采用s5700系列三层交换,接入层使用s3700交换设备;在分公司有一台路由器。
  模块1:telnet配置(如果配置在接入层设备,如要给该接入层设备指定网关,实现不同网段可以远程telnet)
  system view                                     :进入系统视图
  telnet server enable                              :开启telnet
  interface vlanif 1                                  :进入vlanif 1
  ip address 192.168.1.1 24                     :配置地址
  user-interface vty 0 4                        :进入vty0 4模式
  authentication-mode aaa                     :认证模式设置为aaa
  aaa                                             :进入aaa模式
  local-user zhangsan password cipher pwd123      :建立用户zhangsan
  local-user zhangsan privilege level 15            :设置连接权限
  local-user zhangsan service-type telnet         :设置连接方式为telnet
  ip route-static 0.0.0.0 0 192.168.1.254             :配置一条默认路由指向网关
  模块2:ssh配置
  system view
  stelnet server enable                               :开启stelnet(也就是ssh)
  interface vlanif 1
  ip address 192.168.1.1 24
  user-interafce vty 0 4
  authentication-mode aaa
  protocol inbound ssh                              :配置连接协议
  aaa
  local-user zhangsan password cipher pwd123
  local-user zhangsan privilege level 15
  local-user zhangsan service-type ssh                :配置连接方式为ssh
  ssh user zhangsan authentication-type password:zhangsan使用password认证
  ssh user zhangsan service-type stelnet          :zhangsan使用stelnet连接
  ip route-static 0.0.0.0 0 192.168.1.254
  模块3:配置dhcp自动分配地址
  1)接口dhcp配置(接口dhcp存在一个局限性,会将接口ip当做dhcp客户端的网关;但是它的配置十分方便)
  dhcp enable                                     :开启dhcp服务
  int vlanif 1
  ip address 192.168.1.1 24
  dhcp select interface                               :dhcp查询方式为接口
  2)全局dhcp配置
  dhcp enable
  int vlanif 1
  ip address 192.168.1.1 24
  dhcp select global                              :dhcp查询方式为全局
  ip pool vlan1                                 :定义地址池
  network 192.168.1.0 mask 24                     :网段
  gateway-list 192.168.1.254                      :网关地址
  dns-list    1.1.1.1                                 :dns解析服务器地址
  excluded-ip-address 192.168.1.2               :保留地址
  lease day 1 hour 1                              :释放时间
  模块4:vlan配置
  vlan batch 2 to 10                              :创建vlan
  interface g0/0/1                                    :进入接口
  port link-type access                               :配置接口为接入模式
  port default vlan 2                           :分配vlan2给该接口
  interface g0/0/2
  port link-type trunk                              :配置接口为中继模式
  port trunk allow-pass vlan 2 3 5                  :该接口允许vlan2、3、5通信
  模块5:eth-trunk配置(相当于cisco的channel-group)
  interface eth-trunk 1                               :进入第一个eth-trunk
  trunkport g0/0/1                              :将g0/0/1接口分给eth-trunk1
  interface g0/0/2
  eth-trunk 1                                     :与上面操作一样
  模块6:静态路由配置
  ip route-static 192.168.1.0 24 192.168.2.1          :先是目标网段、而后掩码、下一跳ip地址
  模块7:ACL配置
  1)基本acl(可限制源ip,从2000~2999)
  acl 2000                                          :创建acl2000
  rule 5 deny source 192.168.1.0 0.0.0.255            :第5条拒绝192.168.1.0/24
  rule 10 permit source 192.168.0.0 0.0.255.255   :第10条允许192.168.0.0/16
  interface g0/0/1
  traffic-filterinbound acl 2000                  :设置接口为acl2000的入接口
  2)高级acl(可限制源ip、目标ip、源端口、目标端口,从3000~3999)
  acl 3000                                          :创建acl3000
  rule 5 deny tcp source 192.168.1.0 0.0.0.255 destination 172.16.0.0 0.0.255.255 destination port eq 21
  :第5条拒绝从192.168.1.0/24   到172.16.0.0/16的TCP21端口的流量。
  rule 10 permit tcp source 192.168.1.0 0.0.0.255 destination 172.16.0.0 0.0.255.255
  :第10条允许192.168.1.0/24
  到172.16.0.0的TCP流量;两者    结合起来就是允许除了TCP21 端口的其他TCP流量。
  模块8:NAT配置
  1)内网上网NAT
  acl 2000
  rule 100 permit 192.168.0.0 0.0.255.255
  interface g0/0/1                                    :进入路由器外网口
  nat outbound 2000                               :配置为acl2000的内网出口
  2)发布内网服务器的NAT
  nat static global 202.1.1.1 inside 192.168.1.253
  :配置转换202.1.1.1到192.1
  68.1.253
  nat server protocol tcp global 202.1.1.1 www inside 192.168.1.253 8080
  :访问外网202.1.1.1的www可
  映射到内网的192.168.1.253的    TCP8080端口。
  模块9:mstp二层负载分担
  stp mode mstp                                 :配置stp的模式为mstp
  stp region-configuration                            :进入mstp域视图
  region-name test                              :配置mstp域的名称
  revision-level 1                                    :配置修订级别
  instance 1 vlan 10
  instance 2 vlan 20                              :配置mstp实例,并分配vlan
  active region-configuration                     :激活配置
  stp instance 1 priority 4096
  stp instance 2 priority 8192                        :实例的优先级
  模块10:vrrp三层负载分担
  master设备:
  interface vlanif 10                           :进入vlanif10
  ip address 192.168.1.1 24                     :配置地址
  vrrp vrid 10 virtual-ip 192.168.1.254               :配置虚拟ip地址
  vrrp vrid 10 priority 150                           :优先级
  vrrp vrid 10 track interface g0/0/1 reduced 100 :端口追踪
  backup设备:
  interface vlanif 10
  ip address 192.168.1.2 24
  vrrp vrid 10 virtual-ip 192.168.1.254               :配置虚拟ip(其余不用配置,                                             vrrp中也有占先权,默认开启,                                                不用管)
  模块11:rip距离矢量路由
  rip                                             :rip模式
  version 2                                       :使用2版本
  network 192.168.1.0                           :宣告192.168.1.0/24网段
  interface g0/0/1
  rip metricin 2                                  :配置接口度量值(跳数)
  undo rip output                                 :关闭发送rip通告
  undo rip input                                  :关闭接收rip通告
  slient-interface g0/0/1                         :静默接口
  rip split-horizon                                 :水平分割
  rip poison-reverse                              :毒性逆转
  display rip                                     :查看rip配置
  default-route originate                         :分发默认路由
  模块12:ospf链路状态路由
  ospf 1 router-id 1.1.1.1                            :配置ospf的router-id
  area 0                                          :配置为area0区域
  network 192.168.1.0 0.0.0.255                   :宣告网段
  display ospf peer                               :查询ospf邻居状态
  模块13、GRE ×××
  interface tunnel 1                              :编辑1号隧道
  tunnel-protocol gre                           :隧道使用GRE协议
  ip address 192.168.1.1 30                     :隧道地址
  source 202.0.0.1                                    :隧道源(本地外网接口)地址
  destination 101.0.0.1                           :隧道对端(外网接口)地址
  ip route-static 192.168.20.0 255.255.255.0 tunnel 0/0/1                                                                     :隧道路由(目标公司的网段)
  ospf 1 router-id 1.1.1.1
  area 0
  network 192.168.10.0 0.0.0.255
  network 192.168.1.0 0.0.0.255                   :配置ospf(要让总部和分支机构网络连成一个整体,就需要互通路由。如果配置动态路由,就需要在宣告路由的时候将隧道地址也一起宣告)
  模块14、IPsec ×××
  ike proposal 2
  encryption-algorithm 3des-cbc
  authentication-algorithm MD5
  authentication-method pre-share
  dh group5
  sa duration 10000                               :定义第一阶段的安全策略
  ipsec proposal 5
  esp authentication-algorithm sha1
  esp encryption-algorithm aes-128                  :定义第二阶段的安全策略
  ike peer to-fenzhi v1                               :定义对等集信息(to-fenzhi为名称)
  pre-shared-key simple 123456                  :设置协商密钥,两端需一致
  remote-address 202.1.1.1                        :对端的外网接口地址
  acl 3000
  rule permit ip source 10.0.0.0 0.255.255.255 destination 20.0.0.0 0.255.255.255                                                 :设置acl3000定义感兴趣的数                                             据流(也就是需要通过隧道的                                             数据流)
  ipsec policy abc 10 isakmp                      :定义使用IKE协商IPsec
  security acl 3000                                 :调用acl3000
  ike-peer to-fenzhi                              :调用对等体集
  proposal 5                                    :调用第二阶段
  interface g0/0/0
  ipsec policy abc                                    :在接口调用IPsec策略
  acl 3001
  rule 100 deny ip source 10.0.0.1 0.255.255.255 destination 20.0.0.1 0.255.255.255
  rule 200 permit ip source 10.0.0.0 0.255.255.255 destination any
  :配置一条上网3001(拒绝转 换需要通过隧道的数据流,允许其他所有)
  interface g0/0/0
  nat outbound 3001                               :将外网接口设置为nat转换的                                             接口
  模块15(重点模块):display命令的使用。(display相当于cisco的show命令,我粗略的数了一下,华为3260路由器的系统视图下“display?”,大概有254个对象,可见这个命令多么重要。但是我们只需掌握一些常用的即可。简单举例出我日常的总结)
  display this                                        :常用命令,查看当前视图、模                                              式下的配置
  display current-configuration                     :查看当前配置
  display saving-configuration                        :查看以保存配置
  display aaa                                     :查看aaa认证配置
  display acl number                              :acl规则
  display dhcp                                        :dhcp配置
  display eth-trunk number                        :eth-trunk口下配置
  display firewall group                        :防火墙相关
  display interface g|e//                      :接口下配置
  display ipsec                                  :查看ipsec相关
  display lldp neighbor brief                     :查看lldp邻接
  display mac-address                           :mac地址
  display ospf 1 *                                    :ospf相关
  display vrrp                                    :vrrp信息
  display vlan brief                              :查看vlan信息
  display ip routing-table                            :查看路由表
页: [1]
查看完整版本: 1个拓扑和15个模块带你玩华为!!