第五---七章 交换机和路由器的基本配置

简介:

第五---七章   交换机和路由器的基本配置

1IOSIntermetwork Operating System)的优点:
   特性、连通性、可扩展性、可靠性和安全性
 特性    是针对那些为任何规模的网络提供连通性、连通性、可扩展性、可靠性和安全性解决方案的协议和功能的。
 连通性   IOSLANWAN环境,包括铜线和光纤布线以及无线支持多种数据链路层技术。
 可扩展性    IOS同时支持固定和模块化的机架平台,从而使用户能够为自己的需求购买合适的硬件,却仍然允许利用同一IOS CLI以减少用户的管理费用。
 可靠性     为了确保用户的关键资源始终是可达的,cisco已经开发了许多产品和IOS特性以提供网络冗余。
 安全性     利用IOS,用户可以依照内部安全策略严格地控制对网络和连网设备的访问。
2Cisco设备启动时所经历的3个步骤:
     进行硬件测试、定位和加载IOS、定位并且执行这个设备的配置文件。
3.访问IOS CLI的方式:控制台、辅助端口、VTYtelnet)、TFTPSNMP和网络浏览器。
4.配置交换机、路由器
   命令输出:
  %Invlid input detected at ‘^’  表明在这个命令行的哪个位置上存在错误
  %Incomplete command      表明用户没有为这条命令输入任何必要的参数,语法正确,需要更多的参数
 %Ambiguous command command:”show I” 没有键入足够的字符以使一条命令或参数是唯一的
  %Unkown command or computer name,or unable to find computer address  输入了一条IOS不知道的命令
51900系列交换机:
>enable    进入特权模式
#disable   退出特权模式
#configure terminal   进入配置模式
(config)#exit ctrl+Z   退出配置模式
 (config)#hostname 1900     为交换机命名
1900(config)#no hostname 1900    取消命名
(config)#enable password level level_# password  设定用户和特权EXEC口令;用户级别数是1,特权级别数是15
(config)#interface type slot_#/port_#   进入接口
(config)#ip address IP_address subnet_mask   配置IP地址
(config)#ip default-gateway router’s_IP_address  配置网关
(config)#interface Ethernet|fastethernet 0/port_#
(config-if)#duplex auto |full |half |full-flow-control  配置接的双工模式
(config)#mac-address-table permanent MAC_address interface   CAM表中创建静态条目
(config)#mac-address-table restricted static MAC_address source_port list_of_allowed_interfaces  设置静态端口安全措施
用静态端口安全措施
(config-if)#port secure 进入接口启用静态端口安全措施
(config-if)#port secure max-mac-count value 其默认值为132可在1~132范围内改动
(config)#address-violation suspend | ignore | disable 改变其安全选项
3个安全选项:挂起、禁用、忽略
   挂起  挂起此端口直到此端口纠正了违规,然后自动重新启用此端口(默认值)
   禁用  关闭此端口;此端口只能利用no shutdown命令重新启用
   忽略  生成一个安全违规警告
#copy nvram tftp://IP_address_of_tftp_server/file_name
#copy tftp://IP_address_of_tftp_server/file_name nvram
 
>show ip 查看IP地址配置
>show version  查看版本
>show interface Ethernet|Fastethernet 0/port_#  验证接口配置
>show mac-address-table     查看端口地址表或者CAM
>show mac-address-table security  验证端口安全措施
  
 
l          2950系列交换机
>enable
#configure terminal
(config)#hostname 2950
用户加密
(config)#line console 0
(config-line)#password console_password
(config-line)#login
(config)#line vty 0 15
(config-line)#password telnet_password
(config-line)#login
特权加密
(config)#enable password privilege_EXEC_password
/
(config)#enable secret privilege_EXEC_password
 
 
(config)#interface fastethernet | gigabitethernet slot_#/port_#
(config)#interface vlan1
(config-vlan)#ip address IP_address subnet_mask
(config-vlan)#exit
(config)#ip default-gateway router’s_IP_address
(config)#interface fastethernet | gigabit 0/port_#
(config-if)#duplex auto | full | half
(config-if)#speed 10 | 100 | auto 
(config)#mac-address-table static MAC_address vlan vlan_# interface type module/port_# 创建表态条目
(config)#interface fastethernet | gigabit 0/port_#
(config-if)#switchport mode access
(config-if)#switchport port-security
(config-if)#switchport port-security maximum value   指定可与此接口相关的设备最大数量
(config-if)#switch port-security violation protect | restrict | shutdown   指定出现安全违规
(config-if)#switch port-security mac-address MAC_address
(config-if)#switch port-security mac-address sticky   
安全违规命令有3个:保护、限制、关闭
保护   当安全地址的数量达到所允许的最大数量时,学习的任何额外地址都被丢弃。
限制   导致此交换机生成一个安全违规警告
关闭   导致此交换机生成一个警告,并且禁用此接口
#show running-config
#copy running-config startup-config
>show interfaces [type slot_#/port_#]
#show ip interface brief     查看IP地址
>show mac-address-table
>show port interface type slot_#/port_#   验证安全措施
路由器配置
 
Router>en
Router#conf t
Router(config)#hostname dr
#show history       查看先前输入的命令
#terminal history size #_of_commands   更改历史缓存的大小10~256
#terminal no editing        禁用编辑特性
#clock set hh:mm:ss day month year
#setup    运行系统配置会话
(config)#line console 0
(config-line)#password console_password
(config-line)#login
(config)#line vty 0 4
(config-line)#login
(config-line)#password telnet_password
(config)line aux 0
(config-line)#password console_password
(config)#enable password priviledged_EXEC_password
/
(config)#enable secret priviledged_EXEC_password
(config)#banner motd start_and_delimiting_character   enter_your_banner_here
       Enter_the_delimiting_character_to_end_the_banner
(config)#line line_type line_#
(config-line)#exec-timeout minutes seconds   更改休止超时默认10分种,如果想让某条线路永远不超时,可将分钟和秒钟的值设定为0
#terminal monitor     在非控制台线路上查看控制台输出
(config-line)#logging synchronous    在屏幕显示报告信息后,路由器将在一个新的提示后重新显示用户已经键入的字符
(config-if)#description  interfce_dascription     添加接口描述
(config-if)#no shutdown    启用接口
(config-if)#media-type media_type    介质类型有:aui   10baset  100baset mii
(config-if)#speed 10 |100 | auto
(config-if)#[no] half-duplex
(conifg)#interface serial [slot_#] port_#
(config-if)#clock rate rate_in_bit_per_second
>show controller serial 0       查看线缆连接类型
(config)#interface serial [slot_#] port_#
(config-if)#bandwidth rate_in_kbps
 
(config-if)#ip address IP_address subnet_mask
(config)#ip subnet-zero       IOS12.0之前版本使用0子网命令
(conifg-if)#[no] ip directed-broadcast    启用定向广播
#term ip netmask-format bit-count | decimal | hexadecimal   IP子网掩码显示方式
(config-line)#ip netmask-format bit-count | decimal | hexadecimal
(config)ip host name_of_host [TCP_port_#] IP_address_of_host [2nd_IP_address…..]
静态解析表此端口号默认为23,可以定为这台主机每时定多达8IP地址
(config)#ip name-server IP_address_of_DNS_server [2 nd_server’s_IP address ….]DNS解析的配置,这个条目可以指定多达6DNS服务器为路由器所用
(config)#no ip domain-lookup    禁用DNS查询
>show interfaces [type [slot_#/] port_#]
>show ip interface brief
#show hosts      查看路由器解析表中的静态和动态DNS条目
>show version     IOS版本、正常运行了多长时间、RAMNVRAM和闪存的数量、接口类型和数量以及配置寄存器的值
#show running-config
#copy running-config startup-config
#copy running-config tftp
#erase startup-config
#copy system:running-config nvram:startup-config
#copy running-config nvram:startup-config
#more system:running-config
#erase nvram:
#erase nvram:file_name
#copy nvram tftp://IP_address/file_name      RAM为合并过程
#show startup-config  
(config)#boot system flash name_of_IOS_file_in_flash
(config)#boot system system tftp IOS_image_name IP_address_of_server
(config)#boot system rom
(config)#config-register ox hexadecimal_value  默认配置寄存器的值是0x2102,口令恢复值0x2142
Rommon>confreg   利用ctrl-break控制序列进入ROMMON模式
>o/r ox hexadecimal_value     2500系列路由等不支持confreg命令则用该命令改变寄存器的值
#show flash    查看路由器上安装了多少闪存,多少可用,用了多少
(config)#[no] cdp run    全局禁用CDP
(config-if)#[no] cdp enable    基于接口禁用CDP
#show cdp    CiscoCDP状态
#show cdp interface     查看基于接口的CDP配置
#show cdp neighbors   查看与用户Cisco设备相连的CDP邻居的摘要清单
#show cdp entry*   #show cdp neighbor detail   详细的一个实例
#show cdp entry neighbor’s_name      列出一个特定邻居的详细信息  CDP60秒生成一次,抑制计时为180
#name_of_the_destination | destination_IP_address
#telnet/connect name_of_the_destination | destination_IP_address
挂起一个telnet会话,ctrl-shift-6 x ctrl-^
#show sessions    查看目前挂起的已经打开的telnet会话
恢复最后打开的会话,只需在一个空命令行上敲enter
#resume connection_#     恢复一个特定的会话
#disconnect connection_#    结束一个已挂起的telnet会话
#show users     查看登录到这台设备上的其它用户
#clear line line_#    结束某人的会话
#no debug all  #undebug all      禁用debug
(config)#service timestmps debug datetime msec   debug输出中看到所显示的时间戳
#show processes    查看设备的各个进程的CPU使用率
 
7ROM包含启动路由器所必需的固件,通常拥有4个组件:
POST(加电自测试)   在路由器的硬件组件上执行测试;
引导程序   引导路由器并确定如何找到并加载IOS镜像和配置文件;
ROM MonitorROMMON模式) 执低级测试和故障排除(和口令恢复过程)的迷你IOS操作系统,可以用ctrl-break控制序列进入ROMMON模式,提示符可能为 rommon >
迷你IOS    是一个IOS的分拆版本,其中包括IP代码。迷你IOS应该用在不能找到闪存中的IOS镜像,并且用户想要启动这台路由器并加载另一个IOS镜像的紧急情况之中。这个分拆IOS称为RXBOOT,提示符Router(rxboot)#。不是所有的路由器都拥有迷你IOS镜像;另一方面,某些路由器,如7200路由器,可以存储一个完整的IOS镜像。
8RAM  容纳正在运行的IOS镜像、当前的配置文件、所有表(包括路由选择表、ARP表、CDP邻居表和其它表)以及存储临时信息的内部缓存,如接口输入和输出缓存。闪存比RAM路由慢。
9.闪存   用于存储操作系统,而NVRAM用于存储配置文件。
10.配置寄存器是路由器中的一特殊寄存器,它决定路由器如何找到IOS镜像以及配置文件。
 
 
 
 
 
4个十六机制字符的配置寄存器值
最后一位数的值
启动过程
0x0
将路由器引导到 ROMMON 模式
0x1
将路由器引导到使用迷你 IOS RXBOOT 模式
0x2----0xF
使用默认引导顺序引导路由器
 
本文转自 qwjhq 51CTO博客,原文链接:http://blog.51cto.com/bingdian/14089
相关文章
|
3月前
|
监控 数据安全/隐私保护 网络虚拟化
ensp命令练习及交换机 和个路由器的基本命令
ensp命令练习及交换机 和个路由器的基本命令
127 0
|
7月前
|
网络架构
交换机与路由器技术-31-扩展ACL
交换机与路由器技术-31-扩展ACL
17 0
|
1月前
|
网络协议 网络虚拟化 网络架构
交换机入门快速配置
交换机入门快速配置
|
23天前
|
网络协议 安全 网络安全
二层交换机与防火墙对接上网配置示例
二层交换机指的是仅能够进行二层转发,不能进行三层转发的交换机。也就是说仅支持二层特性,不支持路由等三层特性的交换机。 二层交换机一般部署在接入层,不能作为用户的网关
|
7月前
|
网络架构
交换机与路由器技术-36-端口镜像
交换机与路由器技术-36-端口镜像
35 0
|
4月前
|
存储 缓存 网络虚拟化
网络互联设备(集线器、交换机、路由器)
网络互连设备用于将网络的各个部件连接到一起,从连接性质的不同可分为两种: 物理上的互连能力:指所支持的物理接口,能连接的物理介质类型 协议上的互连能力:指工作在不同协议类型的网络之间,实现不同协议数据包的转换。
|
5月前
|
网络协议 网络架构
06 交换机、路由器、服务器组网
06 交换机、路由器、服务器组网
33 0
|
6月前
|
网络虚拟化
华为交换机Trunk配置
华为交换机Trunk配置
109 0
|
6月前
|
网络架构
交换机、集线器、路由器和网桥的区别
交换机、集线器、路由器和网桥的区别
370 1
|
7月前
|
网络架构
交换机与路由器技术-35-NAT转换-PAT
交换机与路由器技术-35-NAT转换-PAT
18 0