天天看点

Cisco-CCNA实验笔记

CCNA实验笔记

基础:

1、修改名称 全 hostname **

2、准备工作 全 no ip domain-lookup 关闭域名解析

            接 no exec-timeout     关闭退出时间

            接 logging synchronous 日志同步

密码设置:

1、enable password ***

   service password-encryption (启动明文密码加密)

2、enable secret ***

登录设备:

1、console

   全 line console 0

      no exec-timeout

      logging synchronous

      login

      password *** (配置登录密码)

2、telnet

    全 line vty 0 4

       login

       password ***

3、SSH

   全 username *** password ***

      line vty 0 4

      login local

      transport input ssh (all是默认的、 none)

   全 ip domain-name ***

      crypto key generate rsa

   登录:特 ssh  -l ***(username) *** (IP地址)

            password ***

CDP 思科发现协议 (数据链路层协议)

show cdp neighbors

show cdp entry *

全 no cdp run (关闭全部)

接 no cdp enable (关闭某个接口的CDP)

密码恢复:

1、Router:重启router & Ctrl+break ——miniIOS ——confreg 0x2142——reload

——copy start run ——改密码——config-register 0x2102——copy run start

2、Switch: 重启按mode——改config.text 为 其他后缀文件 (rename flash:config.text flash:config.***)

重启——rename flash:config.*** flash:config.text——copy flash:config.text running-config ——改密码+保存

DHCP:

全 ip dhcp pool ***(name)

   network 192.168.1.0 255.255.255.0(任意可用网段和子网掩码)

   default-router 192.168.1.1 (网段里的默认路由的IP地址)

   dns-server 8.8.8.8         (DNS服务器的IP地址 )

全 ip dhcp excluded-address 192.168.1.2(起始地址) 192.168.1.10(终点地址)

全 ip dhcp excluded-addess 192.168.1.1  (除去网关IP地址)

VLAN:

1、创建一个VLan

   全 vlan **(ID 1-4096)

      name ***

2、将接口放入Vlan

   接 switchport mode access

      switchport access vlan **(ID)

   注:将多个连续的接口加入VLan 可以用 range

       全 interface range f 0/11 - 15

3、Vlan间的通信——将接口配为trunk

   接 switchport mode trunk

4、VTP 用于传递Vlan配置信息 工作在trunk 链路上

  全 vtp domain ***(域名)

     vtp password ***(密码)

     vtp mode server/client/transparent (server是默认的)

     vtp pruning (vtp 修剪)

  show vtp status

  show vtp password

注:接口不属于VTP,要自己去分配

STP:

接 switchport mode access

   spanning-tree portfast

为路由器接口设置trunk

全     interface f 0/0.2(进入子接口)

子接口 encapsulation dot1q  **(Vlan ID)

子接口 ip address 192.168.1.1 255.255.255.0(子接口IP)

交换机安全:

SwitchX(config-if)#switchport port-security [mac-address mac-address

|mac-address sticky [mac-address]|maximum value | violation {restrict | shutdown}]

SwitchX(config)#interface fa0/5

SwitchX(config-if)#switchport mode access

SwitchX(config-if)#switchport port-security

SwitchX(config-if)#switchport port-security maximum 1

SwitchX(config-if)#switchport port-security mac-address sticky

SwitchX(config-if)#switchport port-security violation shutdown

静态路由:

 全 ip route 192.168.23.0 255.255.255.0(目的网段IP地址和子网掩码) 192.168.1.12(下一跳IP地址)

 全 ip route 192.168.23.0 255.255.255.0(目的网段IP地址和子网掩码) f 0/0 (接口号  这种多用于点对点的情况)

默认路由:

 全 ip route 0.0.0.0 0.0.0.0 192.2.3.1(吓一跳IP地址)

环回口:

 全 interface loopback (这和其他接口一样 但是是默认打开的)

RIP:

 全 router rip(打开rip 协议)

     version 1/2 (默认是v1)

     network 192.168.2.0 (申明网段 可以申明多个网段)

EIGRP:

 全 router eigrp 100(自治系统号1-65535)

    network 192.168.2.0(申明路由器上的网段 可以申明多个)

    no auto-summary (关闭自动汇总)

show ip eigrp neighbors

show ip eigrp topology

OSPF:

 全 router ospf 1(路由进程号 本地有效)

**  network 192.168.2.0 0.0.0.255(通配符) area 0(区域号)   (申明路由上的网段 可以申明多个)

show ip ospf neighbors

show ip protocols

特 clear ip route(重新运算协议)

全 no router rip/eigrp/ospf(删除某个路由协议的全部配置

ACL:

1、标准

 全 access-list **(ID 1-99 1300-1999) permit/deny 源地址+通配符(0表示匹配)

 接 ip access-group **(ID) in/out

 全 no access-list **(ID) (表示删除整个ID的ACL)

注:在所有列表中 有隐含拒绝全部的语句(access-list **ID deny any)

2、扩展

 全 access-list **(ID 100-199 2000-2699) permit/deny pro(协议) 源地址+通配符 目的地址+通配符 eq 端口号/共识协议

 接 ip access-group ID in/out

3、命名

 全 ip access-list standard/extended ***(name)

 进入列表 接着原来的命令继续写

NAT:

1、静态 nat

 全 ip nat inside source static 内网IP 外网IP

 接 ip nat inside/outside

2、动态 nat

 全 access-list **(ID) permit 内网段+通配符

 全 ip nat pool ***(name) 外网IP起始地址 外网IP终止地址 netmask 子网掩码

 全 ip nat insde source list **(ID) pool **(name)

3、PAT

 全 ip nat insde source list **(ID) pool **(name) overload

4、特 clear ip nat translation *(星号)

   特 show ip nat translations

5、删除一个NAT

 全 no ip nat inside source list **(ID) pool **(name) overload (清除映射关系)

 全 no ip nat pool **(name)                                    (删除地址池)

 全 no access-list **(ID) 

PPP:

1、PAP (R1是客户端 R2是服务端)

R2 全 username **(name) password ***  (在R2上创建用户名数据)

   接 PPP authentication pap

R1 接 ppp pap sent-username **(name) password *** (启用pap认证)

2、CHAP

R1、R2 全 username ***(对端的主机名) password ***

R1、R2 接 ppp authentication chap      (对应的接口下封装chap)