1、 一:基本操作命令 一:加密命令 1. Enable secret 123 (用户进入特权模式时,需要输密码,密文加密形式) 2. Enable password 123 (同理,不过密码是明文) 3.line consle 0 login password 123 (给用户登录加密) 4. service password-enveryption (将所有密码加密成密文形式) 5. line vty 0 4 (回车)login password 123 (给远程登录加密) 二:查看命令 1. show running-co
2、nfig (查看当前设置) 2. show history (查看过去使用过的命令) 3. show version (查看寄存器的值,版本等) 4. show interface (查看接口信息) 5. show ip interface (显示接口是否开启) 6. show interface serial 0 (显示串口的信息) 7. show vlan-switch (查看关于vlan的配置) 8. show controllers s0/0 (查看本串口是dte还是dce) 9. show vtp status (查看vtp的信息) 10. show vlan (查
3、看是否学习到vlan) 11. show frame-relay map (查看祯中继的值) 12. show sparming-tree (查看生存树的信息) 三:一些必备的设置 1. line console 0 (回车)logging synchronous (日志同步) 2. exec-timeout 0 0 (永不超时) 3. no ip domain lookup (关闭dns查找) 4. hostname 123 (为设备改名字) 5. copy running-config startup-config (将当前配置保存到内存中,防止突然断电使用) 四:路由
4、和网关 1. ip route 0.0.0.0 0.0.0.0 (为设备设置默认路由) 2. ip default-gateway 192.168.1.1 (设置网关) 3. bandwidth 64(KB)(设置带宽) 4. ip name-server 202.102.152.3 (设定DNS,最多可指定6个DNS) 二:具体重要试验 一:vlan (交换机) 1. vlan database 2. vlan 2(2—1001的任何数字) 3. interface fastethere 1 (进入接口模式) 4. swithport
5、 mode access 5. swithport access vlan 2 6. no shutdown (开启接口) 目的:将一个物理的LAN,逻辑的划分为不同的VLAN,每一个VLAN都包含着一组工作机站,这样便可以控制流量,减少设备投资,简化网络管理,提高网络的安全性。 二:trunk (二层设备皆可) 1. interface fastethere 1 2. swithport 3. swithport trunk en(tab)dot1q 4. swithport mode trunk 目的:开启trunck后,能够实现不同VLAN之间的相互通信。不同
6、VLAN之间是不可以互相通信的。 三:vtp (交换机) 一:服务器 (在本机首先建立若干个VLAN) 1. vlan database 2. vlan domain wnt (首先设置域) 3. vlan password 123 (设置域的密码) 4. vtp pruning (开启vtp修剪) 5. vtp v2-mode(版本号) 6. vlan server (服务器模式) 二:客户机 7. vlan database 8. vlan domain wnt (首先设置域) 9. vlan password 123 (设置域的密码) 10. vtp pr
7、uning (开启vtp修剪) 11. vtp v2-mode(版本号) 12. vlan cliant(客户机模式) 13.(show vlan 查看是否学习到VLAN) 目的:动态的管理VLAN,应用于机器较多的大型网络中,其中透明模式,不可以学习,但可以转发。 四:以太网通道(交换机,所需设备PC1 PC2 SW1 SW2 交换版) 一: sw1 1. interfance fastether 1 2. speed 100 (设置速度) 3. puplex full (全双工) 4. channel-group 1 mode on (开启以太网通道)
8、 5. no shutdown 二: sw2 1. interface fastethrter 2 2. speed 100 (速度) 3.duplex full (全双工) 4.channel-group 1 mode on (开启以太网通道) 5.no shutdown (查看以太网通道:show ethcrchnannel 1 brief ,用PC1和pc2进行扩展ping,查看是否丢包) 目的:多条线路组合成一条逻辑电路,如一条100M的建立两条的话,那便是200M。 三:路有协议 一: rip 1.
9、 interface fasteternet 1 router rip 2. network 192.168.1.0 (宣告网段,本机器的) 3. no auto-summary (取消自动汇总) 4. ip summary-address rip 192.168.1.0 (手工汇总) 5. clear ip route * (清空路有表,重新收敛) 6. ip rip send version 1 2 (收v1和v2) 7. ip rip receive version 1 2 (发v1和v2) 8. RIP分为ripv1和ripv2,其中ripv1的广
10、播地址是255.255.255.0 ripv2的组播地址是224.0.0.9 目的:rip是以跳数为度量值的距离矢量协议 他的默认管理距离是120,端口为520,不同的路由器应该使用相同的路由协议,否则就无法进行通信。Ripv2是rip的增强版。Ripv1只支持有类的路由,是同类协议中较差的一种协议。 二:eigip 1. interface fasteternet 1 2. router eigip 1 (1-65535的任意整数) 3. network 192.168.2.0 (宣告本机器上的网段) 4. bandwidth 100 (定义带宽,以kb为单位) 5.
11、 no auto-summary (取消自动汇总) 6. ip summary-address 192.168.2.0 (手动汇总) 7. show ip protocols (显示路由协议的配置情况) 8. show ip route eigip (显示路有表中有关eigip的条目) 目的:eigip是基于链路状态和距离矢量优点为一体的混合协议,他在同类协议中是比较完善的一种协议。 三:ospf 1. interface fasteternet 1 2. router ospf 1 (1-65535的任意整数) 3. network 192.168.3.0 0.
12、0.0.255 area 0(宣告本机的网段,子网必须是反码,区域应该相同) 4. show ip route ospf (查看有关ospf的信息) 5. show ip ospf interface (验证接口是否被配置到目标区域了) 四:路由重分布(实现不同协议之间的相互通信) 如图所示在R1 和R2上运行rip协议,而在R4上运行eigip协议。其中R3是边界路由器,它运行rip和eigip两个协议。 1. R1 在fa0/1运行rip 宣告 192.168.1.0 2. R2 在e1/0 运行rip 宣告 192
13、168.2.0 3. R3 在e1/0 运行rip 宣告 192.168.2.0 在e1/1 运行eigip 宣告192.168.6.0 4. R4 在fa0/0 运行 eigip 宣告 192.168.6.0 5. 在边界路由器上进行路由重分布 6. 进入:router rip (把eigip分布到rip中) 7. redistribute eigip metric 6 8. 进入:router eigip (把rip分布到eigip中) 9. redistribute rip metic 10000 20 20 20 20(带宽,延迟,可靠性,负载,最
14、大传输单元) 五:子接口(给子接口设ip) 1. interface fastether 0/1 2. no ip address 3. no shutdown 4. interface fastethere 01/.1 5. encapsulation dot1q 1 6. ip address 192.168.2.1 255.255.255.0 7. no shutdown (一个子接口对应着一个ip地址,一个物理接口可以划分为多个子接口) 六:ppp(pap,cha
15、p一种封装协议) 一:单向的pap(r1和r4) R1: 1. username R4 password 123 2. interface s1/2 3. ip address 192.168.1.1 255.255.255.0 4. encapsulation ppp (封装ppp) 5. ppp authentication pap (验证类型是pap) 6. no shutdown R4: 1. interface s1/1 2. ip address 192.168.1.2 255.255.255.0 3. encapsulation ppp (
16、封装ppp) 4. ppp pap sent-username r4 password 123 5. no shutdown 二:单向的chap R1: 7. username R2 password 123 8. interface s1/2 9. ip address 192.168.1.1 255.255.255.0 10. encapsulation ppp (封装ppp) 11. ppp authentication chap (验证类型是pap) 12. no shutdown R2: 6. interface s1/1 7. ip ad
17、dress 192.168.1.2 255.255.255.0 8. encapsulation ppp (封装ppp) 9. ppp chap hostname r2 10. ppp chap password 123 11. no shutdown (R1和R4可以相互ping通) 二:双向的pap(r1和r4) R1: 1.username R4 password 123 13. interface s1/2 14. ip address 192.168.1.1 255.255.255.0 15. encapsulation ppp (封装ppp
18、 16. ppp pap sent-username R1 password 123 (注意,是本机名和密码!!!!) 17. ppp authentication pap (验证类型是pap) 18. no shutdown R4: 19. username R1 password 123 20. interface s1/2 21. ip address 192.168.1.1 255.255.255.0 22. encapsulation ppp (封装ppp) 23. ppp pap sent-username R4 password 123 (注意,是本
19、机名和密码!!!!) 24. ppp authentication pap (验证类型是pap) 25. no shutdown (双向的chap同理,但没有ppp pap sent-username R1 password 123这些命令) 七:访问控制列表 一:标准型,(1-99的任意数字)扩展型(100-199)(deny拒绝,permit 允许) (tcp www:80,tcp ftp:21, icmp ping 各种常用的协议和端口) 1. access-list 101 deny tcp 127.16.30.0 0.0.0.255
20、 172.168.1.200 0.0.0.255 eq telnet(拒绝172.16.3.0到172.16.1.200的远程登录)(ip access-group 101 应用到接口上!!!) 2.access-list 102 permit tcp 172.16.2.0 0.0.0.255 host 172.168.1.200 eq www (允许172.168.2.0到host主机的web服务)(ip access-group 102 应用到接口上!!!) 3.access-list 111 permit tcp 172.168.3.0 0.
21、0.0.255 172.16.1.0 0.0.0.255 eq ftp (允许172.168.3.0 到 172.16.1.0的ftp登录) 4.access-list 111 permit icmp 172.168.3.0 0.0.0.255 172.16.1.0 0.0.0.255 eq ping (允许172.16.3.0到172.168.1.0的ping) (ip access-group 111 应用到接口上!!!!) 八:重点——破思科设备的密码 一:路由器: 1. 重启路由器,在60秒内按下CTRL+
22、Break键,进入ROM Moniter模式 2. 在提示符下输入命令修改配置寄存器的值并重启: rommon1 > confreg 0X2142 rommon2 > reset 3. 选择不进入setup模式,进入特权模式,保存原有配置,更新enable: Router> enable Router# copy startup-config running-config Router# config t Router(config)# enable secret xxxxxx 4. 把配置寄存器的值改回0X2
23、102,保存当前配置到startup-config,重启路由器: Router(config)#config-register 0X2102 Router(config)#exit Router# copy running-config startup-config Router# reload 二:交换机 1. 断电→通电(按住mode键,通电,等第一个指示灯熄灭后松开) 2. flash-init 3. Load-helper 4. Rename flash:config .text flash:config.text.old
24、 (更改配置文件) 5. Dir flash (查看是否更新成功) 6. Boot(重起) 7. Rename flash:config.Text.old flash:config.text (改回原来文件) 8. Dir flash (查看是否更改成功) 9. Copy flash:config.Text running-config(拷贝文件) 九 NAT 1. NAT (网络地址转换) 2.NAT技术基本原理:在内部网络中使用内部地址,通过NAT把内部地址翻译成合法的IP地址在Internet
25、上使用,其具体的做法是把IP包内的地址域用合法的IP地址来替换。
3.NAT技术的类型:静态NAT,动态NAT, 网络地址转换PAT(IP映射端口)
4.静态NAT
1.在接口下确定NAT的inside或outsind,inside口可以为多个。
26、at inside source static inside-local-address(内网IP地址)inside-global-address (公网IP地址)
5.动态NAT
1.同上述(1)相同。
2.在R1的全局模式
27、 (建立地址池)
28、standby 1 ip 192.168.10.254 #standby 1 priority 130 #standby 1 preempt #standby 1 track fa 1/1 50 (花销值) 8.VRRP实验 Sw1(config)#interface vlan 10 #vrrp 1 ip 192.168.10.254 #vrrp 1 preempt #vrrp 1 priority 130 Sw1(config)#track 1 interface fa 1/1 line-protocol #interface vlan 10 #vrrp 1 track 1 decrement 50 1 二爷 2009年-6月-12日于机房一
©2010-2025 宁波自信网络信息技术有限公司 版权所有
客服电话:4009-655-100 投诉/维权电话:18658249818