中易网

交换机与路由器的常用配置命令

答案:2  悬赏:30  
解决时间 2021-04-08 07:16
要带有详细解释的!谢谢
最佳答案
1. 交换机支持的命令:
交换机基本状态: switch: ;ROM状态,
路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态

交换机口令设置: switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname ;设置交换机的主机名
switch(config)#enable secret xxx ;设置特权加密口令
switch(config)#enable password xxa ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
switch(config-line)#login ;允许登录
switch(config-line)#password xx ;设置登录口令
xxswitch#exit ;返回命令

交换机VLAN设置:

switch#vlan database ;进入VLAN设置
switch(vlan)#vlan 2 ;建VLAN 2
switch(vlan)#no vlan 2 ;删vlan 2
switch(config)#int f0/1 ;进入端口1
switch(config-if)#switchport access vlan 2 ;当前端口加入
vlan 2switch(config-if)#switchport mode trunk ;设置为干线
switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan
switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继
switch(config)#vtp domain ;设置发vtp域名
switch(config)#vtp password ;设置发vtp密码
switch(config)#vtp mode server ;设置发vtp模式
switch(config)#vtp mode client ;设置发vtp模式

交换机设置IP地址:

switch(config)#interface vlan 1 ;进入vlan 1
switch(config-if)#ip address ;设置IP地址
switch(config)#ip default-gateway ;设置默认网关
switch#dir flash: ;查看闪存

交换机显示命令:

switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch#show int f0/0 ;查看指定端口信息

2. 路由器支持的命令:
路由器显示命令:

router#show run ;显示配置信息
router#show interface ;显示接口信息
router#show ip route ;显示路由信息
router#show cdp nei ;显示邻居信息
router#reload ;重新起动

路由器口令设置:

router>enable ;进入特权模式
router#config terminal ;进入全局配置模式
router(config)#hostname ;设置交换机的主机名
router(config)#enable secret xxx ;设置特权加密口令
router(config)#enable password xxb ;设置特权非密口令
router(config)#line console 0 ;进入控制台口
router(config-line)#line vty 0 4 ;进入虚拟终端
router(config-line)#login ;要求口令验证
router(config-line)#password xx ;设置登录口令xx
router(config)#(Ctrl+z) ; 返回特权模式
router#exit ;返回命令

路由器配置:

router(config)#int s0/0 ;进入Serail接口
router(config-if)#no shutdown ;激活当前接口
router(config-if)#clock rate 64000 ;设置同步时钟
router(config-if)#ip address ;设置IP地址
router(config-if)#ip address second ;设置第二个IP
router(config-if)#int f0/0.1 ;进入子接口
router(config-subif.1)#ip address ;设置子接口IP
router(config-subif.1)#encapsulation dot1q ;绑定vlan中继协议
router(config)#config-register 0x2142 ;跳过配置文件
router(config)#config-register 0x2102 ;正常使用配置文件
router#reload ;重新引导

路由器文件操作:

router#copy running-config startup-config ;保存配置
router#copy running-config tftp ;保存配置到tftp
router#copy startup-config tftp ;开机配置存到tftp
router#copy tftp flash: ;下传文件到flash
router#copy tftp startup-config;下载配置文件ROM状态:
Ctrl+Break ;进入ROM监控状态
rommon>confreg 0x2142 ;跳过配置文件
rommon>confreg 0x2102 ;恢复配置文件
rommon>reset ;重新引导
rommon>copy xmodem: flash: ;从console传输文件

rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP
rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码
rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IP
rommon>TFTP_FILE=c2600.bin ;指定下载的文件
rommon>tftpdnld ;从tftp下载
rommon>dir flash: ;查看闪存内容
rommon>boot ;引导IOS

静态路由:

ip route ;命令格式router(config)#ip route 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 ;启动RIP路由协议。
router(config-router)#network ;设置发布路由
router(config-router)#negihbor ;点对点帧中继用。

最好是去官方网站参考手册。
全部回答
我也在学习这个 。我觉得我看的这个还行你复制下慢慢看吧 计算机命令: pca login: root ;使用root用户 password: linux ;口令是linux # shutdown -h now ;关机 # init 0 ;关机 # logout # login # ifconfig ;显示ip地址 # ifconfig eth0 netmask ;设置ip地址 # ifconfig eht0 netmask down ; 删除ip地址 # route add 0.0.0.0 gw # route del 0.0.0.0 gw # route add default gw ;设置网关 # route del default gw ;删除网关 # route ;显示网关 # ping # telnet ;建立telnet之前先ping一下 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 交换机基本状态: switch: ;rom状态, 路由器是 rommon> hostname> ;用户模式 hostname# ;特权模式 hostname(config)# ;全局配置模式 hostname(config-if)# ; 接口状态 交换机口令设置: switch>enable ;进入特权模式 switch#config terminal ;进入全局配置模式 switch(config)#hostname ;设置交换机的主机名 switch(config)#enable secret xxx ;设置特权加密口令为 xxx switch(config)#enable password xxx ;设置特权非密口令为 xxx switch(config)#line console 0 ;进控制台口(rs232)初始化 switch(config-line)#line vty 0 4 ;进入虚拟终端virtual tty switch(config-line)#login ;允许登录 switch(config-line)#password xx ;设置登录口令xx switch#exit ;返回命令 交换机vlan设置: switch#vlan database ;进入vlan设置 switch(vlan)#vlan 2 ;建vlan 2 switch(vlan)#no vlan 2 ;删vlan 2 switch(config)#int f0/1 ;进入端口1 switch(config-if)#switchport access vlan 2 ;当前端口1加入vlan 2 switch(config-if)#switchport mode trunk ;设置为干线 交换机设置ip地址: switch(config)#interface vlan 1 ;进入vlan 1 switch(config-if)#ip address ;添加远程登录ip switch(config)#ip default-gateway ;添加默认网关 switch#dir flash: ;查看内存 交换机显示命令: switch#write ;写入保存 switch#show run ;查看当前配置信息 switch#show vlan ;看vlan switch#show interface ;显示所有端口信息 switch#show int f0/0 ;显示端口0的信息 switch#reload ;重新起动 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 路由器显示命令: router#show run ;显示接口 router#show interface ;显示接口 router#show ip route ;显示路由 router#show cdp nei ;看阾居 设置口令: router>enable ;进入特权模式 router#config terminal ;进入全局配置模式 router(config)#hostname ;设置交换机的主机名 router(config)#enable secret xxx ;设置特权加密口令为 xxx router(config)#enable password xxx ;设置特权非密口令为 xxx router(config)#line console 0 ;进控制台口(rs232)初始化 router(config-line)#line vty 0 4 ;进入虚拟终端virtual tty router(config-line)#login ;允许登录 router(config-line)#password xx ;设置登录口令xx router(config)# (ctrl+z) ; 返回特权模式 router#exit ;返回命令 配置ip地址: router(config)#int s0/0 ;进行串serail接口 router(config-if)#no shutdown ;起动接口 router(config-if)#clock rate 64000 ;设置时钟 router(config-if)#ip address 10.1.1.1 255.255.0.0 ;设置ip地址和子网掩码 router(config-if)#ip add 10.1.1.2 255.255.0.0 second; router(config-if)#int f0/0.1 ; 进入子接口 router(config-subif.1)#ip address ; router(config-subif.1)#encapsulation isl ; router(config)#config-register 0x2142 ;跳过配置文件 router(config)#config-register 0x2102 ;正常使用配置文件 router#reload ;重新引导 复制操作: router#copy running-config startup-config ;存配置 router#copy running-config tftp ;上载 router#copy startup-config tftp router#copy tftp flash: ;特权模式下升级ios router#copy tftp startup-config ;下载配置文件到nvram rom状态: ctrl+break ;进入rom监控状态 rommon>confreg 0x2142 ;跳过配置,26 36 45xx rommon>confreg 0x2102 ;使用配置,恢复工作状态 rommon>reset ;重新引导,等效于重开机 rommon>copy xmodem: flash: ;从console升级ios rommon>ip_address=10.65.1.100 ;设置路由器ip (默认端口) rommon>ip_subnet_mask=255.255.0.0 ;设置路由器掩码 rommon>tftp_server=10.65.1.48 ;指定tftp服务器ip rommon>tftp_file=c2600.t ;所要下载的文件 rommon>tftpdnld ;rom监控状态下升级ios rommon>dir flash: ;查看闪存中的内容 rommon>boot ;引导ios 静态路由: ip route 例: router(config)#ip route 10.1.0.0 255.255.0.0 10.2.1.1 router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 动态路由: router(config)#ip routing ;启动路由 router(config)#router rip ;启动rip路由协议。 router(config-router)#network ;配置范围,有的支持all。 router(config-router)#negihbor ;点对点 帧中继用。 帧中继命令: router(config)# frame-relay switching ;使能帧中继交换 router(config-s0)# encapsulation frame-relay ;使能帧中继 router(config-s0)# frame-relay intf-type dce ;dce端(需要配虚电路) router(config-s0)# frame-relay local-dlci 20 ;配置虚电路号 基本访问控制列表: router(config)#access-list permit|deny router(config)#interface ;default: deny any router(config-if)#ip access-group in|out ;default: out 例: rb(config)#access-list 4 permit 10.8.1.1 rb(config)#access-list 4 deny 10.8.1.0 0.0.0.255 rb(config)#access-list 4 permit 10.8.0.0 0.0.255.255 rb(config)#access-list 4 deny 10.0.0.0 0.255.255.255 rb(config)#access-list 4 permit any rb(config)#int f0/0 rb(config-if)#ip access-group 4 in 扩展访问控制列表: access-list permit|deny icmp [type] access-list permit|deny tcp [port] 例1: router(config)# access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echo router(config)# access-list 101 permit ip any any router(config)# int s0/0 router(config-if)#ip access-group 101 in 例2: 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 out router(config)#no access-list 102 router(config-if)#no ip access-group 101 in
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
吉林市珲春街夜市儿和江南夜市儿几月几号开?
在中国内“布加迪”车大概有多少辆?在中国有
哈佛大学,剑桥大学和牛津大学最大的区别在哪
和平区妇女儿童保健中心A我想知道这个在什么
你从唯一的观众这篇课文中体会到了什么
降息降准为什么人民币汇率会下跌
潜水艇改变自身重力为什么浮力不变
我玩CF时进去游戏里面玩 突然卡住了 怎么办
天猫已经退货退款成功了怎么看运费险赔偿
格兰仕电热水器不通电,电源指示灯也不亮,复
汇缘轩本命佛白玉黄金的价格
上海华山医院做甲状腺癌手术多少钱
谁有用过淼淼淼瘦腿霜,效果怎么样,多少钱,
今年羊的行情怎么样呢
永州到桂林恭城要多久
推荐资讯
苹果4用的手机卡其它手机能装装下吗
浙江理工大学考研难吗
微博中的名人微博是真的还是假的?
proe中,如何使草绘线落在实体边上,点落在实
外地人在南通买了学区房但户口没过来小孩可以
took off的过去式是什么
excel 左上角分号怎么输入
网线通了,但是上不去网,是怎么回事啊?
康熙来了满族铜火锅这个地址在什么地方,我要
平安一账通卡和信用卡的区别
具体讲老汤姆.里德尔的死是哪一部
南家沟这个地址在什么地方,我要处理点事
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?