交換機的配置

  在網際網路使用者的大量增加和網路的發展,核心交換機的架構也在不斷的發展和改進,交換架構主要經歷了匯流排型和CrossBar兩個階段。下面是小編收集整理的,希望對大家有幫助~~

  

  switch>en switch#configureterminalswitch***conf***#hostnameaptech-2950aptech2950***conf***#enablepasswordcisco以cisco為特權模式密碼aptech2950***conf***#interfacefastethernet0/1以17埠為telnet遠端登入埠aptech2950***conf-if***#ipaddress192.168.1.1255.255.255.0aptech2950***conf-if***#noshutaptech2950***conf-if***#exitaptech2950***conf***linevty04設定0-4個使用者可以telnet遠端登陸aptech2950***conf-line***#loginaptech2950***conf-line***#passwordedge以edge為遠端登入的使用者密碼

  Switch>使用者模式

  1.進入特權模式enable

  Switch>enable

  2.進入全域性配置模式

  Switch#configture terminal

  Switch ***conf***#

  3.交換機命名:

  Switch#configture terminal

  Switch ***conf***#

  Switch ***conf***#hostname mycisco

  Mycisco***conf***#

  4.配置使能命令:

  switch>enable

  switch#configure terminal

  switch***conf***#hostname aptch2950

  aptech2950***conf***#enable secret ciscolab

  5.建立VLAN

  Switch #config t

  Switch***conf***# vlan 2

  Switch***conf***# vlan 3

  Switch***conf***# vlan 4

  Switch***conf*** interface f0/2

  Switch mode access

  Switch access vlan2

  Exit

  No shutdown

  # int f0/23

  # sw mode trunk

  # sw trunk enca dot1q

  5.設定VLAN

  Switch>enable

  Switch# conf t

  Switch***conf***# hostname cisco

  Cisco***conf***# interface vlan 2

  #ip address 192.168.1.1 255.255.255.0

  Exit

  設定方法

  一臺3550EMI交換機,劃分三個vlan

  vlan2為伺服器所在網路,命名為server,IP地址段為192.168.2.0,子網掩碼:255.255.255.0,網

  關:192.168.2.1,域伺服器為windows 2000 advance server,同時兼作DNS伺服器,IP地址為192.168.2.10

  vlan3為客戶機1所在網路,IP地址段為192.168.3.0,子網掩碼:255.255.255.0,閘道器:192.168.3.1命名為

  work01

  vlan4為客戶機2所在網路,命名為work02,IP地址段為192.168.4.0,子網掩碼:255.255.255.0,網

  關:192.168.4.1,

  3550作DHCP伺服器,埠1-8劃到VLAN 2,埠9-16劃分到VLAN 3,埠17-24劃分到VLAN 4.

  DHCP伺服器實現功能:

  各VLAN保留2-10的IP地址不分配置,例如:192.168.2.0的網段,保留192.168.2.2至192.168.2.10的IP地址

  段不分配.

  安全要求:

  VLAN 3和VLAN 4不允許互相訪問,但都可以訪問伺服器所在的VLAN2,

  預設訪問控制列表的規則是拒絕所有包.

  配置命令及步驟如下:

  第一步:建立VLAN:

  Switch>en

  Switch#Vlan Database

  Switch***Vlan***>Vlan 2 Name server

  Switch***Vlan***>Vlan 3 Name work01

  Switch***vlan***>Vlan 4 Name work02

  第二步:設定VLAN IP地址:

  Switch#Config T

  Switch***Config***>Int Vlan 2

  Switch***Config-vlan***Ip Address 192.168.2.1255.255.255.0

  Switch***Config-vlan***No Shut

  Switch***Config-vlan***>Int Vlan 3

  Switch***Config-vlan***Ip Address 192.168.3.1255.255.255.0

  Switch***Config-vlan***No Shut

  Switch***Config-vlan***>Int Vlan 4

  Switch***Config-vlan***Ip Address 192.168.4.1255.255.255.0

  Switch***Config-vlan***No Shut

  Switch***Config-vlan***Exit

  /*注意:由於此時沒有將埠分配置到VLAN2,3,4,所以各VLAN會DOWN掉,待將埠分配到各VLAN後,VLAN會起來*/

  第三步:設定埠全域性引數

  Switch***Config***Interface Range Fa 0/1 - 24

  Switch***Config-if-range***Switchport ModeAccess

  Switch***Config-if-range***Spanning-treePortfast

  第四步:將埠新增到VLAN2,3,4中

  /*將埠1-8新增到VLAN 2*/

  Switch***Config***Interface Range Fa 0/1 - 8

  Switch***Config-if-range***Switchport AccessVlan 2

  /*將埠9-16新增到VLAN 3*/

  Switch***Config***Interface Range Fa 0/9 - 16

  Switch***Config-if-range***Switchport AccessVlan 3

  /*將埠17-24新增到VLAN 4*/

  Switch***Config***Interface Range Fa 0/17 - 24

  Switch***Config-if-range***Switchport AccessVlan 4

  Switch***Config-if-range***Exit

  /*經過這一步後,各VLAN會起來*/

  第五步:配置3550作為DHCP伺服器

  /*VLAN 2可用地址池和相應引數的配置,有幾個VLAN要設幾個地址池*/

  Switch***Config***Ip Dhcp Pool Test01

  /*設定可分配的子網*/

  Switch***Config-pool***Network 192.168.2.0255.255.255.0

  /*設定DNS伺服器*/

  Switch***Config-pool***Dns-server 192.168.2.10

  /*設定該子網的閘道器*/

  Switch***Config-pool***Default-router192.168.2.1

  /*配置VLAN 3所用的地址池和相應引數*/

  Switch***Config***Ip Dhcp Pool Test02

  Switch***Config-pool***Network 192.168.3.0255.255.255.0

  Switch***Config-pool***Dns-server 192.168.2.10

  Switch***Config-pool***Default-router192.168.3.1

  /*配置VLAN 4所用的地址池和相應引數*/

  Switch***Config***Ip Dhcp Pool Test03

  Switch***Config-pool***Network 192.168.4.0255.255.255.0

  Switch***Config-pool***Dns-server 192.168.2.10

  Switch***Config-pool***Default-router192.168.4.1

  第六步:設定DHCP保留不分配的地址

  Switch***Config***Ip Dhcp Excluded-address192.168.2.2 192.168.2.10

  Switch***Config***Ip Dhcp Excluded-address192.168.3.2 192.168.3.10

  Switch***Config***Ip Dhcp Excluded-address192.168.4.2 192.168.4.10

  第七步:啟用路由

  /*路由啟用後,各VLAN間主機可互相訪問*/

  Switch***Config***Ip Routing

  第八步:配置訪問控制列表

  Switch***Config***access-list 103 permit ip192.168.2.0 0.0.0.255 192.168.3.0 0.0.0.255

  Switch***Config***access-list 103 permit ip192.168.3.0 0.0.0.255 192.168.2.0 0.0.0.255

  Switch***Config***access-list 103 permit udpany any eq bootpc

  Switch***Config***access-list 103 permit udpany any eq tftp

  Switch***Config***access-list 103 permit udpany eq bootpc any

  Switch***Config***access-list 103 permit udpany eq tftp any

  Switch***Config***access-list 104 permit ip192.168.2.0 0.0.0.255 192.168.4.0 0.0.0.255

  Switch***Config***access-list 104 permit ip192.168.4.0 0.0.0.255 192.168.2.0 0.0.0.255

  Switch***Config***access-list 104 permit udpany eq tftp any

  Switch***Config***access-list 104 permit udpany eq bootpc any

  Switch***Config***access-list 104 permit udpany eq bootpc any

  Switch***Config***access-list 104 permit udpany eq tftp any

  第九步:應用訪問控制列表

  /*將訪問控制列表應用到VLAN 3和VLAN 4,VLAN2不需要*/

  Switch***Config***Int Vlan 3

  Switch***Config-vlan***ip access-group 103 out

  Switch***Config-vlan***Int Vlan 4

  Switch***Config-vlan***ip access-group 104 out

  第十步:結束並儲存配置

  Switch***Config-vlan***End

  Switch#Copy Run Start