cisco路由器综合实验之多项技术综合应用_vlan 

 


配置中继和以太网通道:
SW1:(config)#int  range  f0/0 -1          SW2:(config)#int  range  f0/0 -1          SW3:(config)#int  range  f0/0 -1
       (-if)#switchport  mode  trunk             (-if)#switchport  mode  trunk             (-if)#switchport  mode  trunk
       (-if)#no  sh                              (-if)#no  sh                              (-if)#no  sh
    (config)#int  range  f0/14 -15            (config)#int  range  f0/14 -15            (config)#int  range  f0/14 -15
       (-if)#switchport  mode  trunk             (-if)#switchport  mode  trunk             (-if)#switchport  mode  trunk
       (-if)#channel-group  1  mode  on          (-if)#channel-group  1  mode  on          (-if)#no  sh
       (-if)#no  sh                              (-if)#no  sh                             
 -------------------------------------    ----------------------------------------  -------------------------------------
SW4:(config)#int  range  f0/0 -1          SW5:(config)#int  f0/14                  SW6:(config)#int  f0/15
       (-if)#switchport  mode  trunk             (-if)#switchport  mode  trunk            (-if)#switchport  mode  trunk
       (-if)#no  sh                              (-if)#no  sh                             (-if)#no  sh  
=========================================================================================================================

配置 VTP 域
SW3:                              SW5:                               SW6:
       #vlan database                   #vlan database                     #vlan database
 (vlan)#vtp  domain  benet1       (vlan)#vtp  domain  benet1         (vlan)#vtp  domain  benet1
 (vlan)#vtp  server               (vlan)#vtp  client                 (vlan)#vtp  client
 (vlan)#vtp  password  test       (vlan)#vtp  password  test         (vlan)#vtp  password  test
 (vlan)#vtp  pruning
 ---------------------------     ----------------------------       ----------------------------
SW1:                              SW2:                               SW4:
       #vlan database                   #vlan database                     #vlan database
 (vlan)#vtp  domain  benet2       (vlan)#vtp  domain  benet2         (vlan)#vtp  domain  benet2
 (vlan)#vtp  server               (vlan)#vtp  client                 (vlan)#vtp  client
 (vlan)#vtp  password  test       (vlan)#vtp  password  test         (vlan)#vtp  password  test
 (vlan)#vtp  pruning
========================================================================================================================

添加vlan:
SW3:                                  SW1:                              
       #vlan database                         #vlan database                   
 (vlan)#vlan  550  name  ssl-bd01       (vlan)#vlan  2  name  server        
 (vlan)#vlan  551  name  ssl-bd02       (vlan)#vlan  50 name  network
========================================================================================================================

配置STP:
SW1:                                                       SW2:
 (config)#spanning-tree  vlan  50  root  primary            (config)#spanning-tree  vlan  2   root  primary
 (config)#spanning-tree  vlan  2   root  secondary          (config)#spanning-tree  vlan  50  root  secondary     
========================================================================================================================

配置vlan的ip地址:
SW3:                                                 SW4:
 (config)#int  vlan  1                                  (config)#int  vlan  1
  (-vlan)#ip add 10.255.50.10 255.255.255.0              (-vlan)#ip add 10.255.50.55 255.255.255.0
  (-vlan)#no sh                                          (-vlan)#no sh
                                                     ------------------------------------------------
 (config)#int  vlan  550                              SW5:
  (-vlan)#ip add 10.80.255.254 255.255.255.0            (config)#int  vlan  1
  (-vlan)#no sh                                          (-vlan)#ip add 10.255.50.80 255.255.255.0
                                                         (-vlan)#no sh
                                                         (config)#ip  default-gateway  10.255.50.10
 (config)#int  vlan  551                             ------------------------------------------------
  (-vlan)#ip add 10.81.255.254 255.255.255.0          SW6:
  (-vlan)#no sh                                         (config)#int  vlan  1
                                                         (-vlan)#ip add 10.255.50.81 255.255.255.0
                                                         (-vlan)#no sh
                                                         (config)#ip  default-gateway  10.255.50.10
========================================================================================================================
配置HSRP:
SW1:                                                    SW2:
 (config)#int  vlan  50                                   (config)#int  vlan  2
  (-vlan)#ip add 10.255.1.1 255.255.255.0                  (-vlan)#ip add 10.0.0.2 255.255.255.0
  (-vlan)#standby  50  ip  10.255.1.254                    (-vlan)#standby  2  ip  10.0.0.254
  (-vlan)#standby  50  primority  150                      (-vlan)#standby  2  primority  150
  (-vlan)#standby  50  preempt                             (-vlan)#standby  2  preempt
  (-vlan)#standby  50  track  f0/0  60                     (-vlan)#standby  2  track  f0/0  60
  (-vlan)#no  sh                                           (-vlan)#no  sh
 ------------------------------------------             ---------------------------------------------
SW1:                                                    SW2:
 (config)#int  vlan  2                                    (config)#int  vlan  50
  (-vlan)#ip add 10.0.0.1 255.255.255.0                    (-vlan)#ip add 10.255.1.2 255.255.255.0
  (-vlan)#standby  2  ip  10.0.0.254                       (-vlan)#standby  50  ip  10.255.1.254
  (-vlan)#standby  2  primority  150                       (-vlan)#standby  50  primority  150
  (-vlan)#standby  2  preempt                              (-vlan)#standby  50  preempt
  (-vlan)#standby  2  track  f0/0  60                      (-vlan)#standby  50  track  f0/0  60
  (-vlan)#no  sh                                           (-vlan)#no  sh
 ------------------------------------------             ---------------------------------------------

关于 SW1 和 SW2 上的 Vlan1 的配置存在两种理解:
 1.配置HSRP,可以使用 SW1 作为 vlan 1 的活跃路由器,SW2 作为 vlan 1 的备份路由器
 2.不配置 HSRP,因为不存在 vlan 1 的主机,而且在SW3上配置浮动路由的时候也需要两个下一跳地址。建议不配置

SW1:                                                    SW2:
 (config)#int  vlan  1                                    (config)#int  vlan  1
  (-vlan)#ip add 10.255.50.1 255.255.255.0                    (-vlan)#ip add 10.255.50.2 255.255.255.0
  (-vlan)#no  sh                                           (-vlan)#no  sh
========================================================================================================================

路由条目配置:

SW3: 配置默认路由不是最佳方案,因为 SW1 和 SW2 上存在 HSRP 的配置,不好将所有的访问都集中在某一台交换机上
     所以建议配置静态的浮动路由

  (config)#ip  route  10.255.1.0  255.255.255.0  10.255.50.1
  (config)#ip  route  10.255.1.0  255.255.255.0  10.255.50.2  50

  (config)#ip  route  10.0.0.0  255.255.255.0  10.255.50.2
  (config)#ip  route  10.0.0.0  255.255.255.0  10.255.50.1  50
 -------------------------------------------------------------------
SW1:
  (config)#ip  route  10.80.0.0  255.255.0.0  10.255.50.10
  (config)#ip  route  10.81.0.0  255.255.0.0  10.255.50.10
 -------------------------------------------------------------------
SW2:
  (config)#ip  route  10.80.0.0  255.255.0.0  10.255.50.10
  (config)#ip  route  10.81.0.0  255.255.0.0  10.255.50.10
=========================================================================================================================

配置各个交换机的console控制台管理和远程管理:
以SW1为例,其余略

 (config)#enable  secret  testbenet
 (config)#line  vty  0 4                      (config)#line  console  0
  (-line)#password  benettest                  (-line)#password  benettest
  (-line)#loggin                               (-line)#loggin
=========================================================================================================================

ACL配置:
SW3:
 (config)#access-list  100  permit  ip  10.80.0.0 0.0.255.255  10.0.0.0 0.0.0.255
 (config)#access-list  101  permit  ip  10.80.0.0 0.0.255.255  10.0.0.0 0.0.0.255
 (config)#access-list  1  permit  10.255.1.0 0.0.0.255

 (config)#int  vlan  550                         (config)#int  vlan  551                   
  (-vlan)#ip  access-group  100  in               (-vlan)#ip  access-group  101  in

 (config)#line  vty  0 4
  (-line)#access-class  1  in
 -----------------------------------------------------------------------------------
SW1:
 (config)#access-list  1  permit  10.255.1.0 0.0.0.255
 (config)#line  vty  0 4
  (-line)#access-class  1  in
 -----------------------------------------------------------------------------------
SW2:
 (config)#access-list  1  permit  10.255.1.0 0.0.0.255
 (config)#line  vty  0 4
  (-line)#access-class  1  in
 -----------------------------------------------------------------------------------
SW4:
 (config)#access-list  1  permit  10.255.1.0 0.0.0.255
 (config)#line  vty  0 4
  (-line)#access-class  1  in
 -----------------------------------------------------------------------------------
SW5:
 (config)#access-list  1  permit  10.255.1.0 0.0.0.255
 (config)#line  vty  0 4
  (-line)#access-class  1  in
 -----------------------------------------------------------------------------------
SW6:
 (config)#access-list  1  permit  10.255.1.0 0.0.0.255
 (config)#line  vty  0 4
  (-line)#access-class  1  in
=========================================================================================================================