CISCO交换机策略路由配置说明
cisco交换机配置简单教程
文档一、标识交换机二、设置口令及用户三、配置VTP (Vlan 中继协议)四、配置中继线(Trunk )五、创建、描述Vlan 及设置Vlan IP六、划分、描述及设置Vlan 端口七、配置STP(生成树协议)八、启用Vlan 间Router九、配置ACL 十、配置DHCP 中继代理十一、配置DHCP 服务器十二、配置HSRP (热备路由协议)十三、保存配置附1:命令行编辑键附2:SHOW 命令附7:ACL 例子一、标识交换机Switch#configure terminal 进入配置状态Switch(config)#hostname “ hostname” 设置Switch 名称Switch (config)#no hostname 取消Switch 名称Switch(config)#end 结束本次配置二、设置口令及用户Switch#configure terminal 进入配置状态Switch(config)#enable secret “ password” 设置特权模式口令及口令Switch(config)#no username “ username” 删除本地用户Switch(config)#service password-encryption 加密所有明文口令Switch(config)#no password-encryption 拒绝加密所有明文口令S w i t c h(c o n f i g)#e n d结束本次配置1、配置console 用户用口令Switch#configure terminal 进入配置状态Switch(config)#line console 0 进入console 口配置状态Switch(config-line)#login local 设置登录模式为本地用户验证模式Switch(config-line)#no login local 取消本地用户验证模式Switch(config-line)#end 结束本次配置或Switch#configure terminal 进入配置状态Switch(config)#line console 0 进入console 口配置状态文档Switch(config-line)#login 设置登录模式为线性登录模式Switch(config-line)#password “ password” 设置线性登录模式口令Switch(config-line)#no login 取消线性登录模式Switch(config-line)#end 结束本次配置2、配置tenlnet(vty) 用户及口令Switch#configure terminal 进入配置状态Switch(config)#line vty 0 15 进入vty 配置状态Switch(config-line)#login local 设置登录模式为本地用户验证模式Switch(config-line)#no login local 取消本地用户验证模式三、配置VTP (Vlan 中继协议)Switch#vlan database 进入vlan 数据库配置状态Switch(vlan)#vtp domain “ domainname” 设置vtp 域Switch(vlan)#vtp server|client| transparent 设置模式Switch(vlan)#vtp password “ password” 设置vtpSwitch(vlan)#no vtp password 取消vtp 口令Switch(vlan)#exit 退出vlan 数据库配置状态Switch(config)#interface range “ interface mod/port -port ” 进入端口组配置状态Switch(config-if-range)#switchport trunk encapsulation dot1q|isl| negotiate 设置干道封装模式Switch(config-if-range)#switchport mode trunk 设置端口为干道模式Switch(config-if-range)#no shutdown 启用端口Switch(config-if-range)#end 结束本次配置五、创建、描述Vlan 及设置Vlan IPSwitch#vlan database 进入vlan 数据库配置状态文档Switch(vlan)#vlan “ vlan-num ” name “ vlan-name” 建立vlan 及名称Switch(vlan)#no vlan “ vlan-num ” 删除vlanSwitch(vlan)#exit 退出vlan 数据库配置状态Switch(config-if)#description “ description ” 描述vlanSwitch(config-if)#no description 取消描述Switch(config-if)#ip address “ ip-address subnet-mask” 设置vlan 网关的ip 地址Switch(config-if)#no shutdown 启用vlanSwitch(config-if)#end 结束本次配置六、划分、描述及设置Vlan 端口Switch#configure terminal 进入配置状态Switch(config)#interface “ interface mod/port ” 进入端口配置状态Switch(config-if)#switchport mode access 设置端口为访问模式Switch(config-if)#switchport access vlan “ vlan-num ” 设置端口所属VlanSwitch(config-if)#no shutdown 启用端口Switch(config-if)#end 结束本次配置或Switch#configure terminal 进入配置状态Switch(config)#interface range “ interface mod/port -port ” 进入端口组配置状态Switch(config-if-range)#description “ description ” 描述端口Switch(config-if-range)#speed auto|100|10 设置端口速率模式Switch(config-if-range)#duplex auto|full|half 设置端口双工模式Switch(config-if-range)#switchport mode access 设置端口为访问模式Switch(config-if-range)#switchport access vlan “ vlan-num ” 设置端口所属Vlan Switch(config-if-range)#no shutdown 启用端口Switch(config-if-range)#end 结束本次配置七、配置STP(生成树协议)Switch#configure terminal 进入配置状态Switch(config)#spanning-tree portfast default 设置所有访问端口为快速模式Switch(config)#no spanning-tree portfast default 取消所有访问端口为快速模式Switch(config)#spanning-tree uplinkfast 设置上行端口为快速模式Switch(config)#no spanning-tree uplinkfast 取消上行端口为快速模式Switch(config)#end 结束本次配置或Switch#configure terminal 进入配置状态Switch(config)#interface “ interfacemod/port ” 进入端口配置状态Switch(config-if)#spanning-tree portfast 设置端口为快速模式文档Switch(config-if)#no shutdown 启用端口Switch(config-if)#end 结束本次配置或Switch#configure terminal 进入配置状态Switch(config)#interface range “ interface mod/port -port ” 进入端口组配置状态Switch(config-if-range)# spanning-tree portfast 设置端口为快速模式Switch(config-if-range)#no shutdown 启用端口Switch(config-if-range)#end 结束本次配置八、启用 Vlan 间 RouterSwitch#configure terminal 进入配置状态Switch(config)#ip routing 启用 ip 路由Switch(config)#ip route “ Destination-prefix Destination-prefix-mask Forwarding-router 's-address ” Switch(config)#end 结束本次配置九、配置 ACLSwitch#configure terminal 进入配置状态Switch(config)#interface vlan “ vlan-num ” 进入 vlan 配置状态 Switch(config-if)#ip access-group “ acl-num ” in|out 应用 acl 到 vlan Switch(config-if)#end 结束本次配置 Switch#configure terminal 进入配置状态Switch(config)#line vty 0 15 进入 vty 配置状态Switch(config-line)#access-class “ acl-num ” in|out 应用 acl 到 vtySwitch(config-if)#end 结束本次配置例:Switch(config)#access-list 101 deny ip host 192.168.2.11 host 192.168.10.21 Switch(config)#access-list 102 deny ip host 192.168.2.13 192.168.10.0 0.0.0.255 Switch(config)#access-list 103 deny ip 192.168.2.0 0.0.0.255 192.168.10.0 0.0.0.255 Switch(config)# access-list 104 deny ip 192.168.2.0 0.0.0.255 host 192.168.10.25十、配置 DHCP 中继代理Switch#configure terminal 进入配置状态Switch(config)#service dhcp 启用 dhcp 服务Switch(config)#ip dhcp relay information option 启用 dhcp 代理服务Switch(config)#interface vlan “ vlan-num ” 进入 vlan 配置状态Switch(config-if)#ip helper-address “ ip-address ” 启用 dhcp 代理服务器 ip 地Switch(config-if)#end 结束本次配置文档十一、配置 DHCP 服务器Switch#configure terminal进入配置状态Switch (config)#ip dhcp pool “ Pool-name ” 设置 dhcp 地址池名称Switch (dhcp-config)#network “ Network-num Network-mask ” 设置 dhcp 地址池 ip 围 Switch (dhcp-config)# dns-server “ ip-address ” 为客户机分配 DNS 服务器 ip 地址 Switch (dhcp-config)#netbios-name-server “ ip-address ” 为客户机分配 WINS 服务器 ip 地址Switch#configure terminal 进入配置状态Switch(config)#service dhcp 启用dhcp 服务wyz(config)#ip dhcp excluded-address “ Low-ip-address High-ip-address ” 设置保留ip 地址Switch(config-if)#end 结束本次配置十二、配置HSRP (热备路由协议)Switch#configure terminal 进入配置状态Switch(config)#interface vlan “ vlan-num ” 进入vlan 配置状态Switch(config-if)#ip address “ ip-address subnet-mask” 设置vlan 物理ip 地址Switch(config-if)#standby “ group-num ” ip “virtual-ip-address ” 设置vlan 虚拟ip 地址Switch(config-if)#standby priority “ Priority-value ” 设置路由器优先等级Switch(config-if)#standby preempt 设置hsrp 抢占功能Switch(config-if)#standby timers “ Hello-interval-in-seconds Hold-time-in-seconds ”设置hello 信息Switch(config-if)#end 结束本次配置十三、保存配置Switch#write memory或Switch#copy running-config startup-config 附1:命令行编辑键TAB 补全命令?查看可用命令Ctrl + P 粘贴历史命令Ctrl + E 将光标移至命令末尾Ctrl + F 将光标向前移动Ctrl + B 将光标向后移动Ctrl + Z 返回#命令模式Ctrl + U Clear Line and Put in BufferCtrl + W Delete Word Backwards and Put in Buffer文档Ctrl + Y Paste Buffer ContentsCtrl + X Clear Line to the Left and Put in BufferCtrl + T Flip Last 2 CharactersCtrl + J ReturnCtrl + L Refresh LineCtrl + I Refresh Line and Goto EndCtrl + K Delete everything on the Right of cursorCtrl + V Allows to type control characterCtrl + M ReturnCtrl + H Backspace Character to the LeftCtrl + R 刷新行附2:SHOW 命令Switch#show version 显示版本信息Switch #show arp | include “ ip-address” 显示ip 地址对应的mac 地址信息Switch#show mac-address-table 显示mac 地址信息Switch#show mac-address-table | include “ mac-address” 格式:xxxx.xxxx.xxxx.xxxx Switch #show mac-address-table dynamic address “ mac-address” 显示mac 地址对应的端口信息Switch#show mac-address-table dynamic interface “ interface mod/port ” 显示端口对应的mac 地址信息Switch#show tech-support 显示技术支持信息Switch#show interfaces 显示接口信息Switch#show vlan 显示vlan 信息Switch#show startup-config 显示启用配置文件Switch#show running-config 显示运行配置文件Switch#show ip route 显示ip 路由状态Switch#clear counters interface “ interface mod/port ” 清除端口计数器Switch(config)#default interface “ interface mod/port ” 恢复端口出厂设置Switch#clear interface “ interface mod/port ” 重置端口的硬件逻辑keyada#show cdp neighbors “ interface mod/port ” detail 附7:ACL 例子VLAN1 需实现以下效果:1、VLAN1 主机192.168.1.240 可以访问所有网段;2、VLAN1 其余主机可以访问除VLAN2 、VLAN3 及VLAN4 外所有网段。
Cisco交换机做策略路由
Cisco交换机做策略路由Cisco交换机做策略路由阅读:980次时间:2011-07-12 20:29:23字体:[大中小]以节约成本、合理利用现有设备为原则,笔者制定了一个解决方案:利用MikroTikRouterOS,改造了几台办公淘汰下来的普通PC做成软路由,分担原来防火墙的流量来共同承担网络的出口任务,在三层交换机上做策略路由实现数据的不同流向,从而达到分流的目的。
关于软路由(ROS)的安装配置等问题本文不做阐述,本文主要针对策略路由的实现及做策略路由时碰到的问题及优化进行详细阐述。
策略路由中所谓策略的制定依赖于访问控制列表(ACL),因此策略路由中策略的制定是方便而又灵活的,可以满足不同方面的需求。
这样,在vlan201接口下符合access-list100的数据就被转发到以10.10.3.2为内网接口的软路由上了,从而实现了分流。
关键词:策略路由,分流,ACL,软路由0 .引言校园网是高校信息化建设的基础设施,也是教学管理信息化现代化的必要平台。
随着笔者所在学院的发展、网络应用的不断增加,原来的网络日益无法满足需求。
后虽升级了网络核心三层交换机,但购买于早期的出口防火墙,因性能有限,越来越成为校园网络的瓶颈。
升级网络出口设备当然是解决这一瓶颈比较好的方法,但一款高性能的路由器或防火墙往往价格不菲,而且还可能存在单点失效问题,不能完全解决问题。
为此,以节约成本、合理利用现有设备为原则,笔者制定了一个解决方案:利用MikroTik RouterOS,改造了几台办公淘汰下来的普通PC做成软路由,分担原来防火墙的流量来共同承担网络的出口任务,在三层交换机上做策略路由实现数据的不同流向,从而达到分流的目的。
关于软路由(ROS)的安装配置等问题本文不做阐述,本文主要针对策略路由的实现及做策略路由时碰到的问题及优化进行详细阐述。
1.策略路由简介策略路由是一种比利用目标网络进行路由更加灵活的数据包路由转发机制,策略路由的优先级别高于普通路由。
Cisco路由器交换机配置命令详解
Cisco路由器交换机配置命令详解1. 交换机支持的命令:交换机基本状态:switch: ;ROM状态,路由器是rommon〉hostname〉;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switch〉enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname 〈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 ;设置登录口令xx switch#exit ;返回命令交换机VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlanswitch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain 〈name〉;设置发vtp域名switch(config)#vtp password 〈word〉;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address 〈IP〉〈mask〉;设置IP地址switch(config)#ip default-gateway 〈IP〉;设置默认网关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 〈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 ;设置登录口令xxrouter(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〉〈netmask〉;设置IP地址router(config-if)#ip address 〈ip〉〈netmask〉second ;设置第二个IP router(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address 〈ip〉〈netmask〉;设置子接口IProuter(config-subif.1)#encapsulation dot1q 〈n〉;绑定vlan中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config ;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon〉confreg 0x2142 ;跳过配置文件rommon〉confreg 0x2102 ;恢复配置文件rommon〉reset ;重新引导rommon〉copy xmodem:〈sname〉flash:〈dname〉;从console传输文件rommon〉IP_ADDRESS=10.65.1.2 ;设置路由器IPrommon〉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 〈ip-address〉〈subnet-mask〉〈gateway〉;命令格式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路由协议。
CISCO交换机基本配置和使用概述
CISCO交换机基本配置和使用概述CISCO交换机是一种常用的网络设备,用于构建局域网(Local Area Network,LAN)。
它可以通过物理线路的连接,将多台计算机或其他网络设备连接到同一个网络中,实现数据的传输和共享。
CISCO交换机的基本配置包括IP地址的配置、VLAN的配置、端口配置、安全性配置等。
接下来,我们将对这些配置进行详细说明。
首先,IP地址的配置是CISCO交换机的基本操作之一。
通过配置IP地址,我们可以对交换机进行管理和监控。
具体的配置步骤如下:1. 进入交换机的配置模式。
在命令行界面输入"enable"命令,进入特权模式。
2. 进入全局配置模式。
在特权模式下输入"configure terminal"命令,进入全局配置模式。
3. 配置交换机的IP地址。
在全局配置模式下输入"interfacevlan 1"命令,进入虚拟局域网1的接口配置模式。
然后输入"ip address 192.168.1.1 255.255.255.0"命令,配置交换机的IP地址和子网掩码。
4. 保存配置并退出。
在接口配置模式下输入"exit"命令,返回到全局配置模式。
然后输入"exit"命令,返回到特权模式。
最后输入"copy running-config startup-config"命令,保存配置到闪存中。
其次,VLAN的配置是CISCO交换机的关键配置之一。
通过配置VLAN,我们可以将交换机的端口划分为不同的虚拟局域网,实现数据的隔离和安全。
1. 进入交换机的配置模式。
同样,在特权模式下输入"configure terminal"命令,进入全局配置模式。
2. 创建VLAN。
在全局配置模式下输入"vlan 10"命令,创建一个编号为10的VLAN。
思科交换机路由基本配置命令
思科交换机路由基本配置命令常用命令1.配置接口:interface {interface_type} {interface_number}2.配置IP地址:ip address {IP_address} {subnet_mask}3.配置默认网关:ip default-gateway {default_gateway_IP}4.开启接口:no shutdown5.配置路由协议:router {routing_protocol}6.配置路由器ID:router-id {router_ID}7.配置路由信息:network {network_address} {subnet_mask}8.配置静态路由:ip route {destination_network} {subnet_mask}{next-hop_IP}9.配置动态路由:router {routing_protocol} {network_address}10.保存配置:copy running-config startup-config注意:上述命令仅作为参考,具体配置应根据实际环境和设备型号进行调整。
下面是一些基本的 Cisco 交换机路由配置命令:1.配置 hostname: hostname <name>2.配置 IP 地址: interface <interface> 后进入接口模式,再输入 ipaddress <ip address> <subnet mask>3.配置默认路由: ip route 0.0.0.0 0.0.0.0 <next hop IP>4.启用路由协议: router <protocol> (例如: router rip)5.配置路由连接: network <network address> (例如: network192.168.1.0)6.查看路由表: show ip routeCisco 交换机路由配置步骤1.进入配置模式:configure terminal2.配置 IP 地址和子网掩码:interface [interface-name] ; ip address[ip-address] [subnet-mask]3.配置默认路由:ip route 0.0.0.0 0.0.0.0 [next-hop-IP-address]4.启用路由协议:router [protocol-name] (如:router ospf)5.配置路由协议参数: [protocol-name] [process-id] (如:ospf 1)6.配置路由连接:network [network-address] [wildcard-mask] area[area-id] (如:network 192.168.1.0 0.0.0.255 area 0)7.保存配置:copy running-config startup-config8.退出配置模式:exit。
思科Cisco交换机配置手册配置教程
配置接口特性这一章详细说明交换机上的接口和描述怎么配置他们。
这章有以下这些内容:●理解接口类型●使用接口命令●配置二层接口●监控和维护第二层接口●配置第三从接口注意:需要完整的有关该章的语法和应用信息,请参考Catalyst 3550 Multilayer Switch Command Reference和Cisco IOS Interface Command Referencefor Release 12.1.理解接口类型这个部分描述了不同的接口类型,以及其它章节所包括的详细配置这些接口的一些参考内容。
其他章节描述了物理接口特性的配置过程。
这部分包括:•基于端口的VLAN (Port-Based VLANs)•交换端口(Switch Ports)•以太网通道端口组(EtherChannel Port Groups)•交换虚拟接口(Switch Virtual Interfaces)•被路由端口(Routed Ports)•连接接口(Connecting Interfaces)基于端口的VLAN (Port-based Vlans)一个Vlan是一个按功能、组、或者应用被逻辑分段的交换网络,并不考虑使用者的物理位置。
要更多关于Vlan的信息请看“Configuring VLANS”。
一个端口上接受到的包被发往属于同一个Vlan的接收端口。
没有一个第三层的设备路由Vlan间的流量,不同Vlan的网络设备无法通讯。
为了配置普通范围(Normal-range) Vlan(Vlan IDs 1-1005),使用命令:config-vlan模式(global) vlan vlan-id或vlan-configuration模式(exec) vlan database针对Vlan ID 1-1005的vlan-configration模式被保存在vlan数据库中。
为配置扩展范围(extended-range) Vlans (Vlan ID 1006-4094),你必须使用config-vlan模式,并把VTP的模式设为transparent透明模式。
2024年度Cisco交换机配置教程
VLAN可以将交换机上的端口划分成不同的虚拟局域网,实现广 播域的隔离和不同部门之间的安全通信。
通过配置访问控制列表(ACL)、端口安全等功能,可以提高交 换机的安全性,防止未经授权的访问和网络攻击。
33
拓展学习资源推荐(书籍、网站等)
4
交换机工作原理
交换机根据收到数据帧中的源 MAC地址建立该地址同交换机 端口的映射,并将其写入MAC
地址表中。
交换机将数据帧中的目的MAC 地址同已建立的MAC地址表进 行比较,以决定由哪个端口进
行转发。
2024/3/23
如数据帧中的目的MAC地址不 在MAC地址表中,则向所有端 口转发。这一过程称为泛洪( Flood)。
2024/3/23
查看MAC地址表
使用“show mac-address-table” 命令查看交换机的MAC地址表,包 括MAC地址、接口、VLAN等信息。
查看路由表
如果交换机配置了路由功能,可使用 “show ip route”命令查看路由表 信息。
14
04
端口配置与VLAN划分
Chapter
01
02
03
04
书籍推荐
《Cisco交换机配置与管 理》、《网络工程师必读 ——交换机/路由器配置 与管理》等。
网站推荐
Cisco官方网站、华为企 业网络学院、网络技术论 坛等。
在线课程推荐
Coursera、网易云课堂 、51CTO学院等在线教 育平台上提供的相关课程 。
实验环境推荐
GNS3、EVE-NG等网络 模拟器可以在个人计算机 上搭建虚拟实验环境,进 行交换机配置的实践操作 。
Cisco路由器、交换机基本配置方法
常用命令—et hostname|IP address
网络侦测
ping hostname|IP address
路由跟踪
trace hostname|IP address
常用命令—基本设置命令
任务 全局设置 设置访问用户及密码 设置特权密码 命令 config terminal username username password password enable secret password
设置队列表中队列的大小
queue-list list-number queue queuenumber byte-count byte-count-number
ip access-group list {in | out}
使用指定的访问表
ACL——访问控制举例
Router1: access-list 1 deny 192.1.3.0 0.0.0.255 access-list 1 permit any interface serial 0 ip access-group 1 in
指定内部和外部 端口
ip nat {inside | outside}
网络地址翻译配置举例
设置如下: ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192 interface Ethernet 0 ip address 10.0.0.1 255.255.255.0 ip nat inside ! interface Serial 0 ip address 202.200.10.5 255.255.255.252 ip nat outside ! ip route 0.0.0.0 0.0.0.0 Serial 0 access-list 2 permit 10.0.0.0 0.0.0.255 ! Dynamic NAT ! ip nat inside source list 2 pool c2501 overload line console 0 exec-timeout 0 0 ! line vty 0 4 end
2024版思科网络交换机配置命令详细总结归纳
VLAN间路由配置
01 02 03 04
使用`interface`命令进入三层接口配置模式,如`interface vlan 10`进入 VLAN 10的三层接口。
源端口和目的端口散列
同时考虑数据包的源端口和目的端口进行负载均衡。
配置负载均衡策略
在全局配置模式下使用`port-channel load-balance`命令进行配置。
端口聚合故障排除技巧
01
检查物理连接
确保所有参与聚合的物理端口都已 正确连接。
03
检查交换机配置
确认交换机的配置是否正确,包括 聚合模式、聚合组号等。
限制登录用户
指定允许通过SSH远程登录的用户或用户组。
交换机日志与审计功能启用
启用日志功能
将交换机操作记录到日志文件中,方便后续 审计和分析。
远程日志服务器
将日志文件发送到远程日志服务器进行集中 存储和管理。
配置日志级别
根据需要设置日志记录的详细程度(如信息、 警告、错误等)。
审计功能
启用审计功能,对特定操作进行实时监控和 记录。
思科网络交换机配置命令详细 总结归纳
目 录
• 交换机基本配置 • VLAN配置与管理 • 生成树协议(STP)配置与优化 • 端口聚合(EtherChannel)配置与应用 • 交换机安全性设置与加固 • 交换机性能监控与故障排除
01
交换机基本配置
交换机登录与访问控制
1 2
通过控制台端口登录 使用终端仿真软件通过控制台端口连接到交换机, 输入用户名和密码进行登录。
策略路由-交换机配置
1.1.1CISCO交换机配置方法一、(不具备逃生方案)建立ACLip access-list extended policy-route-aclpermit ip any anyexit配置route-map路由图route-map policy-routematch ip address policy-route-aclset ip next-hop 192.168.100.123exit在接口上应用route-mapinterface vlan 54ip policy route-map policy-routeexit方法二、(具备逃生方案)建立ACLaccess-list 101 permit ip 192.168.36.0 0.0.0.255 anyip access-list extended policy-route-aclpermit ip any anyexit配置带下跳检测的route-map路由图ip sla monitor 1type echo protocol ipIcmpEcho 172.28.1.11frequency 8ip sla monitor schedule 1 life forever start-time nowtrack 123 rtr 1 reachabilityip sla monitor 2type echo protocol ipIcmpEcho 172.28.1.12frequency 8ip sla monitor schedule 2 life forever start-time nowtrack 223 rtr 2 reachabilityroute-map policy_routematch ip address policy-route-aclset ip next-hop verify-availability 172.28.1.11 10 track 123 set ip next-hop verify-availability 172.28.1.12 20 track 223 在接口上应用route-mapinterface vlan 200ip policy route-map policy-routeCISCO EEM逃生方案#创建一个event managerevent manager applet PBR#您那边的event manager如果版本是3.0的话应该支持#event track 1的用法,我们这里只支持syslog进行模式匹配event syslog pattern "Interface FastEthernet0/3, changed state to down" action 1.0 syslog msg "PBR to shutdown the interface vlan 112"action 1.1 cli command "en"action 1.3 cli command "config term"action 1.5 cli command "int vlan 112"action 1.7 cli command "shutdown"1.1.2H3C交换机配置1.2.2.1policy-based-route方法配置建立ACLacl number 3040rule 0 permit ip source anyquit配置policy-based-route路由图policy-based-route policy-route permit node 10if-match acl 3040apply ip-address next-hop 192.168.100.123quit在接口应用policy-based-routeinterface Ethernet0/3.40ip policy-based-route policy-routequit1.2.2.2qos policy方法配置配置ACL策略[H3C7506E]acl number 3040[H3C7506E-acl-adv-3040] rule 10 permit ip source any[H3C7506E-acl-adv-3040]quit配置匹配ACL的流分类1[H3C7506E] traffic classifier 1[H3C7506E-classifier-1] if-match acl 3040[H3C7506E-classifier-1] quit配置刚才定义的流分类1的行为,定义如果匹配就下一跳至192.168.100.123 [H3C7506E] traffic behavior 1[H3C7506E-behavior-1] redirect next-hop 192.168.100.123[H3C7506E-behavior-1] quit将刚才设置的流分类及行为应用至QOS策略中,定义policy 1[H3C7506E] qos policy 1[H3C7506E-qospolicy-1] classifier 1[H3C7506E-qospolicy-1] behavior 1[H3C7506E-qospolicy-1] quit在接口上应用定义的QOS策略policy 1[H3C7506E] interface GigabitEthernet 2/0/11[H3C7506E-GigabitEthernet2/0/11] qos apply policy 1 inbound[H3C7506E-GigabitEthernet2/0/11] quit1.2.2.3route policy方法配置建立ACLacl number 3000rule 0 permit ip source anyquit配置route policy路由图route-policy policy-route permit node 1if-match acl 3000apply ip-address next-hop 192.168.100.123quit在接口应用route policyinterface Ethernet1/0ip policy route-policy policy-routequit1.2.2.4traffic-redirect方法配置建立ACLacl number 3000rule 0 permit ip source anyquit在接口应用traffic-redirecinterface GigabitEthernet6/1/1traffic-redirect inbound ip-group 3000 rule 0 next-hop 192.168.100.123quit逃生方案:traffic-redirect inbound ip-group 3000 rule 0 next-hop 192.168.100.123 in forword1.1.3华为交换机配置1.2.3.1traffic-policy方法配置配置ACL策略acl number 3040rule 10 permit ip source anyquit配置匹配ACL的流分类1traffic classifier 1if-match acl 3040quit配置刚才定义的流分类1的行为,定义如果匹配就下一跳至192.168.100.123 traffic behavior 1redirect next-hop 192.168.100.123quit将刚才设置的流分类及行为应用至traffic-policy策略中,定义policy 1traffic policy 1classifier 1 behavior 1quit在接口上应用定义的QOS策略policy 1interface GigabitEthernet 2/0/11traffic-policy 1 inboundquit1.2.3.2traffic-redirect方法配置建立ACLacl number 3000rule 0 permit ip source anyquit在接口应用traffic-redirecinterface GigabitEthernet6/1/1traffic-redirect inbound ip-group 3000 rule 0 next-hop 192.168.100.123quit1.2.3.3route policy方法配置建立ACLacl number 3000rule 0 permit ip source anyquit配置route policy路由图route-policy policy-route permit node 1if-match acl 3000apply ip-address next-hop 192.168.100.123quit在接口应用route policyinterface Ethernet1/0ip policy route-policy policy-routequit。
ROUTE-POLICY策略路由规则详解
ROUTE-POLICY策略路由规则详解在工程中经常遇到rou te-policy用于策略路由的情况,下面就对ro ute-polic和ACL间的匹配规则详解如下:一、试验环境A(E0/0)--192.168.1.0--(E0/0)B(S0/0)--10.0.0.0--(S0/0)C(E0/0)--192.168.2.0--(E0/0)D拓扑说明:AB之间的网段为192.168.1.0 。
AB分别通过E0/0口互联。
CD之间的网段为192.168.2.0 。
CD分别通过E0/0口互联。
BC之间分别通过S0/0 中间通过帧中继交换机互联,共配置3个子接口,DLCI分别是100200 300(两端相同)。
二、测试结论:未做任何策略#interf ace Ethern et0/0ip addres s 192.168.1.1 255.255.255.0=在路由器ATracer t路由结果如下:<AR2810-A>dis clock08:48:03 UTC Fri 11/28/2008<AR2810-A>tracer t -m 5 -a 192.168.1.2 192.168.2.2tracer outeto 192.168.2.2(192.168.2.2) 5 hops max,40 bytespacketPressCTRL_C to break1 192.168.1.1 3 ms 1 ms2 ms2 10.0.0.10 19 ms 18 ms 19 ms3 192.168.2.2 20 ms 21 ms 20 ms由此可得出未做rout e-policy的时候,是按照全局路由表中的路由条目转发数据流的。
1、 permit+permit#interf ace Ethern et0/0ip addres s 192.168.1.1 255.255.255.0ip policy route-policy t1#acl number 3000rule 0 permit ip source 192.168.1.0 0.0.0.255 destin ation 192.168.2.0 0.0.0.255acl number 3001rule 0 deny ip source 192.168.1.0 0.0.0.255 destin ation 192.168.2.0 0.0.0.255#route-policy t1 permit node 10if-matchacl 3000applyip-addres s next-hop 10.0.0.2route-policy t1 permit node 20applyip-addres s next-hop 10.0.0.6在路由器ATracer t路由结果如下:<AR2810-A>dis clock08:50:33 UTC Fri 11/28/2008<AR2810-A>tracer t -m 5 -a 192.168.1.2 192.168.2.2tracer outeto 192.168.2.2(192.168.2.2) 5 hops max,40 bytespacketPressCTRL_C to break1 192.168.1.12 ms 2 ms 1 ms2 10.0.0.2 20 ms 20 ms 22 ms3 192.168.2.2 19 ms 20 ms 19 ms由此结果可得出此时数据流匹配了规则node 10 。
思科Cisco策略路由(policyroute)详细介绍
思科Cisco策略路由(policyroute)详细介绍注:PBR以前是CISCO⽤来丢弃报⽂的⼀个主要⼿段。
⽐如:设置set interface null 0,按CISCO说法这样会⽐ACL的deny要节省⼀些开销。
这⾥我提醒:interface null 0no ip unreachable //加⼊这个命令这样避免因为丢弃⼤量的报⽂⽽导致很多ICMP的不可达消息返回。
三层设备在转发数据包时⼀般都基于数据包的⽬的地址(⽬的⽹络进⾏转发),那么策略路由有什么特点呢?1、可以不仅仅依据⽬的地址转发数据包,它可以基于源地址、数据应⽤、数据包长度等。
这样转发数据包更灵活。
2、为QoS服务。
使⽤route-map及策略路由可以根据数据包的特征修改其相关QoS项,进⾏为QoS服务。
3、负载平衡。
使⽤策略路由可以设置数据包的⾏为,⽐如下⼀跳、下⼀接⼝等,这样在存在多条链路的情况下,可以根据数据包的应⽤不同⽽使⽤不同的链路,进⽽提供⾼效的负载平衡能⼒。
策略路由影响的只是本地的⾏为,所以可能会引起“不对称路由”形式的流量。
⽐如⼀个单位有两条上⾏链路A与B,该单位想把所有HTTP流量分担到A 链路,FTP流量分担到B链路,这是没有问题的,但在其上⾏设备上,⽆法保证下⾏的HTTP流量分担到A链路,FTP流量分担到B链路。
策略路由⼀般针对的是接⼝⼊(in)⽅向的数据包,但也可在启⽤相关配置的情况下对本地所发出的数据包也进⾏策略路由。
本⽂就策略路由的以下四个⽅⾯做相关讲解:1、启⽤策略路由2、启⽤Fast-Switched PBR3、启⽤Local PBR4、启⽤CEF-Switched PBR启⽤策略路由:开始配置route-map。
使⽤route-map map-tag [permit | deny] [sequence-number]进⼊route-map的配置模式。
使⽤match语句定义感兴趣的流量,如果不定义则指全部流量。
CISCO交换机路由器配置手册
CISCO交换机路由器配置手册王国栋编著……………… 目录………………交换机1、cisco 2950 交换机2、cisco 1950 交换机3、VLAN 间的通信路由器一、路由器配置1、路由器基本配置2、路由器的密码恢复3、恢复出厂设置4、备份IOS5、恢复IOS6、备份路由器配置7、静态路由的配置8、RIP路由协义配置9、IGRP路由协议配置10、EIGRP路由协议配置11、ospf路由协议基本配置12、点到点链路上的ospf13、广播链路上的ospf14、基于区域的ospf简单口今及MD5认证15、多区域的OSPF16、OSPF末节区域和完全末节区域17、OSPF命令汇总二、ACL NAT DHCP1、标准访问控制列表(Access Control Iists ) (list 列表)2、扩展访问控制列表(Access Control Iists ) (list 列表)3、命名ACL4、NAT(network address translation)网络地址翻译(1)、静态NAT配置(2)、动态NAT(3)、PAT(端口地址转换)配置5、DHCP (dynamic host configuration protocol) 动态主机配置协议三、远程接入、VPN1、HDLC (高级数据链路控制high-level data link control)2、路由器serial端口的基本配置3、PPP(1)、PPP的PAP认证(2)、PPP的CHAP认证4、帖中继(1)、帧中继基本配置(2)、点对多点帧中继(3)、|点对点帧中继上的RIP协议5、DDN(Digital Data Network 数字数据网)和数字链路6、ISDN7、ADSL Asymmetrical digital subscriber loop 非对称数字用户环路8、VPN 虚专用网络(Virtual Private Networks)交换机部分一、交换机配置图:二、环境说明:S2950-1 S2950-2 为12端口快速以太网交换机三、配置实例:1、cisco 2950 交换机当你no password 取消掉了密码,Ethernet路由器Router串口控制线8芯双绞线TFPTserver路由器Router8芯双绞线(网线) Ethernet串口控制线TFPTserverarea 0R1(config-router)# area 0 authenticationarea 0R2(config-router)# area 0 authenticationarea 0R1(config-router)#area 0 authentication message-digest area 0R1(config-router)#area 0 authentication message-digestnat inside source list 1 pool nat-name-pat overloadandwidth只是影响路由选择时,一些链路状态路由选路时,运算度量值有关,你不用特意去改动它.就算你改了,也不会影响实际带宽的。
CISCO交换机策略路由配置说明
Configuring Policy-Based RoutingYou can use policy-based routing (PBR) to configure a defined policy for traffic flows. By using PBR, you can have more control over routing by reducing the reliance on routes derived from routing protocols. PBR can specify and implement routing policies that allow or deny paths based on:•Identity of a particular end system•Application•ProtocolYou can use PBR to provide equal-access and source-sensitive routing, routing based on interactive versus batch traffic, or routing based on dedicated links. For example, you could transfer stock records to a corporate office on a high-bandwidth, high-cost link for a short time while transmitting routine application data such as e-mail over a low-bandwidth, low-cost link.With PBR, you classif y traffic using access control lists (ACLs) and then make traffic go through a different path. PBR is applied to incoming packets. All packets received on an interface with PBR enabled are passed through route maps. Based on the criteria defined in the route maps, packets are forwarded (routed) to the appropriate next hop.•If packets do not match any route map statements, all set clauses are applied.•If a statement is marked as permit and the packets do not match any route-map statements, the packets are sent through the normal forwarding channels, and destination-based routing is performed.•For PBR, route-map statements marked as deny are not supported.For more information about configuring route maps, see the "Using Route Maps to Redistribute Routing Information" section.You can use standard IP ACLs to specify match criteria for a source address or extended IP ACLs to specify match criteria based on an application, a protocol type, or an end station. The process proceeds through the route map until a match is found. If no match is found, normaldestination-based routing occurs. There is an implicit deny at the end of the list of match statements.If match clauses are satisfied, you can use a set clause to specify the IP addresses identifying the next hop router in the path.For details about PBR commands and keywords, see the Cisco IOS IP Command Reference, Volume 2 of 3: Routing Protocols, Release 12.2. For a list of PBR commands that are visible but not supported by the switch, see Appendix C, "Unsupported Commands inCisco IOS Release 12.2(35)SE,"Note This software release does not support PBR when processing IPv4 and IPv6 traffic.PBR Configuration GuidelinesBefore configuring PBR, you should be aware of this information:•To use PBR, you must have the IP services image installed on the switch.•Multicast traffic is not policy-routed. PBR applies to only to unicast traffic.•You can enable PBR on a routed port or an SVI.•The switch does not support route-map deny statements for PBR.•You can apply a policy route map to an EtherChannel port channel in Layer 3 mode, but you cannot apply a policy route map to a physical interface that is a member of the EtherChannel. If you try to do so, the command is rejected. When a policy route map is applied to a physical interface, that interface cannot become a member of an EtherChannel.•You can define a maximum of 246 IP policy route maps on the switch.•You can define a maximum of 512 access control entries (ACEs) for PBR on the switch.•When configuring match criteria in a route map, follow these guidelines:–Do not match ACLs that permit packets destined for a local address. PBR would forward these packets, which could cause ping or Telnet failure or route protocol flapping.–Do not match ACLs with deny ACEs. Packets that match a deny ACE are sent to the CPU, which could cause high CPU utilization.•To use PBR, you must first enable the routing template by using the sdm prefer routing global configuration command. PBR is not supported with the VLAN or default template. For more information on the SDM templates, see Chapter 7, "Configuring SDM Templates."•VRF and PBR are mutually exclusive on a switch interface. You cannot enable VRF when PBR is enabled on an interface. In contrast, you cannot enable PBR when VRF is enabled on an interface.•The number of TCAM entries used by PBR depends on the route map itself, the ACLs used, and the order of the ACLs and route-map entries.•Policy-based routing based on packet length, TOS, set interface, set default next hop, or set default interface are not supported. Policy maps with no valid set actions or with set action set to Don't Fragment are not supported.•Beginning with Cisco IOS Release 12.2(35)SE, the switch supports quality of service (QoS) DSCP and IP precedence matching in PBR route maps with these limitations:–You cannot apply QoS DSCP mutation maps and PBR route maps to the same interface.–You cannot configure DSCP transparency and PBR DSCP route maps on the same switch.–When you configure PBR with QoS DSCP, you can set QoS to be enabled (by entering the mls qos global configuration command) or disabled (by entering the no mls qos command). When QoS is enabled, to ensure that the DSCP value of the traffic is unchanged, you should configure DSCP trust state on the port where traffic enters the switch by entering the mls qos trust dscp interface configuration command. If the trust state is not DSCP, by default all nontrusted traffic would have the DSCP value marked to 0.Enabling PBRBy default, PBR is disabled on the switch. To enable PBR, you must create a route map that specifies the match criteria and the resulting action if all of the match clauses are met. Then, you must enable PBR for that route map on an interface. All packets arriving on the specified interface matching the match clauses are subject to PBR.PBR can be fast-switched or implemented at speeds that do not slow down the switch.Fast-switched PBR supports most match and set commands. PBR must be enabled before you enable fast-switched PBR. Fast-switched PBR is disabled by default.Packets that are generated by the switch, or local packets, are not normally policy-routed. When you globally enable local PBR on the switch, all packets that originate on the switch are subject to local PBR. Local PBR is disabled by default.Note To enable PBR, the switch must be running the IP services image.Beginning in privileged EX EC mode, follow these steps to configure PBR:•••Use the no route-map map-tag global configuration command or the no match or no setroute-map configuration commands to delete an entry. Use the no ip policy route-map map-tag interface configuration command to disable PBR on an interface. Use the no ip route-cache policyinterface configuration command to disable fast-switching PBR. Use the no ip local policy route-map map-tag global configuration command to disable policy-based routing on packets originating on the switch.。
cisco交换机配置实例教程
cisco交换机配置实例教程每个接口每个方向只支持一个策略;一个策略可以用于多个接口。
接下来是小编为大家收集的cisco交换机配置实例教程,希望能帮到大家。
cisco交换机配置实例教程1、在交换机上启动QOSSwitch(config)#mls qos //在交换机上启动QOS2、分别定义PC1(10.10.1.1)和PC2(10.10.2.1)访问控制列表Switch(config)#access-list 10 permit 10.10.1.0 0.0.0.255 //控制pc1上行流量Switch(config)#access-list 100 permit any10.10.1.0 0.0.0.255 //控制pc1下行流量 Switch(config)#access-list11 permit 10.10.2.0 0.0.0.255 //控制pc2上行流量Switch(config)#access-list 111 permit any 10.10.2.0 0.0.0.255 //控制pc2下行流量class-map mach-all {name}match access-group 110policy-mapclass二、详细配置过程注:每个接口每个方向只支持一个策略;一个策略可以用于多个接口。
因此所有PC的下载速率的限制都应该定义在同一个策略(在本例子当中为policy-map user-down),而PC不同速率的区分是在Class-map分别定义。
1、在交换机上启动QOSSwitch(config)#mls qos //在交换机上启动QOS2、分别定义PC1(10.10.1.1)和PC2(10.10.2.1)访问控制列表Switch(config)#access-list 10 permit 10.10.1.0 0.0.0.255 //控制pc1上行流量Switch(config)#access-list 100 permit any 10.10.1.0 0.0.0.255 //控制pc1下行流量Switch(config)#access-list 11 permit 10.10.2.0 0.0.0.255 //控制pc2上行流量Switch(config)#access-list 111 permit any 10.10.2.0 0.0.0.255 //控制pc2下行流量3、定义类,并和上面定义的访问控制列表绑定Switch(config)# class-map user1-up //定义PC1上行的类,并绑定访问列表10Switch(config-cmap)# match access-group 10Switch(config-cmap)# exitSwitch(config)# class-map user2-upSwitch(config-cmap)# match access-group 11 //定义PC2上行的类,并绑定访问列表10Switch(config-cmap)# exitSwitch(config)# class-map user1-downSwitch(config-cmap)# match access-group 100 //定义PC1下行的类,并绑定访问列表100Switch(config-cmap)# exitSwitch(config)# class-map user2-downSwitch(config-cmap)# match access-group 111 //定义PC2下行的类,并绑定访问列表111Switch(config-cmap)# exit4、定义策略,把上面定义的类绑定到该策略Switch(config)# policy-map user1-up //定义PC1上行的速率为1MSwitch(config-pmap)# class user1-upSwitch(config-pmap-c)# trust dscpSwitch(config-pmap-c)# police 1024000 1024000 exceed-action dropSwitch(config)# policy-map user2-up //定义PC2上行的速率为2MSwitch(config-pmap)# class user2-upSwitch(config-pmap-c)# trust dscpSwitch(config-pmap-c)# police 2048000 1024000 exceed-action dropSwitch(config)# policy-map user-downSwitch(config-pmap)# class user1-downSwitch(config-pmap-c)# trust dscpSwitch(config-pmap-c)# police 1024000 1024000 exceed-action dropSwitch(config-pmap-c)# exitSwitch(config-pmap)# class user2-downSwitch(config-pmap-c)# trust dscpSwitch(config-pmap-c)# police 2048000 1024000 exceed-action dropSwitch(config-pmap-c)# exit5、在接口上运用策略Switch(config)# interface f0/1Switch(config-if)# service-policy input user1-upSwitch(config)# interface f0/2Switch(config-if)# service-policy input user2-upSwitch(config)# interface g0/1Switch(config-if)# service-policy input user-down看了“cisco交换机配置实例教程”还想看:1.思科交换机基本配置实例讲解2.CISCO交换机配置操作学习教程3.思科交换机配置教程详解4.cisco交换机qos配置实例教程5.思科路由器、交换机的基本管理教程6.Cisco 2960交换机的基础安装配置教程。
策略路由设置命令
在Cisco路由器中,策略路由(Policy Routing)是一种允许管理员使用路由映射来控制数据包如何被路由的方法。
以下是一些关键的策略路由设置命令:定义访问控制列表(ACL):(config)# access-list 1 permit host 192.168.1.1定义路由映射(route-map):(config)# route-map pdb permit 10其中,pdb是route-map的名称,10是序列号。
匹配条件(在配置路由映射后):查询ACL 1是否满足条件。
设置下一跳地址(如果满足上述条件):(config-route-map)# set ip next-hop 192.168.1.6这将设置下一跳地址为192.168.1.6。
设置出向接口(如果需要):(config-route-map)# set interface GigabitEthernet0/0参数指定接口的类型和编号。
如果定义了多个接口,则使用第一个被发现的up接口。
应用策略路由:要应用策略路由,需要将其绑定到接口:(config-if)# ip policy route-map pdb这里的pdb应替换为你的路由映射名称。
其他相关命令:ip route: 显示路由表中的所有路由。
show ip route: 显示当前路由器的路由表。
clear ip route: 清除路由表中的所有条目。
ip classless: 允许路由器处理类域间路由(CIDR)。
ip helper-address: 设置帮助其他设备获取DHCP配置的IP地址。
ip default-network: 设置或显示IP默认网络的名称。
ip redirects: 允许或禁止ICMP重定向消息。
ip proxy-arp: 允许或禁止执行代理ARP。
注意事项: 策略路由可以非常复杂,具体配置可能会根据网络的具体需求和环境而有所不同。
【cisco交换机安全配置设定】 cisco交换机配置教程
【cisco交换机安全配置设定】 cisco交换机配置教程你还在为不知道cisco交换机安全配置设定而烦恼么?接下来是为大家收集的cisco交换机安全配置设定教程,希望能帮到大家。
cisco交换机安全配置设定的方法一、交换机访问控制安全配置1、对交换机特权模式设置密码尽量采用加密和md5 hash 方式switch(config)#enable secret 5 pass_string其中 0 Specifies an UNENCRYPTED password will follow5 Specifies an ENCRYPTED secret will follow建议不要采用enable password pass_sting密码,破解及其容易!2、设置对交换机明文密码自动进行加密隐藏switch(config)#service password-encryption3、为提高交换机管理的灵活性,建议权限分级管理并建立多用户switch(config)#enable secret level 7 5pass_string7 /7级用户进入特权模式的密码switch(config)#enable secret 5 pass_string15 /15级用户进入特权模式的密码switch(config)#username userA privilege 7 secret 5 pass_userAswitch(config)#username userB privilege 15 secret 5 pass_userB/为7级,15级用户设置用户名和密码,Ciscoprivilege level分为0-15级,级别越高权限越大switch(config)#privilege exec level 7 commands /为7级用户设置可执行的命令,其中commands可以根据分配给用户的权限自行定义4、本地console口访问安全配置switch(config)#line console 0switch(config-line)#exec-timeout 5 0 /设置不执行命令操作的超时时间,单位为分钟和秒switch(config-line)#logging synchronous /强制对弹出的干扰日志信息进行回车换行,使用户输入的命令连续可见设置登录console口进行密码验证方式(1):本地认证switch(config-line)#password 7 pass_sting /设置加密密码switch(config-line)#login /启用登录验证方式(2):本地AAA认证switch(config)#aaa new-model /启用AAA认证switch(config)#aaa authentication login console-in group acsserver local enable/设置认证列表console-in优先依次为ACS Server,local用户名和密码,enable特权密码switch(config)#line console 0switch(config-line)# login authentication console-in /调用authentication设置的console-in列表5、远程vty访问控制安全配置switch(config)#access-list 18 permit host x.x.x.x /设置标准访问控制列表定义可远程访问的PC主机switch(config)#aaa authentication login vty-in group acsserver local enable/设置认证列表vty-in, 优先依次为ACS Server,local 用户名和密码,enable特权密码switch(config)#aaa authorization commands 7 vty-in group acsserver local if-authenticated/为7级用户定义vty-in授权列表,优先依次为ACS Server,local授权switch(config)#aaa authorization commands 15 vty-in group acsserver local if-authenticated/为15级用户定义vty-in授权列表,优先依次为ACS Server,local授权switch(config)#line vty 0 15switch(config-line)#access-class 18 in /在线路模式下调用前面定义的标准ACL 18switch(config-line)#exec-timeout 5 0 /设置不执行命令操作的超时时间,单位为分钟和秒switch(config-line)#authorization commands 7 vty-in /调用设置的授权列表vty-inswitch(config-line)#authorization commands 15 vty-inswitch(config-line)#logging synchronous /强制对弹出的干扰日志信息进行回车换行,使用户输入的命令连续可见switch(config-line)#login authentication vty-in /调用authentication设置的vty-in列表switch(config-line)#transport input ssh /有Telnet 协议不安全,仅允许通过ssh协议进行远程登录管理6、AAA安全配置switch(config)#aaa group server tacacs+ acsserver /设置AAA服务器组名switch(config-sg-tacacs+)#server x.x.x.x /设置AAA 服务器组成员服务器ipswitch(config-sg-tacacs+)#server x.x.x.xswitch(config-sg-tacacs+)#exitswitch(config)# tacacs-server key paa_string /设置同tacacs-server服务器通信的密钥二、交换机网络服务安全配置禁用不需要的各种服务协议switch(config)#no service padswitch(config)#no service fingerswitch(config)#no service tcp-small-serversswitch(config)#no service udp-small-serversswitch(config)#no service configswitch(config)#no service ftpswitch(config)#no ip http serverswitch(config)#no ip http secure-server/关闭http,https远程web管理服务,默认cisco交换机是启用的三、交换机防攻击安全加固配置MAC Flooding(泛洪)和Spoofing(欺骗)攻击预防方法:有效配置交换机port-securitySTP攻击预防方法:有效配置root guard,bpduguard,bpdufilter VLAN,DTP攻击预防方法:设置专用的native vlan;不要的接口shut或将端口模式改为accessDHCP攻击预防方法:设置dhcp snoopingARP攻击预防方法:在启用dhcp snooping功能下配置DAI和port-security在级联上层交换机的trunk下switch(config)#int gi x/x/xswitch(config-if)#sw mode trunkswitch(config-if)#sw trunk encaps dot1qswitch(config-if)#sw trunk allowed vlan x-xswitch(config-if)#spanning-tree guard loop/启用环路保护功能,启用loop guard时自动关闭root guard接终端用户的端口上设定switch(config)#int gi x/x/xswitch(config-if)#spanning-tree portfast/在STP中交换机端口有5个状态:disable、blocking、listening、learning、forwarding,只有处于forwarding状态的端口才可以发送数据。
Cisco_思科_策略路由地概念_原理_配置实例
策略路由1策略路由概述221.2 策略路由的概念21.2.1 策略路由21.2.2 路由策略52 策略路由的实现原理52.1 策略路由的好处52.2 策略路由的流程672.3.1 流模式和逐包模式72.3.2 流模式流程图72.3.2 路由器流模式与逐包模式切换命令82.4 Route-map原理与执行82.4.1 Route-map概念82.4.2 理解Route-map82.4.3 Route-map 的执行语句83 策略路由的规划设计103.1 策略路由的适用环境103.2 策略路由的配置103.2.1 路由器根本配置103.2.2 交换机根本配置143.3 策略路由的验证和调试164 策略路由部署应用案例174.1 策略路由配置案例一17174.1.2功能需求:174.1.3配置实现:184.2 策略路由配置案例二18184.2.2功能需求:194.2.3配置实现:194.3 策略路由配置案例三20204.3.2功能需求:214.3.3配置实现:214.3.4配置优化:231策略路由概述普通路由转发基于路由表进展报文的转发;路由表的建立直联路由、主机路由;静态配置路由条目;动态路由协议学习生成;查看命令——show ip route对于同一目的网段,可能存在多条distance不等的路由条目1.2 策略路由的概念1.2.1 策略路由所谓策略路由,顾名思义,即是根据一定的策略进展报文转发,因此策略路由是一种比目的路由更灵活的路由机制。
在路由器转发一个数据报文时,首先根据配置的规如此对报文进展过滤,匹配成功如此按照一定的转发策略进展报文转发。
这种规如此可以是基于标准和扩展访问控制列表,也可以基于报文的长度;而转发策略如此是控制报文按照指定的策略路由表进展转发,也可以修改报文的IP优先字段。
因此,策略路由是对传统IP路由机制的有效增强。
策略路由能满足基于源IP地址、目的IP址、协议字段,甚至于TCP、UDP 的源、目的端口等多种组合进展选路。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Configuring Policy-Based RoutingYou can use policy-based routing (PBR) to configure a defined policy for traffic flows. By using PBR, you can have more control over routing by reducing the reliance on routes derived from routing protocols. PBR can specify and implement routing policies that allow or deny paths based on:•Identity of a particular end system•Application•ProtocolYou can use PBR to provide equal-access and source-sensitive routing, routing based on interactive versus batch traffic, or routing based on dedicated links. For example, you could transfer stock records to a corporate office on a high-bandwidth, high-cost link for a short time while transmitting routine application data such as e-mail over a low-bandwidth, low-cost link.With PBR, you classif y traffic using access control lists (ACLs) and then make traffic go through a different path. PBR is applied to incoming packets. All packets received on an interface with PBR enabled are passed through route maps. Based on the criteria defined in the route maps, packets are forwarded (routed) to the appropriate next hop.•If packets do not match any route map statements, all set clauses are applied.•If a statement is marked as permit and the packets do not match any route-map statements, the packets are sent through the normal forwarding channels, and destination-based routing is performed.•For PBR, route-map statements marked as deny are not supported.For more information about configuring route maps, see the "Using Route Maps to Redistribute Routing Information" section.You can use standard IP ACLs to specify match criteria for a source address or extended IP ACLs to specify match criteria based on an application, a protocol type, or an end station. The process proceeds through the route map until a match is found. If no match is found, normaldestination-based routing occurs. There is an implicit deny at the end of the list of match statements.If match clauses are satisfied, you can use a set clause to specify the IP addresses identifying the next hop router in the path.For details about PBR commands and keywords, see the Cisco IOS IP Command Reference, Volume 2 of 3: Routing Protocols, Release 12.2. For a list of PBR commands that are visible but not supported by the switch, see Appendix C, "Unsupported Commands inCisco IOS Release 12.2(35)SE,"Note This software release does not support PBR when processing IPv4 and IPv6 traffic.PBR Configuration GuidelinesBefore configuring PBR, you should be aware of this information:•To use PBR, you must have the IP services image installed on the switch.•Multicast traffic is not policy-routed. PBR applies to only to unicast traffic.•You can enable PBR on a routed port or an SVI.•The switch does not support route-map deny statements for PBR.•You can apply a policy route map to an EtherChannel port channel in Layer 3 mode, but you cannot apply a policy route map to a physical interface that is a member of the EtherChannel. If you try to do so, the command is rejected. When a policy route map is applied to a physical interface, that interface cannot become a member of an EtherChannel.•You can define a maximum of 246 IP policy route maps on the switch.•You can define a maximum of 512 access control entries (ACEs) for PBR on the switch.•When configuring match criteria in a route map, follow these guidelines:–Do not match ACLs that permit packets destined for a local address. PBR would forward these packets, which could cause ping or Telnet failure or route protocol flapping.–Do not match ACLs with deny ACEs. Packets that match a deny ACE are sent to the CPU, which could cause high CPU utilization.•To use PBR, you must first enable the routing template by using the sdm prefer routing global configuration command. PBR is not supported with the VLAN or default template. For more information on the SDM templates, see Chapter 7, "Configuring SDM Templates."•VRF and PBR are mutually exclusive on a switch interface. You cannot enable VRF when PBR is enabled on an interface. In contrast, you cannot enable PBR when VRF is enabled on an interface.•The number of TCAM entries used by PBR depends on the route map itself, the ACLs used, and the order of the ACLs and route-map entries.•Policy-based routing based on packet length, TOS, set interface, set default next hop, or set default interface are not supported. Policy maps with no valid set actions or with set action set to Don't Fragment are not supported.•Beginning with Cisco IOS Release 12.2(35)SE, the switch supports quality of service (QoS) DSCP and IP precedence matching in PBR route maps with these limitations:–You cannot apply QoS DSCP mutation maps and PBR route maps to the same interface.–You cannot configure DSCP transparency and PBR DSCP route maps on the same switch.–When you configure PBR with QoS DSCP, you can set QoS to be enabled (by entering the mls qos global configuration command) or disabled (by entering the no mls qos command). When QoS is enabled, to ensure that the DSCP value of the traffic is unchanged, you should configure DSCP trust state on the port where traffic enters the switch by entering the mls qos trust dscp interface configuration command. If the trust state is not DSCP, by default all nontrusted traffic would have the DSCP value marked to 0.Enabling PBRBy default, PBR is disabled on the switch. To enable PBR, you must create a route map that specifies the match criteria and the resulting action if all of the match clauses are met. Then, you must enable PBR for that route map on an interface. All packets arriving on the specified interface matching the match clauses are subject to PBR.PBR can be fast-switched or implemented at speeds that do not slow down the switch.Fast-switched PBR supports most match and set commands. PBR must be enabled before you enable fast-switched PBR. Fast-switched PBR is disabled by default.Packets that are generated by the switch, or local packets, are not normally policy-routed. When you globally enable local PBR on the switch, all packets that originate on the switch are subject to local PBR. Local PBR is disabled by default.Note To enable PBR, the switch must be running the IP services image.Beginning in privileged EX EC mode, follow these steps to configure PBR:•••Use the no route-map map-tag global configuration command or the no match or no setroute-map configuration commands to delete an entry. Use the no ip policy route-map map-tag interface configuration command to disable PBR on an interface. Use the no ip route-cache policyinterface configuration command to disable fast-switching PBR. Use the no ip local policy route-map map-tag global configuration command to disable policy-based routing on packets originating on the switch.。