pc(config)#ip default-gateway [address]
router(config)#ip route [ip] [mask] [下一跳ip] 或 router(config)#ip route [ip] [mask] [送出接口] #删除静态路由 router(config)#no ip route [network] [network-mask]
router(config)#ip router [ip] [mask] [下一跳ip] [管理距离] 例:#假若有R3和R5有两条相连的链路,想要其中一条变成备份的 R3(config)#ip route 0.0.0.0 0.0.0.0 10.1.20.2 25 R5(config)#ip route 0.0.0.0 0.0.0.0 10.1.20.1 25
router(config)#interface loopback 1 router(config-if)#ip address [ip] [mask]
router(config)#router rip router(config-router)#passive-int [type][slot/number]
router(config)#int fa0/0.1(标识子接口号) router(config-subif)#encapsulation dot1q 1(标识承载哪一个vlan流量,为vlan ID,此时承载vlan 1的流量) router(config-subif)#ip address 172.16.1.254 255.255.255.0
vlan database vlan 13
switchport mode access/trunk
switchport access vlan [vlan ID]
router(config)#int f0/0 router(config-if)#vrrp 2 ip 192.168.13.254 vrrp 2 priority 20 vrrp 2 preempt vrrp 12 ip 192.168.13.100 vrrp 12 priority 10 vrrp 12 preempt #vrrp定时器
sw(config)#int vlan 13 sw(config-if)#ip add 192.168.13.100 255.255.255.0
sw(config)#spanning-tree vlan 13 priority ?
sw(config-if)#fa0/4 sw(config-if)#spanning-tree portfast
sw(config)#interface port-channel 1 sw(config-if)#ex sw(config)#int range fa0/23,fa0/24 sw(config-if-range)#channel-group 1 mode on
line vty 0 2
router(config)#hostname R router(config)#line vty 0 4 router(config-line)#password [远程登录密码] router(config-line)#login #telnet配置进入特权模式的密码 router(config)#enable secret [密码]
router#clock set 9:00:00 2 jan 2010
#建立并定义time-range接口 R5(config)#time-range time1 R5(config-time-range)#absolute start 8:00 1 jan 1998 end 17:00 30 dec 2020 R5(config-time-range)#periodic daily 00:01 to 17:59 R5(config)#time-range time2 R5(config-time-range)#absolute start 8:00 1 jan 1998 end 17:00 30 dec 2020 R5(config-time-range)#periodic daily 19:01 to 23:59 #定义基于时间的ACL R5(config)#ip access-list extend net_list1 R5(config-ext-nacl)#permit tcp any host 5.5.5.5 R5(config-ext-nacl)#deny ip any host 5.5.5.5 time-range time1 R5(config-ext-nacl)#deny ip any host 5.5.5.5 time-range time2 R5(config-ext-nacl)#permit ip any any R5(config-ext-nacl)#end #将访问列表规则应用在网络接口上 R5(config)#int s0/0 R5(config-if)#ip access-group net_list1 in R5(config-if)#end
router(config)#router rip router(config-router)#version [1/2] router(config-router)#network [主网号] router(config-if)#no auto-summary(ripv2) router(config-if)#ip rip receive v 1 2(接收ripv1和ripv2的数据包)
#设置钥匙链和钥匙 router(config)#int [type][slot/number] router(config-if)#key chain [keychain name] router(config-keychain)#key [编号] router(config-keychain-key)#key-string [password] #在端口上放置钥匙链 router(config)#int [type][slot/number] router(config-if)#ip rip authentication key-chain [keychain name] router(config-if)#ip rip authentication mode md5(密文认证)
router(config-if)#encapsulation ppp
router(config)#router ospf 1 router(config-router)#router-id [loopback-ip] router(config)#network [主网地址] [反掩码] area [area-id]
#修改ospf的优先级选举DR和BDR
router(config)#ip ospf priority [level]
#直连路由分布到ospf域 router(config)#router ospf 1 router(config-router)#redistribute connected subnets [metric] [number] [metric-type] [number] #rip分布到ospf域 router(config-router)#redistribute rip subnets
#区域1配置成末梢区域 router(config-router)#area 1 stub #区域2配置成彻底末梢区域(只需在ABR上配置本参数,stub中的其余仍是配置成末梢区域) router(config-router)#area 2 stub no-summary #nssa区域(nssa内的每一个router都要敲上) router(config-router)#area 1 nssa
router(config-if)#ip ospf priority [level]
router(config-if)#bandwidth [带宽]
router(config-if)#ip ospf hello-interval seconds router(config-if)#ip ospf dead-interval seconds
#配置区域内路由汇总(abr上) router(config)router ospf 1 router(config-router)#area 1 range [主网地址] [网络掩码] #配置外部自治系统路由汇总(asbr上) router(config-router)#summary-address [主网地址] [网络掩码]
router(config)#router bgp 100 router(config-router)#no synchronization(关闭同步) router(config-router)#no auto-summary(关闭自动汇总) router(config-router)#bgp router-id [loopback ip](配置BGP路由器ID) router(config-router)#neighbor [ip] remote-as 100(指定邻居路由器及所在的AS) router(config-router)#neighbor [ip] update-source loopback0(制定更新源) router(config-router)#network [ip] mask [掩码]
#配置下一跳,对EBGP邻居传入的路由,通告给IBGP邻居的同时配置以下
router(config)#router bgp 100 router(config-router)#no synchronization router(config-router)#bgp router-id [ip] router(config-router)#neighbor [ip] remote-as 100 router(config-router)#neighbor [ip] update0source loopback0 router(config-router)#neighbor [ip] next-hop-self
#将BGP表中的路由条目聚合汇总,并通告进BGP进程 Router(config-router)#aggregate-address + [聚合IP地址(summary-only)] #硬启动BGP进程,从新启动和其余全部路由器的BGP邻居关系 Router# clear ip bgp * #软启动BGP进程,当配置了策略路由后,更新传递给特定BGP邻居的路由条目 Router# clear ip bgp + BGP邻居IP + soft + in/out
router(config-router)#aggregate-address [聚合后的网络号] [聚合后的网络掩码] 例: router(config-router)#aggregate-address 1.1.0.0 255.255.252.0 #bgp的as-set参数 router(config-router)#aggregate-address [聚合后的网络号] [聚合后的网络掩码] as-set 例: router(config-router)#aggregate-address 1.1.0.0 255.255.252.0 as-set #summary-only参数(只想看到汇总路由,没有明细路由) router(config-router)#aggregate-address 1.1.0.0 255.255.252.0 as-set summary-only
FR(config)#frame-relay switching FR (config)#interface [type] [slot/number] FR (config-if)#no ip address FR (config-if)#no shut down FR (config-if)#encapsulation frame-relay ietf FR (config-if)#frame-relay intf-type DCE FR (config-if)#frame-relay lmi-type ansi FR (config-if)#frame-relay route [dlci_1] interface [interface] [dlci_2] FR (config-if)#exit
router(config)#int [type][slot/number] router(config-if)#encapsulation frame ietf router(config-if)#frame map ip [address] [dlci] broadcast #帧中继支持广播,帧中继网络中router端口配置为支持广播 router(config-if)#ip ospf network broadcast
#定义vtp模式 router(config)#vtp mode {server|client|transparent} #定义vtp域名 router(config)#vtp domain {domain-name} #设置vtp域密码 router(config)#vtp password {password}
#配置生成树协议的类型 switch(config)#spanning-tree mode stp/rstp #配置交换机优先级 switch(config)#spanning-tree vlan [vlan-id] priority <0-61440> #配置交换机端口优先级 switch(config-if)#spanning-tree vlan [vlan-id] port-priority <0-240> #交换机调为主根或次根 switch(config)#spanning-tree vlan [vlan-id] root primary/secondary
查看设备相关: show running-config show startup-config(启动配置) show mac-address-table(当前MAC地址表信息) 查看接口状态信息: show interface [type slot/port] 查看vlan: show vlan 查看路由表: router#show ip route 查看rip配置: show ip protocols 查看ospf的邻居关系: router#show ip ospf neighbor 查看ospf的LSA概要: router#show ip ospf database 查看ospf的LSA详细参数: router#show ip ospf database router 从新加载ospf进程: clear ip ospf process 查看tcp链接信息摘要: show ip tcp brief 查看邻居的TCP和BGP链接的详细信息: show ip bgp neighbor 34.34.34.4 查看BGP链接的摘要信息: show ip bgp summary 查看bgp表的信息: show ip bgp 查看ACL: show access-list 查看time-range接口: show time-range 查看vtp状态: show vtp status 查看交换机生成树状态: show spanning-tree (vlan + vlan-id) 查看交换机接口状态: show spanning-tree interface fa 0/1 清除ip路由表: clear ip route {network[mask]*} 显示系统和网络统计量: #显示ip路由表当前状态的摘要,在特权模式下输入命令 show ip route summary #显示rip路由信息,在特权模式下输入命令 show ip route rip