1、设置网关删除网关显示网关route add default gw #route del default gw #route#pi ng telnet e nablerouter#c onfig termi nal router(co nfig)#host name router(c on fig)#e nable secret xxx router(co nfig)#e nable password xxb router(co nfig)#li ne con sole 0 router(config-line)#line vty 0 4 router(co nfig-li ne)#log in
2、显示配置信息显示接口信息 显示路由信息 显示邻居信息 重新起动进入特权模式进入全局配置模式 设置交换机的主机名设置特权加密口令设置特权非密口令进入控制台口进入虚拟终端要求口令验证设置登录口令xxrouter(config-line)#password xxrouter(config)#(Ctrl+z)router#exit; 返回特权模式返回命令路由器配置:router(config)#int s0/0router(config-if)#no shutdown router(config-if)#clock rate 64000 router(config-if)#ip address 进入
3、Serail 接口激活当前接口 ;设置时钟频率 ;设置 IP 地址router(config-if)#ip address second ;设置第二个 IProuter(config-if)#int f0/0.1进入子接口router(config-subif.1)#ip address 设置子接口 IProuter(config-subif.1)#encapsulation dot1q router(config)#config-register 0x2142 router(config)#config-register 0x2102 router#reload绑定 vlan 中继协议跳过配
4、置文件正常使用配置文件重新引导路由器文件操作:router#copy running-config startup-configrouter#copy running-config tftprouter#copy startup-config tftp router#copy tftp flash:保存配置保存配置到 tftp ;开机配置存到 tftp下传文件到 flashrouter#copy tftp startup-config下载配置文件ROM 状态:Ctrl+Break rommonconfreg 0x2142 rommonconfreg 0x2102 rommonreset进入 R
5、OM 监控状态跳过配置文件 ;恢复配置文件 ;rommon copy xmodem: flash:d name 从 con sole 传输文件IP_ADDRESS=10.65.1.2 ;设置路由器 IPIP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码TFTP_SERVER=10.65.1.1 ;指定 TFTP 服务器IPTFTP_FILE=c2600.bintftpdnlddir flash:指定下载的文件从 tftp 下载查看闪存内容boot引导 IOS静态路由:ip route subnet-maskgateway命令格式router(config)#ip route
6、 2.0.0.0 255.0.0.0 1.1.1.2静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例动态路由:router(config)#ip routing router(config)#router rip router(config-router)#network router(config-router)#negihbor 帧中继命令: router(config)#frame-relay switching router(config-s0)#encapsulation frame-relay router(
7、config-s0)#fram-relay lmi-type cisco router(config-s0)#frame-relay intf-type DCE router(config-s0)#frame-relay dlci 16 router(config-s0)#frame-relay local-dlci 20 router(config-s0)#frame-relay interface-dlci 16 ; router(config)#log-adjacency-changes router(config)#int s0/0.1 point-to-point router#sh
8、ow frame pvc router#show frame map启动路由转发启动 RIP 路由协议。设置发布路由点对点帧中继用。使能帧中继交换使能帧中继设置管理类型设置为 DCE设置虚电路号记录邻接变化设置子接口点对点显示永久虚电路显示映射基本访问控制列表:router(config)#access-list permit|deny wild|any router(config)#interface default:deny anyrouter(config-if)#ip access-group in|out ;defaultut例 1 : router(config)#access-l
9、ist 1 deny host 10.65.1.1 router(config)#access-list 1 permit any router(config)#int f0/0 router(config-if)#ip access-group 4 in例 2 : router(config)#access-list 4 permit 10.8.1.1 router(config)#access-list 4 deny 10.8.1.0 0.0.0.255 router(config)#access-list 4 permit 10.8.0.0 0.0.255.255 router(conf
10、ig)#access-list 4 deny 10.0.0.0 0.255.255.255 router(config)#access-list 4 permit any router(config)#int f0/1 router(config-if)#ip access-group 4 in扩展访问控制列表: access-list permit|deny icmp D_IP wildtype access-list permit|deny tcp port router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 ech
11、o router(config)#access-list 101 permit ip any any router(config)#int s0/0router(config-if)#ip access-group 101 in router(config)#access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80 router(config)#access-list 102 permit ip any any router(config)#interface s0/1 router(config-if)#ip access-group 102
12、out删除访问控制例表 : router(config)#no access-list 102 router(config-if)#no ip access-group 101 in路由器的 nat 配置Router(config-if)#ip nat inside ;当前接口指定为内部接口 Router(config-if)#ip nat outside ;当前接口指定为外部接口 Router(c on fig)#ip nat in side source static p 公网 IP port Router(config)#ip nat inside source static 10.65
13、.1.2 60.1.1.1 Router(config)#ip nat inside source static tcp 10.65.1.3 80 60.1.1.1 80 Router(config)#ip nat pool p1 60.1.1.1 60.1.1.20 255.255.255.0 Router(config)#ip nat inside source list 1 pool p1Router(config)#ip nat inside destination list 2 pool p2Router(config)#ip nat inside source list 2 int
14、erface s0/0 overloadRouter(config)#ip nat pool p2 10.65.1.2 10.65.1.4 255.255.255.0 type rotary Router#show ip nat translationrotary参数是轮流的意思,地址池中的IP轮流与NAT分配的地址匹配。 overload参数用于PAT将内部IP映射到一个公网IP不同的端口上。外部网关协议配置routerA(config)#router bgp 100 routerA(config-router)#network 19.0.0.0 routerA(config-router)
15、#neighbor 8.1.1.2 remote-as 200配置PPP验证:RouterA(config)#username password RouterA(config)#int s0RouterA(config-if)#ppp authentication chap|pap 4PIX 防火墙命令Pix525(config)#nameif ethernet0 outside security0 ;命名接口和级别Pix525(config)#interface ethernet0 auto ;设置接口方式Pix525(config)#interface ethernet1 100fullP
16、ix525(config)#interface ethernet1 100full shutdownPix525(config)#ip address inside 192.168.0.1 255.255.255.0Pix525(config)#ip address outside 133.0.0.1 255.255.255.252定义公网 IP 区间例句去掉设置Pix525(config)#global (if_name) natid ip-ipPix525(config)#global (outside) 1 7.0.0.1-7.0.0.15Pix525(config)#global (o
17、utside) 1 133.0.0.1Pix525(config)#no global (outside) 1 133.0.0.1Pix525(config)#nat (if_name) nat_id local_ip netmarkPix525(config)#nat (inside) 1 0 0 内网所有主机 (0 代表 0.0.0.0)可以访问 global 1 指定的外网。Pix525(config)#nat (inside) 1 172.16.5.0 255.255.0.0 内网 172.16.5.0/16 网段的主机可以访问 global 1 指定的外网。Pix525(config
18、)#route if_name 0 0 gateway_ip metric ;Pix525(config)#route outside 0 0 133.0.0.1 1 ;Pix525(config)#route inside 10.1.0.0 255.255.0.0 10.8.0.1 1;Pix525(config)#static (inside, outside) 133.0.0.1 192.168.0.8 表示内部 ip 地址 192.168.0.8,访问外部时被翻译成 133.0.0.1 全局地址Pix525(config)#static (dmz, outside) 133.0.0.1
19、 172.16.0.8 中间区域 ip 地址 172.16.0.8,访问外部时被翻译成 133.0.0.1 全局地址1.switch 配置命令(1)模式转换命令用户模式 特权模式 ,使用命令 enable特权模式 全局配置模式 ,使用命令 config t全局配置模式 接口模式 ,使用命令 interface+ 接口类型 +接口号 全局配置模式一线控模式,使用命令line+接口类型+接口号 注:用户模式 :查看初始化的信息 .特权模式 :查看所有信息、调试、保存配置信息 全局模式:配置所有信息、针对整个路由器或交换机的所有接口 接口模式:针对某一个接口的配置 线控模式:对路由器进行控制的接口配
20、置(2)配置命令show running config 显示所有的配置show versin 显示版本号和寄存器值shut down 关闭接口 no shutdown 打开接口ip add +ip 地址 配置 IP 地址sec on dary+IP地址为接口配置第二个IP地址 show interface+接 口类型+接口号 查看接口管理性 show controllers interface 查看接口是否有 DCE 电缆 show history 查看历史记录 show terminal 查看终端记录大小hostname+主机名配置路由器或交换机的标识 config memory 修改保存在
21、 NVRAM 中的启动配置 exec timeout 0 0 设置控制台会话超时为 0 service password-encryptin 手工加密所有密码 enable password +密码 配置明文密码 ena sec +密码 配置密文密码 line vty 0 4/15 进入 telnet 接口 password +密码配置tel net密码 line aux 0 进入 AUX 接口 password +密码 配置密码 line con 0 进入 CON 接口 password +密码 配置密码bandwidth+数字配置带宽 no ip address 删除已配置的 IP 地址
22、show startup config 查看 NVRAM 中的配置信息 copy run-config startup config 保存信息到 NVRAM write 保存信息到 NVRAM erase startup-config 清除 NVRAM 中的配置信息 show ip interface brief 查看接口的谪要信息 banner motd # +信息 + # 配置路由器或交换机的描素信息 description+信息配置接口听描素信息 vlan database 进入 VLAN 数据库模式 vlan +vlan 号+ 名称 创建 VLAN switchport access
23、vian +vlan号 为 VLAN 为配接口 interface vlan +vlan 号 进入 VLAN 接口模式 ip add +ip 地址 为 VLAN 配置管理 IP 地址 vtp+service/tracsparent/client 配置 SW 的 VTP 工作模式 vtp +domain+域名 配置SW的VTP域名 vtp +password +密码 配置 SW 的密码 switchport mode trunk 启用中继 no vlan +vlan 号 删除 VLAN show spamming-tree vlan +vlan号 查看 VLA 怕生成树议2.路由器配置命令 ip
24、 route+非直连网段+子网掩码+下一跳地址配置静态/默认路由 show ip route 查看路由表 show protocols 显示出所有的被动路由协议和接口上哪些协议被设置 show ip protocols 显示了被配置在路由器上的路由选择协议 ,同时给出了在路由选择协议中使用的定时器等信息 router rip 激活 RIP 协议 network +直连网段 发布直连网段 interface lookback 0 激活逻辑接口 passive-interface +接口类型 +接口号 配置接口为被动模式 debug ip +协议 动态查看路由更新信息 undebug all 关闭
25、所有 DEBUG 信息 router eigrp +as号 激活EIGRP路由协议 network +网段+子网掩码 发布直连网段 show ip eigrp neighbors 查看邻居表 show ip eigrp topology 查看拓扑表 show ip eigrp traffic 查看发送包数量 router ospf+process-ID 激活 OSPF 协议 network+直连网段+area+区域号发布直连网段 show ip ospf 显示 OSPF 的进程号和 ROUTER-ID encapsulation+封装格式更改圭寸装格式 no ip admain-lookup
26、关闭路由器的域名查找 ip routing 在三层交换机上启用路由功能 show user 查看 SW 的在线用户 clear line +线路号 清除线路3.三层交换机配置命令 配置一组二层端口 configure terminal 进入配置状态 nterface range port-range 进入组配置状态 配置三层端口 configure terminal 进入配置状态 interface fastethernet | gigabitethernet interface-id | vlan vlan-id | portchannel port-channel-number 进入端口配
27、置状态 no switchport 把物理端口变成三层口ip address ip_address subnet_mas配置 IP 地址和掩码 no shutdown 激活端口例:Switch(config)# interface gigabitethernet0/2 Switch(config-if)# no switchportSwitch(config-if)# ip address 192.20.135.21 255.255.255.0 Switch(config-if)# no shutdown配置 VLAN configure terminal 进入配置状态 vlan vlan-i
28、d 输入一个 VLAN 号, 然后进入 vlan 配态,可以输入一个新的 VLAN 号或旧的来进行修改。name vlan-name 可选)输入一个 VLAN 名,如果没有配置 VLAN 名,缺省的名字 是 VLAN 号前面用 0 填满的 4 位数,如 VLAN0004 是 VLAN4 的缺省名字 mtu mtu-size (可选 ) 改变 MTU 大小例Switch# configure terminal Switch(config)# vlan 20 Switch(config-vlan)# name test20 Switch(config-vlan)# end 或Switch# vla
29、n databaseSwitch(vlan)# vlan 20 name test20Switch(vlan)# exit 将端口分配给一个 VLAN configure terminal 进入配置状态 interface interface-id 进入要分配的端口 switchport mode access 定义二层口 switchport access vlan vlan-id 把端口分配给某一 VLANSwitch# configure terminal Enter configuration commands, one per line. End with CNTL/Z. Switch(config)# interface fastethernet0/1 Switch(config-if)#
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1