第一章 VTP 协议 <?XML:NAMESPACE PREFIX = O />

VTP VLAN Trunk Protocol 虚拟局域网中继协议

1 创建VTP域名:vtp  domain domain-name

2 配置交换机的VTP模式:vtp mode server/client/transparent

3 配置VTP口令:vtp password password

4 配置VTP修剪:vtp pruning

5 配置VTP的版本:vtp version 2/1

6 查看VTP的配置信息: show  vtp  status

7 查看VLAN的配置信息:show  vlan  brief 

8 查看接口的配置信息: show ip  int  brief

9.Line cons  0

Logg  syn   取消同步

No  ip  dom  loo  取消解析

第二章 STP 协议

STP---spanning tree protocol 生成树协议

PVST 配置命令:

1 启用生成树:spanning-tree  vlan vlan-list

2 指定根网桥:

spanning-tree vlan vlan-list root primary/secondary

3 修改网桥的优先级:

Spanning-tree vlan vlan-list priority 4096 的倍数

4 修改端口成本:Spanning-tree vlan vlan-list cost cost

5 修改端口优先级:

spanning-tree  vlan vlan-list port-priority priority

6 配置上行速链路:Spanning-tree uplinkfast

7 配置速端口:spanning-tree portfast

8 查看生成树的配置: show spanning-tree brief

9. 以太网通道的配置:

  Int range f0/1 2

  Channel-group 1 mode on 

第三章 三层交换

1. 启动路由功能: ip routing

2. 配置VLANIP地址:  

  Int vlan vlan-id

  Ip  address ip-address subnet-mask

  No shut

3. 查看FIB  show ip cef

4. 查看邻接关系表 show  adjacency  detail 

5. 在三层交换机上配置路由接口: no  switchport

6. 在三层交换机上配置静态或动态路由:

在三层交换机上配置静态路由或动态路由的方法与在路由器上配置路由的方法相同。

7. 配置DHCP中继转发:

  Int vlan  vlan-id

  Ip  helper-address  Dhcpserver-add

8. 查看路由表: show  ip  route

9. 释放IPipconfig /release

  重新获取IPipconfig /renew

10. 在路由器上配置DHCP服务器

全局模式:service dhcp 启用DHCP服务

全局模式:ip dhcp pool pool-name  创建DHCP

全局模式:network 192.168.1.0 255.255.255.0 指定DHCP池网段

全局模式:default-router 192.168.1.1 指定地址池网关

全局模式:dns-server 61.232.202.158 指定地址池的DNS

11. 取消发放的IP地址:

  Ip  dhcp excluded-add 192.168.1.1

第五章 广域网技术

专用连接:DDN数字数据网  PPP(数据链路层协议)

电路交换连接:ISDN连接 ,PPP(数据链路层协议),PSTN(公共交换电话网)

分组交换连接:侦中继 ,ATMX.25SMDS(交换式多兆比数据服务)

宽带接入:XDSL Cable Modem 

广域网封装协议:HDLC协议(路由器广域网默认设置),PPP协议(LCP子层,NCP子层),侦中继协议,ATM协议

重新给接口封装协议:

Int s1/0

Enca  ppp

No sh

DCE DTE提供时钟,所以要给DCE端设置时钟速率:

Sh  contr  se  0 查看

Int s0

Clock  rate  64000(64k)

第六章 PPP协议

PPP 协议 Point to  point  protocol 点对点协议

1. 多链路捆绑:

  Int s0/0

  Enca ppp

  Ppp multilink  group 1

 2. 设置地址池:

Ip local  pool  pool-name 192.168.1.1 192.168.1.254

Int s0/0

Peer default ip add pool pool-name

3. 封装协议

int  serial  slot/port 

  Enca  ppp

4. 配置PAP认证

  主认证端PAP配置:

Username  user-name  password  0 pass-word

Ppp   authentication  pap 

  被认证端PAP配置:

  Ppp  pap  sent-username user-name  password 0 pass-word

5. 配置CHAP认证:

主认证端CHAP配置:

Username 对端的主机号  password 0 pass-word

Ppp  chap  hostname 认证的主机名

Ppp  chap  password  密码

被认证端CHAP配置:

Username 对端的主机号  password 0 pass-word

Ppp  chap  hostname 认证的主机名

Ppp  chap  password  密码

6. 配置IP地址协商:

服务器端配置:Peer default ip address  ip-address

  客户端配置:ip  address  negotiated

7. 配置PPP压缩:

配置stac压缩:

接口模式:compress predictor/stac

第七章  DSL技术

目前存在的接入方式: 拨号接入方式,ISDN接入方式,以太网接入方式,光纤接入,无线接入方式,Cable Modem 接入方式,DSL接入方式。

HDSL,SDSL,SHDSL 对称型

VDSL,ADSL,G.ADSL 非对称型

路由器上配置 pppoe 拨号

ena

conf t

vpdn enable

vpdn-group 1

request-dialin

protocol pppoe

exit

exit

interface FastEthernet0/1

no sh

pppoe enable

pppoe-client dial-pool-number 1

no cdp enable

exit

interface Dialer1

mtu 1492

ip address negotiated

encapsulation ppp

dialer pool 1

dialer-group 1

ppp authentication pap chap callin

ppp chap hostname 290131110

ppp chap password 0 769209

ppp pap sent-username 290131110 password 0 769209

exit

ip route 0.0.0.0 0.0.0.0 Dialer1

int f0/0

ip add 172.16.0.254 255.255.0.0

no sh

ip nat inside

exit

interface Dialer1

ip nat outside

exit

ip nat inside source list 1 interface  Dialer1 overload

access-list 1 permit 172.16.0.0 0.0.255.255

第八章 OSPF基本概念及单区域配置

1. 配置接口的loop地址:

Int loop 0

Ip add ip-address subnet-mask

2. 启动OSPF进程并发布相应网段:

  Router   ospf  进程号

network 网络号,反码号。Area 区域号

3. clear ip ospf process     重启动进程

4. sh ip route       查看路由表

5. sh ip ospf        查看OSPF进程信息

6. sh ip ospf neighbour   查看ospf邻居信息

7. sh ip ospf  database   查看OPSF链路状态数据库

8. sh ip ospf  int        查看OSPF接口信息

9. ip ospf hello-initerval    修改计时器的值

10.ip ospf  dead-interval   修改计时器的值  

第九章 ospf 的多区域配置

1 router ospf 进程号

Network 网络号 反码 area 区域号

Aera 区域号 stub (no-summary )

2 router ospf 进程号

 Redistribute rip metric 1 16777214 metric-type 1/2 subnets

3 router rip

 Redistribute ospf 进程号metric 0 16

4.sh ip route

5. sh ip ospf neighbor

配置stub area

6.area 3 stub | no-summary 

show ip route 查看路由表信息

show ip route ospf 查看ospf学习到的路由

show ip protocol 查看ospf协议配置信息

show ip ospf 查看在路由器上 ospf 是如何配置的和 abr

show ip ospf database 查看 lsdb 内的所有 lsa 数据信息

show ip ospf interface 接口上 ospf 的配置信息

show ospf neighbor 查看 ospf 邻居和邻接的状态

show ospf neighbor 查看详细信息

debug ip ospf adj 查看每个 router 的整个过程

clear ip route 清空路由器

ospf 的高级配置

1   router  ospf  进程号

2   net 172.16.0.0  0.0.255.255 area 区域号

3   area 3 nssa | no-summary  配置某区域为 nssa 区域

4   辅助地址

int e 0/0

ip add 10.0.0.1  255.0.0.0 secondary

5   配置地址汇总

1 :区域间的路由汇总

 area 3 range 192.168.0.0 255.255.255.248

2: 外部路由汇总

 summary-address 192.168.0.0 255.255.255.248

6   配置路由重分发

Router   rip 

redistribute  ospf 109 metric 10  ospf 注入到 rip

router ospf 10

redistribute rip metric 200 subnets  rip 注入到 ospf 网络中

虚链路

r3

area 3 virtual-link 2.0.0.1   传送区域,对端的 routerID

r2

area 3 virtual-link 3.0.0.1   传送区域,对端的 routerID

8   配置 r1 成为一台 dr,r2 永远不做为 dr

r2

ena

conf  t

int e 0/0

ip  ospf  priority 0

no  sh

9   重分发静态和默认的路由信息

redistribute static metric 200

default-information originate 

第十一章 热备份路由协议(HSRP

1 standby 组号  ip  地址  配置HSRP

2 standby 组号  priority  优先级数值  设置优先级

3 standby 组号  preempt  设置占先权

4 standby 组号  track  要跟踪的接口号  减去的值

5: sh  standby  brief  查看HSRP配置

注意所有配置都是在接口模式下配置的

虚拟路由器冗余协议 (VRRPVirtual Router Redundancy Protocol

<?XML:NAMESPACE PREFIX = V /><!--[if !vml]--><!--[endif]-->  

NE80E-1: interface Ethernet8/0/15  undo shutdown  当与思科设备里的 no sh   ip address 10.216.12.19 255.255.255.248  vrrp  vrid 1 virtual-ip 10.216.12.18

 (Standby  zuhao  ip  ip-add) …………HSRP 的配置

vrrp  vrid 1 priority  150 

(standby  zuhao  priority youxianjideyigezhi)HSRP 设优先级

vrrp  vrid 1 preempt-mode

(standby  zuhao preempt )……….. HSRP 的占先  vrrp  vrid 1 track Ethernet8/0/15 reduced 100

 ( standby zuhao  track genzongdejiekou  jiandezhi ) HSRP 置端口跟踪

NE80E-2 配置信息:

 interface Ethernet8/0/15 undo shutdown

ip address 10.216.12.19 255.255.255.248 vrrp vrid 1 virtual-ip 10.216.12.18 vrrp vrid 1 preempt-mode vrrp vrid 1 track Ethernet8/0/15 reduced 100

机上 HSRP:

Int   vlan  vlan-id

standby 组号  ip  地址  配置HSRP

standby 组号  priority  优先级数值  设置优先级

standby 组号  preempt  设置占先权

standby 组号  track  要跟踪的接口号  减去的值

sh  standby  brief  查看HSRP配置 置多 HSRP 组可以互相备份。

第十二章 访问控制列表(ACL

1 access-list 1-99 permit/deny 源地址 反码

2 access-list 100-199 permit/deny protocol 源地址反码 目的地址 反码 关键字(http,ftp,telnet,www,dom   eq21,23,25,53 69,80

3. access-list 1-199 permit/deny any( protocol any any)

4 ip access-group 1-199 in/out

5. sh access-list

6. sh  ip int 接口号

7. ip access-list standard/extended name

8. 要取消访问控制列表时应先取消接口的应用

No  ip access-group 1-199 in/out

No  access-list 1-199 permit/deny ………

第十三章 网络地址转换(NAT

1   ip nat inside/outside  再端口上启用 nat 

2   ip nat inside source static 192.168.2.2 102.0.0.1  设置静态 nat 

3   access-list 1 permit 192.168.2.0 0.0.0.255 设置访问控制列表,定义允许地址转换的网段

4   设置 pat 

ip nat pool benet 102.0.0.1 102.0.0.1 netmask 255.255.255.252 

ip nat inside source list 1 pool benet overload

5   设置动态 nat 

ip nat pool benet 102.0.0.1 102.0.0.240 netmask 255.255.255.252 

ip nat inside source list 1 pool benet 

6   tcp 负载均衡配置

access-list 2 permit 20.0.0.1 为虚拟主机定义一个标准的 ip 访问控制列表

ip nat pool real-host 10.1.1.1 10.1.1.9 prefix-length 24 type rotary 网络前缀为 24 位,该地址集为循环型

ip nat inside destination list 2 pool real-host 设置访问控制表与 nat 地址集之间的映射

NAT 配置步骤:

1 、接口IP地址配置

2 、使用访问控制列表定义哪些内部主机能做NAT

3 、决定采用什么公有地址,静态或地址池

4 、指定地址转换映射

5 、在内部和外部端口上启用NAT

第十四章 虚拟专网

1 crypto  isakmp  enable  启用 ike

2   crypto  isakmp  policy 1  建立 ike 协商策略

3   group  2        设置 ike 所用的 dh 算法的复杂度

4   hash  sha         设置密钥验证所用的算法

5   encryption  3des    设置加密所用的算法  

6   authentication pre-share  设置 router 要使用预先共享的密钥

7   lifetime 3600    设置 sa 的生存时间

8   crypto isakmp key aaa add 1.1.1.1 设置共享密钥和对端地址

9   crypto ipsec transform-set my ah-sha-hmac esp-3des 配置 ipsec 传输模式

mode tunnel 

10  access-list 111 permit ip 172.16.0.0 0.0.255.255 3.0.0.0 0.255.255.255 指定 crypto 访问列表

11  crypto map  yuan 1 ipsec-isakmp  创建 crypto Map

12  match add 111  指定 crypto Map 使用的访问控制列表

13  set peer 1.1.1.1  指定 *** 链路对端的 ip 地址

14  set transform-set my  指定 crypto 所使用的传输模式

15  int e0/0

crypto map yuan   指定 crypto Map 到端口

第十五章 WLANVOIP

在路由器上配置 voip 

1   int  e 0/1

ip  add 192.168.2.1 255.255.255.0

no  sh

2   dial-peer voice 1 pots  指明要为语音端口开始配置电话

3   destination-pattern 1001  指明 voip 的电话号码

4   port 1/0/0   1001 绑定到指定的语音端口

5   dial-peer voice 10 voip   指明要进行的 voip 的配置

6   destination-pattern 2002  指明对方的电话号码

7   session target ipv4:192.168.2.2 将电话号码映射到对方接口上的 ip 地址

16 ipv6概述

1:  ipv6 unicast-routing 路由器上打开接口之间的 ipv6 数据转发功能。

2:  ipv6  address  fec0:0:0:1001::1/64 配置接口 ip 地址

3:  ipv6  router rip  aaa  配置 ipv6 rip 路由协议

    int e0/0 

    ipv6  rip  aaa  enable

4: pc 机上配置 ip 地址和默认网关地址

cmd

netsh

interface  ipv6

add address 本地连接 2 fec0:0:0:1005::2  配置 ip 地址

add route ::/0 本地连接 2 fec0:0:0:1005::1 配置默认网关

add dns 本地连接 2 fec0:0:0:1005::1  配置 dns 地址

5:   ipv6  router  ospf  1  配置 ospf

     router-id 1.1.1.2

     exit

     int e0/0

     ipv6 ospf 1 area 0

6   ipv6  route  fec0:0:0:1001::0/64  fec0:0:0:1001::2 配置静态的路由信息

关于 IP-MAC 地址绑定的交换机设置  

  注: IP 地址与 MAC 地址的关系: IP 地址是根据现在的 IPv4 标准指定的,不受硬件限制比较容易记忆的地址,长度 4 个字节。而 MAC 地址却是用网卡的物理地址,保存在网卡的 EPROM 里面,与硬件有关系,比较难于记忆,长度为 6 个字节。  

  虽然在 TCP IP 网络中,计算机往往需要设置 IP 地址后才能通讯,然而,实际上计算机之间的通讯并不是通过 IP 地址,而是借助于网卡的 MAC 地址。 IP 地址只是被用于查询欲通讯的目的计算机的 MAC 地址。  

ARP 协议是用来向对方的计算机、网络设备通知自己 IP 对应的 MAC 地址的。在计算机的 ARP 缓存中包含一个或多个表,用于存储 IP 地址及其经过解析的以太网 MAC 地址。一台计算机与另一台 IP 地址的计算机通讯后,在 ARP 缓存中会保留相应的 MAC 地址。所以,下次和同一个 IP 地址的计算机通讯,将不再查询 MAC 地址,而是直接引用缓存中的 MAC 地址。  

在交换式网络中,交换机也维护一张 MAC 地址表,并根据 MAC 地址,将数据发送至目的计算机。   

  为什么要绑定 MAC IP 地址: IP 地址的修改非常容易,而 MAC 地址存储在网卡的 EPROM 中,而且网卡的 MAC 地址是唯一确定的。因此,为了防止内部人员进行非法 IP 盗用 ( 例如盗用权限更高人员的 IP 地址,以获得权限外的信息 ) ,可以将内部网络的 IP 地址与 MAC 地址绑定,盗用者即使修改了 IP 地址,也因 MAC 地址不匹配而盗用失败 : 而且由于网卡 MAC 地址的唯一确定性,可以根据 MAC 地址查出使用该 MAC 

地址的网卡,进而查出非法盗用者。  

目前,很多单位的内部网络,都采用了 MAC 地址与 IP 地址的绑定技术。下面我们就针对 Cisco 的交换机介绍一下 IP MAC 绑定的设置方案。  

Cisco 中有以下三种方案可供选择,方案 1 和方案 2 实现的功能是一样的,即在具体的交换机端口上绑定特定的主机的 MAC 地址(网卡硬件地址),方案 3 是在具体的交换机端口上同时绑定特定的主机的 MAC 地址(网卡硬件地址)和 IP 地址。  

  1. 方案 1—— 基于端口的 MAC 地址绑定  

    思科 2950 交换机为例,登录进入交换机,输入管理口令进入配置模式,敲入命令:  

  Switch#config terminal 

  #进入配置模式  

  Switch(config)# Interface fastethernet 0/1 

  #进入具体端口配置模式  

  Switch(config-if)#Switchport port-secruity 

  #配置端口安全模式  

  Switch(config-if )switchport port-security mac-address MAC( 主机的 MAC 地址

  #配置该端口要绑定的主机的 MAC 地址  

  Switch(config-if )no switchport port-security mac-address MAC( 主机的 MAC 地址

  #删除绑定主机的 MAC 地址  

    注意:以上命令设置交换机上某个端口绑定一个具体的 MAC 地址,这样只有这个主机可以使用网络,如果对该主机的网卡进行了更换或者其他 PC 机想通过这个端口使用网络都不可用,除非删除或修改该端口上绑定的 MAC 地址,才能正常使用。  

  注意:以上功能适用于思科 2950 3550 4500 6500 系列交换机  

 2. 方案 2—— 基于 MAC 地址的扩展访问列表  

  Switch(config)Mac access-list extended MAC10 

  #定义一个 MAC 地址访问控制列表并且命名该列表名为 MAC10  

  Switch(config)permit host 0009.6bc4.d4bf any 

  #定义 MAC 地址为 0009.6bc4.d4bf 的主机可以访问任意主机  

  Switch(config)permit any host 0009.6bc4.d4bf 

  #定义所有主机可以访问 MAC 地址为 0009.6bc4.d4bf 的主机  

  Switch(config-if )interface Fa0/20 

  # 进入配置具体端口的模式  

  Switch(config-if )mac access-group MAC10 in 

  #在该端口上应用名为 MAC10 的访问列表(即前面我们定义的访问策略)  

  Switch(config)no mac access-list extended MAC10 

  #清除名为 MAC10 的访问列表  

  此功能与应用一大体相同,但它是基于端口做的 MAC 地址访问控制列表限制,可以限定特定源 MAC 地址与目的地址范围。  

注意:以上功能在思科 2950 3550 4500 6500 系列交换机上可以实现,但是需要注意的是 2950 3550 需要交换机运行增强的软件镜像( Enhanced Image )。  

 3. 方案 3——IP 地址的 MAC 地址绑定  

    只能将应用 1 2 与基于 IP 的访问控制列表组合来使用才能达到 IP-MAC 绑定功能。  

  Switch(config)Mac access-list extended MAC10 

  #定义一个 MAC 地址访问控制列表并且命名该列表名为 MAC10 

  Switch(config)permit host 0009.6bc4.d4bf any 

  #定义 MAC 地址为 0009.6bc4.d4bf 的主机可以访问任意主机  

  Switch(config)permit any host 0009.6bc4.d4bf 

  #定义所有主机可以访问 MAC 地址为 0009.6bc4.d4bf 的主机  

  Switch(config)Ip access-list extended IP10 

  #定义一个 IP 地址访问控制列表并且命名该列表名为 IP10 

  Switch(config)Permit 192.168.0.1 0.0.0.0 any 

  #定义 IP 地址为 192.168.0.1 的主机可以访问任意主机  

  Permit any 192.168.0.1 0.0.0.0 

  #定义所有主机可以访问 IP 地址为 192.168.0.1 的主机  

  Switch(config-if )interface Fa0/20 

  # 进入配置具体端口的模式  

  Switch(config-if )mac access-group MAC10 in 

  #在该端口上应用名为 MAC10 的访问列表(即前面我们定义的访问策略)  

  Switch(config-if )Ip access-group IP10 in 

  #在该端口上应用名为 IP10 的访问列表(即前面我们定义的访问策略)  

  Switch(config)no mac access-list extended MAC10 

  #清除名为 MAC10 的访问列表  

  Switch(config)no Ip access-group IP10 in 

  #清除名为 IP10 的访问列表  

上述所提到的应用 1 是基于主机 MAC 地址与交换机端口的绑定,方案 2 是基于 MAC 地址的访问控制列表,前两种方案所能实现的功能大体一样。如果要做到 IP MAC 地址的绑定只能按照方案 3 来实现,可根据需求将方案 1 或方案 2 IP 访问控制列表结合起来使用以达到自己想要的效果。  

  注意:以上功能在思科 2950 3550 4500 6500 系列交换机上可以实现,但是需要注意的是 2950 3550 需要交换机运行增强的软件镜像( Enhanced Image )。  

   后注:从表面上看来,绑定 MAC 地址和 IP 地址可以防止内部 IP 地址被盗用,但实际上由于各层协议以及网卡驱动等实现技术, MAC 地址与 IP 地址的绑定存在很大的缺陷,并不能真正防止内部 IP 地址被盗用 .