交换机

wr保存配置copy
service password-encrrption 加密设置的所有密码



Switch(config)#int vlan 1 (配置管理ip)
Switch(config-if)#ip add 10.0.0.2 255.0.0.0
Switch(config-if)#no shutdown
show ip int vlan 1 查看管理ip
Switch(config)#int f0/1
Switch(config-if)# (进入接口模式)
S1(config)#ip default-gateway 10.0.0.1  配置默认网关
S1(config)#int f0/1
S1(config-if)#duplex full (配置端口工作方式)
S1(config-if)#speed 100 (配置端口速率)
交换机密码恢复
(1)拔掉交换机电源,按住交换机前面板的Mode,接上电源,直到所有灯亮为止。
(2) 输入 flash_init
load_helper
dir flash:
(3) 输入 rename flash:config.text flash:config.old
(4) 输入 boot
(5) 输入 enable rename flash:config.old flash:config.text
(6)copy flash:config.text system:running-config
(7)清除口令
(8)wr
show spanning-tree 查看生成树运行状态
spanning-tree vlan 1 priority 4096 修改桥的优先级 (全局模式)
Switch(config)#mac-address-table static 000a.f3ad.7c13 vlan 1 int f0/1 (静态绑定mac地址)
Switch#show mac-address-table 查看交换机mac地址表
Switch(config)#int f0/2 交换机端口安全 
Switch(config-if)#switchport mode access
Switch(config-if)#switchport port-security
Switch(config-if)#switchport port-security mac-address 00e0.a3d8.26bd 静态安全mac地址
Switch(config-if)#switchport port-security mac-address sticky 动态粘滞mac地址
Switch(config-if)#switchport port-security maximum 1 最大连接数
Switch(config-if)#switchport port-security violation shutdown 违反策略关闭端口
Switch#show port-security interface f0/2 查看端口安全是否启用
int range f0/20-24 保护未使用的端口
shutdown

创建VLAN
方法(1)Switch(config)#vlan 2
  Switch(config-vlan)#name xs
方法(2)Switch#vlan database
Switch(vlan)#vlan 3 name js
配置VLAN成员
Switch(config)#int f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 2
查看VLAN运行情况
show vlan id (id) 或show vlan brief (特权)
show interfaces f0/1 switchport(特权) 查看交换机端口运行模式

S1(config)#vtp domain xinhua vtp配置
S1(config)#vtp password 123
S1(config)#vtp mode server
S2(config)#vtp domain xinhua
S2(config)#vtp password 123
S2(config)#vtp mode client
S3(config)#vtp domain xinhua
S3(config)#vtp password 123
S3(config)#vtp mode transparent

Router(config)#hostname R1 (单臂路由)
R1(config)#int f0/1
R1(config-if)#no ip address
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#int f0/1.2
R1(config-subif)encapsulation dot1q 2
R1(config-subif)ip add 192.168.2.1 255.255.255.0
R1(config-subif)no sh
R1(config-subif)exit
R1(config)#int f0/1.3
R1(config-subif)encapsulation dot1q 3
R1(config-subif)ip add 192.168.3.1 255.255.255.0
R1(config-subif)no sh
R1(config-subif)exit
注意:和路由连接的交换机端口配置trunk模式

wg_sw_3550(config)#vlan 2 (三层交换机vlan间路由)
wg_sw_3550(config-vlan)#vlan 3
wg_sw_3550(config)#interface f0/1
wg_sw_3550(config-if)#switchport access vlan 2
wg_sw_3550(config-if)# interface f0/2
wg_sw_3550(config-if)#switchport access vlan 3
wg_sw_3550(config)#ip routing
wg_sw_3550(config)#int vlan 2
wg_sw_3550(config-if)ip address 10.1.1.2 255.0.0.0
wg_sw_3550(config)#int vlan 3
wg_sw_3550(config-if)ip address 11.2.2.2 255.0.0.0






路由器
show ip interface brief 查看路由器所有接口
show ip route 查看路由表信息
Router(config)#int f0/0 (配置路由器以太网接口)
Router(config-if)#ip add 10.0.0.1 255.0.0.0
Router(config-if)#no shutdown (配置路由器串行接口)
Router(config)#interface serial 0
Router(config-if)#ip add 10.0.0.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#clock rate 64000 (配置时钟频率)
Router(config-if)#bandwidth 64 (设置带宽)
show interface s0/0/1 查看s0/0/1接口状态
Router#show controller serial 0 查看物理接口类型(是DTE还是DCE)
Router#reload (热启动)
路由器密码恢复
1.首先在路由器上配置密码
2.关闭电源开机启动过程按ctrl+break键中断,进入
rommon模式
3.rommon1>confreg 0x2142
4.rommon2>reset
5.清除在路由器上配置的口令
6.Router(config)#config-register 0x2102
7.router#copy running-config startup-config
8.Reload
9.静态路由配置
Router(config)#ip route 192.168.3.0 255.255.255.0 serial 0/0/0
Router(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
默认路由配置





通用
Switch>enable 用户模式
Switch#conf t 特权模式
Switch(config)# 全局模式
exit 退出上一种模式
disable 特权模式退到用用户模式
logout 从用户模式或特权模式退到控制台
no ip domain-lookup 取消域名服务器查找 (全局模式)
多敲?多敲TAB 使用缩写
show history 查看历史缓冲区记录(特权模式)
terminal history size line 更改历史缓冲区大小(特权模式)
2503(config)# no router rip 取消该命令前面敲no
show version 查看版本号 (特权)
show running-config 查看运行配置文件(特权)
Switch(config)#hostname S1 (配置主机名)
S1(config)#
show startup-config 查看启动配置文件
erase startup-config 删除启动配置文件 
copy running-config startup-config 保存运行配置文件
line console 0 控制台口令
password cisco
login
enable password xinhua 特权口令
enable secret cisco
line vty 0 4 vty口令
password cisco
login
service password-encryption 明文加密(全局)
show interfaces 查看所有接口状态(特权)
show interface f0/1 查看f0/1接口状态 (特权)
show cdp neighbors 查看cdp邻居运行状况 (特权)
show cdp neighbors detail 详细查看cdp邻居 (特权)
cdp run 启用cdp (全局)
no cdp run 禁用cdp (全局)
no cdp enable (接口模式)
show users 查看telnet本地设备用户 (特权)
show sessions 查看telnet哪些设备 (特权)
ping 测试网络连通性 (特权)
traceroute 路由跟踪 (特权)
copy run (start) tftp 配置文件备份
copy tftp run(start) 配置文件恢复
show flash 查看闪存
copy flash tftp 对cisco ios镜像文件备份
copy tftp flash 恢复cisco ios镜像文件




路由器灾难恢复步骤
用超级终端连接上路由器,确认ios镜像文件已经放在TFTP根目录下。路由器丢失ios重启后,开机将自动进入rommon模式
rommon1>IP_ADDRESS=192.168.1.1
rommon2>IP_SUBNET_MASK=255.255.255.0
rommon3>DEFAULT_GATEWAY=192.168.1.2
rommon4>TFTP_SERVER=192.168.1.2
rommon5>TFTP_FILE=C2600nm-adventise..... .bin
rommon6>tftpdnld
Do you wish to continue? y/n:[n]:Y
rommon7>reset

交换机灾难恢复步骤
把计算机的串口和交换机的console口连接好,用超级终端连上交换机,ios放在本地磁盘上
交换机开机后,自动执行以下命令:
switch:flash_init
switch:load_helper
输入拷贝指令:
switch:copy xmodem: flash:c2950-i6q412-mz.121...... .bin
该命令含义是通过xmodem方式拷贝文件并保存在flash中,文件名为c2950-i6q412-mz.121...... .bin,出现如下提示:
begin the xmodem or xmodem -1k transfer now.....
CCCCCCCCCCC
立即在超级终端窗口中,选择传送-传送文件,打开“发送文件”对话框,选择ios文件,协议为xmodem,点击发送按钮 开始发送文件,由于速度很慢,耐心等待,通信速率为9600bps
传送完毕后执行以下命令:
switch:boot
启动系统




DDR配置
pc1:ipconfig /ip 192.168.1.2 255.255.255.0
ipconfig /dg 192.168.1.1
pc2:ipconfig /ip 192.168.2.2 255.255.255.0
ipconfig /dg 192.168.2.1
R1:int f0/0
ip add 192.168.1.1 255.255.255.0
no sh
int bri 0
ip add 192.168.3.1 255.255.255.0
no sh
R2:int f0/0
ip add 192.168.2.1 255.255.255.0
no sh
int bri 0
ip add 192.168.3.2 255.255.255.0
no sh
R1:全局模式:isdn switch-type basic-net3 指定ISDN交换机类型
dialer-list 1 protocol ip permit 定义感兴趣流量
int bri 0
接口模式: dialer string 7782002 设置拨号串 R2的ISDN号码
dialer-group 1 把BRI接口与拨号列表1相关联
isdn spid1 32177820010100 R1的isdn标识号
  全局模式:username R2 password 123 ppp验证
接口模式: int bri 0
encapsulation ppp
ppp authentication chap
dialer idle-timeout 300 定义无流量自动断开会话的空闲时间
       dialer map ip 192.168.3.2 name R2 7782002 与对端建立的映射
全局模式:ip route 192.168.2.0 255.255.255.0 192.168.3.2


R2:全局模式:isdn switch-type basic-net3 指定ISDN交换机类型
dialer-list 1 protocol ip permit 定义感兴趣流量
int bri 0
接口模式: dialer string 7782001 设置拨号串 R2的ISDN号码
dialer-group 1 把BRI接口与拨号列表1相关联
isdn spid1 32177820020100 R1的isdn标识号
  全局模式:username R1 password 123 ppp验证
接口模式: int bri 0
encapsulation ppp
ppp authentication chap
dialer idle-timeout 300 定义无流量自动断开会话的空闲时间
       dialer map ip 192.168.3.1 name R1 7782001 与对端建立的映射
全局模式:ip route 192.168.1.0 255.255.255.0 192.168.3.1

ipv6配置
(1)给路由器接口配置ipv6地址
R1(config)#ipv6 unicast-routing
R1(config)#int serial 0/0/0
R1(config-if)#ipv6 address 2001:ab1:0:1::1/64
R1(config-if)#no sh
R1(config-if)#clock rate 64000

R2(config)#ipv6 unicast-routing
R2(config)#int serial 0/0/0
R2(config-if)#ipv6 address 2001:ab1:0:1::2/64
R2(config-if)#no sh
R2(config)#int serial 0/0/1
R2(config-if)#ipv6 address 2001:ab1:0:2::1/64
R2(config-if)#no sh
R2(config-if)#clock rate 64000

R3(config)#ipv6 unicast-routing
R3(config)#int serial 0/0/0
R3(config-if)#ipv6 address 2001:ab1:0:2::2/64
R3(config-if)#no sh

(2)OSPFv3配置
R1(config)#ipv6 router ospf 1
R1(config-rtr)#router-id 10.0.0.1
R1(config)#int serial 0/0/0
R1(config-if)#ipv6 ospf 1 area 0

R2(config)#ipv6 router ospf 1
R2(config-rtr)#router-id 20.0.0.1
R2(config)#int serial 0/0/0
R2(config-if)#ipv6 ospf 1 area 0

R2(config)#int serial 0/0/1
R2(config-if)#ipv6 ospf 1 area 0

R3(config)#ipv6 router ospf 2
R3(config-rtr)#router-id 30.0.0.1
R3(config)#int serial 0/0/0
R3(config-if)#ipv6 ospf 2 area 0

(3)ipv6隧道配置
R1(config)#ipv6 unicast-routing
R1(config)#ipv6 router ospf 1
R1(config-rtr)#router-id 10.0.0.1
R1(config)#int serial 1/0
R1(config-if)#ipv6 address 2001:ab1:0:1::1/64
R1(config-if)#no sh
R1(config-if)#clock rate 64000
R1(config-if)#ipv6 ospf 1 area 0

R2(config)#ipv6 unicast-routing
R2(config)#ipv6 router ospf 1
R2(config-rtr)#router-id 20.0.0.1
R2(config)#int serial 1/0
R2(config-if)#ipv6 address 2001:ab1:0:1::2/64
R2(config-if)#no sh
R2(config-if)#ipv6 ospf 1 area 0
R2(config)#int serial 1/1
R2(config-if)#ip address 192.168.1.1 255.255.255.0 (no ipv6 address)
R2(config-if)#no sh
R2(config-if)#clock rate 64000

R3(config)#ipv6 unicast-routing
R3(config)#ipv6 router ospf 1
R3(config-rtr)#router-id 30.0.0.1
R3(config)#int serial 1/0
R3(config-if)#ipv6 address 2001:ab1:0:3::1/64
R3(config-if)#no sh
R3(config-if)#clock rate 64000
R3(config-if)#ipv6 ospf 1 area 0
R3(config)#int serial 1/1
R3(config-if)#ip address 192.168.1.2 255.255.255.0 (no ipv6 address)
R3(config-if)#no sh

R4(config)#ipv6 unicast-routing
R4(config)#ipv6 router ospf 1
R4(config-rtr)#router-id 40.0.0.1
R4(config)#int serial 1/0
R4(config-if)#ipv6 address 2001:ab1:0:3::2/64
R4(config-if)#no sh
R4(config-if)#ipv6 ospf 1 area 0

R2同R3 int tunnel 0
ipv6 address 2001:ab1:0:2:1::1/64
tunnel source 192.168.1.1
tunnel destination 192.168.1.2
tunnel mode ipv6ip
ipv6 ospf 1 area 0

pppoe配置
Router(config)#int f0/0      启用pppoe协议
Router(config-if)#pppoe enable
Router(config-if)#no sh

Router(config)#ip local pool xinhua 192.168.1.2 192.168.1.50 指定dhcp地址池
Router(config)#int virtual-Template 1 启用虚拟模版 (实施对客户端身份验证)
Router(config-if)#ip unnumbered int f0/0 (真机没有此命令)
Router(config-if)#encapsulation ppp (PT可以不用敲)
Router(config-if)#ppp authen chap
Router(config-if)#peer default ip address pool xinhua (使用的地址池为客户端分配ip)
Router(config-if)#exit

Router(config)#vpdn enable 启用vpdn
Router(config)#vpdn-group 1 接受客户端呼叫
Router(config-vpdn)#accept-dialin 接受拨入
Router(config-vpdn-acc-in)#protocol pppoe 采用pppoe协议
Router(config-vpdn-acc-in)#virtual-template 1 启用虚拟模版1参数与客户端协商
Router((config-vpdn-acc-in)#exit
Router(config-vpdn)#exit
Router(config)#username adsl password xinhua
Router(config)#username xinhua password 123

启用sdm在路由器上配置
ip http server
ip http secure-server
ip http authentication local
username xinhua privilege 15 password 0 xinhua
line vty 0 4
privilege level 15
login local
tranport input telnet/ssh (telnet ssh)
exit

eigrp身份验证(首先启用eigrp)
key chain xinhua (进入密钥链配置模式)
key 1 (创建密钥ID)
key-string xinhua (指定密钥字符串)
int serial 1/1
ip authentication key-chain eigrp 10 xinhua (指定密钥链中的密钥对eigrp进行身份验证)
ip authentication mode eigrp 10 md5 (使用md5加密方式进行身份验证)

帧中继交换机的配置
R2:frame-relay switching
interface Serial1/0
no ip address
encapsulation frame-relay
clock rate 64000
frame-relay intf-type dce
frame-relay route 102 interface Serial1/1 201

interface Serial1/1
no ip address
encapsulation frame-relay
clock rate 64000
frame-relay intf-type dce
frame-relay route 201 interface Serial1/0 102
R1和R3 接口配置ip 封装帧中继


DHCP server
(1) ip dhcp excluded-address 192.168.1.1 192.168.1.9
ip dhcp excluded-address 192.168.1.100
ip dhcp pool xinhua
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 202.102.224.68
(2) ip dhcp excluded-address 192.168.2.1 192.168.2.9
ip dhcp excluded-address 192.168.2.100
ip dhcp pool xinhua1
network 192.168.2.0 255.255.255.0
default-router 192.168.2.1
dns-server 202.102.224.68
dhcp 中继
  int f0/0
ip helper-address 192.168.2.11