企业网络的配置命令配置命令

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

001、交换机的配置模式:1)用户模式:Switch>
2)特权模式:Switch>enable
Switch#
3)全局配置模式:Switch>config terminal
Switch(config)#
4)接口配置模式:Switch(config)#interface f0/1
Switch(config-if)#
5)Line模式:Switch(config)#line console 0
Switch(config-line)#
002、配置主机名:Switch(config)#hostname Hostname
003、查看交换机的配置:Switch#show runnning-config
004、使能口令:Switch(config)#enable password Password
005、加密保存的使能口令:Switch(config)#enable secret Password
006、配置IP地址:Switch(config)#interface vlan 1
Switch(config-if)ip address IPaddress Netmask
Switch(config-if)no shutdown
007、配置交换机的网关:Switch(config)#ip default-gateway IPaddress
008、查看交换的MAC地址表:Switch#show mac-address-table
009、保存交换机的配置:Switch#write或
Switch#copy running-config startup-config
010、恢复交换机的出厂设置:Switch#erase startup-config
Erasing the nvram filesystem will remove all configuration files!Contunue?[confirm]
[OK]
Erase of nvramm:complete
Switch#reload
Proceed with reload?[confirm]
011、创建VLAN:1)在全局模式下:①进入配置状态:configure terminal
②输入VLAN 号:vlan vlan-id
③输入VLAN名:name vlan-name
④改变MTU大小:mtu mtu-size
012、
⑤退出:end
⑥验证:show vlan{name vlan-name丨id Vlan-id}
⑦保存设置:copy running-conning startup config
2)在VLAN数据库中:①进入VLAN配置状态:vlan database
②加入VLAN号及VLAN名:vlan vlan-id name vlan-name
③修改MTU大小:vlan vlan-id mtu mtu-size
④更新VLAN数据并退出:exit
⑤验证配置:show vlan{name vlan-name丨id vlan-id}
⑥保存设置:copy running-config startup config
012、删除VLAN:①进入配置状态:config terminal
②删除某一VLAN:no vlan vlan-id
③退出:end
④验证(查看VLAN信息):show vlan brief
⑤保存:copy running-config startup config
013、在VLAN中添加、删除端口:①进入配置状态:configure termina

l
②进入要分配的端口:interface interface-id(interface range f0/n - n+n)
③定义二层端口:Switchport mode access
④把端口分配给某一VLAN:Switchport access vlan-id
⑤退出:end
⑥验证端口的VLAN号:show running-config interface interfcce-id
⑦验证端口的管理模式和VLAN情况:show interfaces interface-id Switch port
⑧保存设置:copy running-config startup-config
014、验证VLAN的配置:Switch#show vlan brief(查看VLAN信息)
Switch#show vlan id vlan-id
015、配置交换机的console密码:①Switch(config)#line console 0
②Switch(config-line)password Password
③Switch(config-line)login
016、配置接口为Trunk模式:Switch(config)#interface interface-ID
Switch(config-if)#switchport mode trunk
配置接口为动态协商模式:Switch(config)#interface interface-ID
Switch(config-if)#switchport mode dynamic desirable/auto
使用show命令验证接口模式(查看端口模式):Switch#show interface interface-ID switchport
从Trunk中删除VLAN:Switch(config)#interface interface-ID
Switch(config-if)#switchport trunk allowed vlan remove vlan-list
在Trunk中添加VLAN:Switch(config)#interface interface-ID
Switch(config-if)#switchport trunk allowed vlan add vlan-lis
017、排除交换网络的故障:1.检查是否问题处在交换机之间的连接上
查看交换机的指示灯状态
线缆的问题?
接口的问题?
查看Trunk接口的模式是否为trunk
配置问题?
协商为题?
查看Trunk端口可以承载的VLAN是否包含了所有需要转发的VLAN
2.检查是否为题处在某个交换机上
查看VLAN ID是否正确
查看接口是否属于应该在的VLAN
定位了故障点,就可以采用是适当的办法但排除故障了
018、在路由器上显示ARP缓存表:Switch#show ip arp
019、1)配置静态路由:Router(config)#ip route network [mask] {address / interface} [distance] [permanent]
network:目的网段地址
mask:子网掩码
address:到达目的的网络经过的下一跳路由器的接口地址
interface:到达目的网络的本地接口(只能是点到点连接类型的接口,不能是广播类型的)
distance

:管理开销。当需要改变默认管理开销时,使用该参数进行修改。
permanent:永久有效。如果配置了该选项,即使该端口被关闭,这条静态路由也不会被删除
2)配置默认路由:Router(config)#ip route 0.0.0.0 0.0.0.0 address
字段“0.0.0.0.0.0.0.0”代表任何网络,也就是说发往任何网络的包都转发到命令指定的下一个路由器接口地址
字段address:到达目的网段经过的下一跳路由器的接口地址。
查看接口状态:Router#show interface 接口类型/序号
例:RA#show interface f0/0
查看路由表:Router#show ip route
020、1)配置路由标识:Router(config)#hostname NAME
2)为路由设置密码:1)配置控制台密码:Router(config)#line console 0
Router(config_line)#login
Router(config_line)#password PASSWORD
2)配置特权模式密码:Router(config)#enable password PASSWORD
3)配置加密保存的密码:Router(config)#enable secret PASSWORD
4)对所有密码加密:Router(config)#service password-encryption
021、配置接口标识:Router(config)#interface f0/0
Router(config)#description This is a fast ethernet port used to connecting the company's intranet!
022、配置Console的其他参数:1)配置超时:Router(config)#line console 0
Router(config)#exec-timeout 0 0
(注:默认的会话超时时间为10分钟,“0 0”代表者时间间隔。第一个“0”代表分钟,第二个“0”代表秒。“0 0”代表永不超时)
2)显示同步:Router(config)#line console 0
Router(config)#logging synchronous
(注:有时候,路由器会显示一些信息,特别是启用了debug命令,这些信息会“打断”当前正在输出的命令。为了避免这种情况,需要启用显示同步)
3)配置仅用DNS:Router(config)#no ip domain-lookup
023、查看路由器的版本信息:Router#show version
使用show version命令可以显示路由器的硬件配置、软件版本、内存大小、配置寄存器设置以及最近启动后的持续运行时间等信息。
024、路由器的密码恢复:如果要使路由器在启动时绕过startup-config的配置,只有修改配置寄存器的值。正常情况下配置寄存器的值是0x2102(0x 代表十六进制),把2102换算成十六进制问:0010.0001.0000.0010,其中第三段中的第二个比特位(即0000中的第二个0)可以控制路由器启动时的顺序。如果该位为0,则表示在启动时运行startup-config的配置,

如果该位为1,则表示在启动时忽略startuop-config的配置,而进入Setup模式。当该位为1是,撇脂寄存器的值应为0x2142。
不同的路由器在执行密码回复是的步骤也不尽相同,下面以Cisco 2600路由器为例
(1)重新启动路由器,在启动60s内按下Ctrl+Break键,使路由器进入 ROM Monitor 模式。
(2)在提示符下输入命令配置寄存器的值,然后重新启动路由器。命令如下:
rommon1>confreg 0x2142
rommon2>reset
(3)重启路由器后进入Steup模式,选择no退回到EXEC模式,此时路由器原有的配置任然保存在startup-config中,为使路由器恢复密码配置不变,应把startup-config中的配置保存到 config中,然后重新设置enable密码。并把配置寄存器的值改回0x2102(否则以后每次重启路由器都进入Steup模式。)命令如下:
Router>enable
Router#copy startup-config running-config
Router#config terminal
Router(config)#enable password cisco
Router(config)#config-register 0x2102
(4)保存当前配置到startup-config,然后从重新启动路由器。命令如下:
Router#copy running-config startup-config
Router#relaod
024、路由器与交换机之间的单臂路由:Router(config)#interface 接口类型 槽位/接口序号.子接口号
Router(config)#encapsulation dot1q vlan-id
Router(config)#ip address ip_address subnetmask
例:teacher(config)#interface f0/0.1
teacher(config)#encapsulation dot1q 1
teacher(config)#ip address 192.168.1.1 255.255.255.0

teacher(config)#interface f0/0.2
teacher(config)#encapsulaton dot1q 2
teacher(config)#ip address 192.168.2.1 255.255.255.0

teacher(config)#interface f0/0.3
teacher(config)#encapsulation dot1q 3
teacher(config)#ip address 192.168.3.1 255.255.255.0
025、查看路由器当前时间:Router#show clock
设置路由器时间:Router#clock set 小时: 分钟:秒 日 月
026、启动RIP进程的命令: Router(config)#router rip
设置为版本2:Router(config-router)#version 2
使用RIP v2的时候,配置不自动汇总:Router(config-router)#no auto-summary
宣告网络号:Router(config-router)#network network-number
查看路由表:Router#show ip route
查看路由协议配置:Router#show ip protocol

开启调试命令:Router#debug ip rip
027、show cdp命令的使用:使用CDP信息协助配置交换和排查交换机故障,是的网络管理员能获得有关直连设备的摘要信息。CDP运用于数据链路层。
Switch# show cdp 显示了设备的CDP的全局配置信息
Switch# show cdp interface Interface-number 显示了接口的CDP配置信息
Switch# show cdp neighbors 以简洁的形式列出了与本设备相连的CISCO设备
Switch# show cdp neighbors detail
Switch# show cdp traffic 显示了有关CDP包的统计信息,主要用来查看其接口收和发的公告报文数
Switch# show cdp entry * | WORD 显示所有入口项的细节

相关文档
最新文档