导图社区 CCNP思科学习
本导图汇总了CCNP思科学习阶段二的内容,包含访问控制列表、网络防火墙、IPsecL2L、AAA等,希望对你有所帮助!
编辑于2022-01-11 13:44:33安全可靠的网络
访问控制列表 ACL
access control list
访问控制列表(ACL)是一种基于包过滤的访问控制技术,它可以根据设定的条件对接口上的数据包进行过滤,允许其通过或丢弃。访问控制列表被广泛地应用于路由器和三层交换机,借助于访问控制列表,可以有效地控制用户对网络的访问,从而最大程度地保障网络安全。
分类、过滤
访问控制列表(Access Control Lists,ACL)是应用在路由器接口的指令列表
三层
分类功能:
过滤功能:
基于数据包的IP头部或者TCP头部来做控制
ACL的使用
从使用场景
标准ACL
只能对来源做出分类并限制,无法更灵活的去限制数据的传输
工作中,更多是应用扩展ACL来进行限制
扩展ACL
动态ACL---DACL
R2(config)#ip access-list extended grow R2(config-ext-nacl)#dy R2(config-ext-nacl)#dynamic test timeout 180 permit ip any any R2(config-ext-nacl)#ex R2(config)#line vty 0 4 R2(config-line)#autocommand access-enable host timeout 10
开启动态的命令,居然是隐藏命令,必须手动输入
R2(config-line)#do sh ip access-list Extended IP access list grow 10 permit tcp any host 10.1.1.2 eq telnet (194 matches) 20 Dynamic test permit ip any any permit ip host 10.1.1.1 any (15 matches) (time left 554)
自反ACL---RACL
基于状态化防火墙的一个雏形
R2(config)#ip access-list extended racl R2(config-ext-nacl)#deny ip any any R2(config)#ip access-list ex racl_out R2(config-ext-nacl)#permit ip any any reflect text R2(config)#ip access-list ex racl R2(config-ext-nacl)#5 evaluate text R2(config)#int f0/1 R2(config-if)#ip access-group racl in R2(config-if)#ip access-group racl_out out
出去的数据调用了一个返回用的ACL
R2#sh ip access-lists Extended IP access list racl 5 evaluate text 10 deny ip any any (10 matches) Extended IP access list racl_out 20 permit ip any any reflect text (5 matches) Reflexive IP access list text permit icmp host 202.201.112.1 host 10.1.1.1 (10 matches) (time left 269)
基于时间的ACL---Time Base ACL
R2(config)#time-range grow R2(config-time-range)#?
标准与扩展的区别:1-99编号为标准ACL 1399-1999编号为更大的标准ACL---部分产品不支持 100-199为扩展ACL 2000-2999编号为更大的扩展ACL---部分产品不支持
从写法
编号ACL
编号的缺陷:
没有办法删除、修改特定一条ACL
没有办法调整ACL条目执行的顺序
命名ACL
ACL条目前会带有从10起始,间隔10的条目序号
这样方便在两条ACL条目中插入新的ACL
规则
方向性
ACL可以调用在一个接口的入方向上,也可以调用在一个接口的出方向上
每一个接口的每一个方向,有且只能调用一个ACL
覆盖
顺序性
三层设备在匹配ACL时,是按照顺序性的一条一条执行
deny any命令之后的所有,都无法匹配执行
即如果当前ACL匹配成功,则不再继续往下匹配,否则会继续匹配,直到匹配到默认语句
隐藏性
默认情况下,在生效的ACL语句下还隐藏着一语句
动作
permit
允许指定
deny
拒绝指定
remark
对ACL进行描述
灵活应用,更高效的写出好的ACL
ACL语句编写 + 特定接口或冲突域内进行调用
网络防火墙
防火墙概念
基于接口划分安全区域
在ASA防火墙上,通过数字来表示接口的安全级别。数字越大安全级别越高,数值的范围是0-100
接口命名---nameif,默认情况下防火墙有两个nameif{inside,outside},并且inside的安全级别是100,outside的安全级别是0
ciscoasa(config)#int g1/1 ciscoasa(config-if)#nameif neiwang ciscoasa(config-if)#security-level 50
防火墙传输
默认情况下,低安全级别to高安全级别的数据包是拒绝;高安全级别to低安全级别的数据包是同行的
防火墙放行
ciscoasa(config)#access-list test permit ip any any ciscoasa(config)#access-group test in interface neiwang
PT模拟中,未能实验成功,原理上是正确的
高级为什么可以Telnet低级,但ping不通?
在没有放行的情况下
防火墙按照功能分类
基于包过滤的防火墙
类似ACL的策略进行控制
基于状态化的防火墙
保存状态化表项
应用网关防火墙
802.1x
dot1X:用户准入技术
无线技术
802.1 Q:dot1Q技术
AAA
登录一台网络设备的方法
1、console直连
2、远程Telnet登录
line vty 0 4
明文传输,不安全
3、SSH
hostname
不改名会报错
ip domain-name
建立域
crypto key generate rsa
选择Hash算法来对域名和路由器名字做关联运算
4、无密码登录
line)# no login
5、特权模式免密登录
line)# privilege level 15
登录设置补充
限制登录方式
R1(config-line)#transport input ssh
登录特权模式密码密文
enable secret 密码
AAA:三A认证
authentication 认证
authentication 授权
accounting 审计
开启3A认证
Router(config)#aaa new-model Router(config)#aaa authentication login default local Router(config)#line vty 0 4 Router(config-line)#login authentication default
为何使用aaa而放松设备本身的帐号密码?
账号密码统一
密码验证保存工作量
安全性
在client设备和aaa服务器之间使用了何种协议?
radius
体系更成熟
R1(config)#aaa new-model
开启aaa认证
R1(config)#aaa authentication login default group radius
登录使用radius服务器密码库中的密码
R1(config)#aaa authentication enable default group radius
进入特权模式使用radius服务器密码库的密码
开启aaa配置
R1(config)#radius-server host 192.168.2.1 auth-port 1645 key cisoc123
指定一个链接radius-severs的端口,如1645
指定radius-server服务器地址
配置预共享密钥
此时,控制使用的是aaa服务中记录的帐号密码
R1(config)#aaa accounting exec default start-stop group radius
开启审计
R1(config)#aaa authentication login default group radius local
配置了备用登录方式local,当aaa挂的时候,启用local方式
tracac+
安全性更高
IPsec L2L VPN
BJ_CR(config)#crypto ? dynamic-map Specify a dynamic crypto map template ipsec Configure IPSEC policy isakmp Configure ISAKMP policy key Long term key operations map Enter a crypto map BJ_CR(config)#crypto isakmp ? client Set client configuration policy enable Enable ISAKMP key Set pre-shared key for remote peer policy Set policy for an ISAKMP protection suite BJ_CR(config)#crypto isakmp policy ? <1-10000> Priority of protection suite BJ_CR(config)#crypto isakmp policy 10 BJ_CR(config-isakmp)#? authentication Set authentication method for protection suite encryption Set encryption algorithm for protection suite exit Exit from ISAKMP protection suite configuration mode group Set the Diffie-Hellman group hash Set hash algorithm for protection suite lifetime Set lifetime for ISAKMP security association no Negate a command or set its defaults BJ_CR(config-isakmp)#encryption ? 3des Three key triple DES aes AES - Advanced Encryption Standard des DES - Data Encryption Standard (56 bit keys). BJ_CR(config-isakmp)#encryption 3des BJ_CR(config-isakmp)#hash ? md5 Message Digest 5 sha Secure Hash Standard BJ_CR(config-isakmp)#hash md5 BJ_CR(config-isakmp)#group ? 1 Diffie-Hellman group 1 2 Diffie-Hellman group 2 5 Diffie-Hellman group 5 BJ_CR(config-isakmp)#group 2 BJ_CR(config-isakmp)#authentication ? pre-share Pre-Shared Key BJ_CR(config-isakmp)#authentication pre-share BJ_CR(config)#crypto isakmp key ? WORD The UNENCRYPTED (cleartext) user password BJ_CR(config)#crypto isakmp key cisco123 ? address define shared key with IP address BJ_CR(config)#crypto isakmp key cisco123 address ? A.B.C.D Peer IP address ipv6 define shared key with IPv6 address BJ_CR(config)#crypto isakmp key cisco123 address 60.28.251.1 BJ_CR(config)#crypto ipsec ? security-association Security association parameters transform-set Define transform and settings BJ_CR(config)#crypto ipsec transform-set ? WORD Transform set tag BJ_CR(config)#crypto ipsec transform-set Grow ? ah-md5-hmac AH-HMAC-MD5 transform ah-sha-hmac AH-HMAC-SHA transform esp-3des ESP transform using 3DES(EDE) cipher (168 bits) esp-aes ESP transform using AES cipher esp-des ESP transform using DES cipher (56 bits) esp-md5-hmac ESP transform using HMAC-MD5 auth esp-sha-hmac ESP transform using HMAC-SHA auth BJ_CR(config)#crypto ipsec transform-set Grow esp-des ? esp-md5-hmac ESP transform using HMAC-MD5 auth esp-sha-hmac ESP transform using HMAC-SHA auth <cr> BJ_CR(config)#crypto ipsec transform-set Grow esp-des esp-md5-hmac BJ_CR(config)#ip access-list extended vpn BJ_CR(config-ext-nacl)#permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 BJ_CR(config)#crypto map ? WORD Crypto map tag ipv6 IPv6 crypto map BJ_CR(config)#crypto map Growvpn ? <1-65535> Sequence to insert into crypto map entry client Specify client configuration settings isakmp Specify isakmp configuration settings BJ_CR(config)#crypto map Growvpn 10 ? ipsec-isakmp IPSEC w/ISAKMP <cr> BJ_CR(config)#crypto map Growvpn 10 ipsec-isakmp % NOTE: This new crypto map will remain disabled until a peer and a valid access list have been configured. BJ_CR(config-crypto-map)#? description Description of the crypto map statement policy exit Exit from ISAKMP protection suite configuration mode match Match values. no Negate a command or set its defaults set Set values for encryption/decryption BJ_CR(config-crypto-map)#set ? peer Allowed Encryption/Decryption peer. pfs Specify pfs settings security-association Security association parameters transform-set Specify list of transform sets in priority order BJ_CR(config-crypto-map)#set peer ? A.B.C.D IP address of peer BJ_CR(config-crypto-map)#set peer 60.28.251.1 BJ_CR(config-crypto-map)#set transform-set ? WORD Proposal tag BJ_CR(config-crypto-map)#set transform-set Grow BJ_CR(config-crypto-map)#match ? address Match address of packets to encrypt. BJ_CR(config-crypto-map)#match address ? <100-199> IP access-list number WORD Access-list name BJ_CR(config-crypto-map)#match address vpn
实验没做通
工作原理
加密技术
建立安全的隧道
在安全的隧道中,对数据进行加密传输
配置
BJ_CR(config)#crypto isakmp policy 10
建立加密策略
BJ_CR(config-isakmp)#encryption 3des
选择加密算法
BJ_CR(config-isakmp)#hash md5
数据完整性 选择验证算法
BJ_CR(config-isakmp)#group 2
选择密钥生成算法
BJ_CR(config-isakmp)#authentication pre-share
选择认证方式 与共享密钥
BJ_CR(config)#crypto isakmp key cisco123 address 60.28.251.1【202.201.112.1】
key确认与共享密钥内容
address的公网地址确认和谁建立VPN关系
建立安全通道
BJ_CR(config)#crypto ipsec transform-set Grow esp-des esp-md5-hmac
transform-set 转换集
esp 封装协议
des 加密算法
md5完整性验证算法
协商对数据进行加密的算法
BJ_CR(config)#crypto map Growvpn 10 ipsec-isakmp
将通道和加密算法关联起来
BJ_CR(config-crypto-map)#set peer 60.28.251.1【202.201.112.1】
设置对谁的数据进行加密
BJ_CR(config-crypto-map)#set transform-set Grow
调用转换集
BJ_CR(config-crypto-map)#match address vpn
调用ACL
BJ_CR(config)#ip access-list extended vpn BJ_CR(config-ext-nacl)#permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255【192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255】
感兴趣流:说明谁到谁通信需要被加密
最后在对应的接口中,调用VPN
简单易用的网络
DHCP
dynamic host configuration protocol:动态主机配置协议 目的:动态配置网络终端设备的IP地址
架构:C/S架构
什么样的设备可以作为Server?
window/Linux 搭建DHCP的server
路由器
三层交换机
防火墙
具体三层功能的设备
初步搭建配置:
ip routing 路由功能一定要开启
CSW(config)#ip dhcp pool valn10 创建一个DHCP的地址池,地址池名字 CSW(dhcp-config)#network ? A.B.C.D Network number in dotted-decimal notation CSW(dhcp-config)#network 192.168.1.0 255.255.255.0 配置下这个地址池的网段 CSW(dhcp-config)#default-router 192.168.1.254 配置这个网段的网关 CSW(dhcp-config)#dns-server 192.168.1.254 配置这个网段的DNS CSW(dhcp-config)#? default-router Default routers dns-server Set name server domain-name Domain name exit Exit from DHCP pool configuration mode network Network number and mask no Negate a command or set its defaults option Raw DHCP options
地址169.254开头也是保留的地址
当设备开启DHCP功能时,它必须获得一个IP地址,但如果server并未分配到,它就会自己使用一个保留的地址
DHCP并不是根据pool的名字来进行配置的,它是根据配置里的网段进行的设置
工作原理:
全程使用广播报文
1、终端开启DHCP(自动获取IP),此时会向网络中发送DHCP的discovery信息
封装在UDP报文中,目的端口号67,IP报文广播发送全域
2、DHCP对终端的回应 —— DHCP的offer信息,分配了IP地址在offer中
还是IP报文广播出去,因为DHCP也不知道谁发的
3、终端对DHCP网络发送一个request请求的广播报文
此时终端知道了自己被分配的IP,发送广播报文,是为了告知网络中所有DHCPserver“我已使用了刚刚offer里分配的IP”,那如果有其他server就会回收刚刚发送出去的IP
4、server给终端发送ACK确认的广播报文
DHCP再度给终端确认已获取刚刚那个地址了,这样终端就不会再获取到地址池中的其他地址了
优化:
CSW(config)#ip dhcp ? excluded-address Prevent DHCP from assigning certain addresses pool Configure DHCP address pools relay DHCP relay agent parameters snooping DHCP Snooping excluded---排除掉某些地址或地址段 CSW(config)#ip dhcp excluded-address ? A.B.C.D Low IP address CSW(config)#ip dhcp excluded-address 192.168.1.254
当DHCPserver和终端不在同一个网络内?
DHCP的relay 中继技术
网关代为转发
CSW(config)#int vlan 10 CSW(config-if)#ip helper-address 10.10.10.2 CSW(config)#int vlan 20 CSW(config-if)#ip helper-address 10.10.10.2
说明辅助地址是谁
无线网络
所有的无线网络都必须依托于有线网络
分类
WPAN wireless personal area network 无线个人网络
蓝牙技术
WLAN wireless local area network 无线局域网
WWAN wireless wide area network 无线广域网
GSM 蜂窝移动网络
无线网络的优点
无线网络比有线网络的部署费用低
增加了办公员工的移动性
提高了企业的生产效率
缺点
低安全性
覆盖范围受限
抗干扰能力弱
缺点和传输介质---RF、射频有关
RF radio 射频技术---无线电
频段并非都能使用,有些频段需要向固定部分申请
无线WLAN的标准化组织: 1、802.11 --- 主要定义无线局域网使用的频段,传输的速度,传递的距离 2、WiFi联盟 --- 主要提供用户认证 ----- 但目前被802.11i 替代了
900 MHz
902 MHz --- 928 MHz
2.4 GHz
2.400 GHz --- 2.483 GHz
5 GHz
5.150 GHz --- 5.350 GHz
这些频段是常用的
设备
无线路由器
1、发射无线信号
2、路由转发功能
3、地址下发功能
终端
无线网卡
无线适配器
企业设备
无线中继器AP
上层设备可选:
路由器
无线路由器
交换机
无线控制器
不具有地址分发、路由转发的功能,起到信号放大的作用
也有部分AP是具有地址分发、路由转发功能
无线控制器WLC
控制AP
部署模式
串接
旁挂
概念术语
信道
无线网络通过射频传输的一个逻辑通道
信道重合,会发生相互干扰
独立信道:1/6/11
SSID
service set identifier 服务集标识
控制用户的接入
加密
wep wired equivalent privacy 有线对等加密
wpa WiFi protect access wifi保护接入
wpa2
DNS和NTP
DNS :domain name system 域名系统
作用:简化对IP地址的记忆
域名解析是把域名指向网站空间IP,让人们通过注册的域名可以方便地访问到网站的一种服务。
域名解析就是域名到IP地址的转换过程。域名的解析工作由DNS服务器完成。
域名解析也叫域名指向、服务器设置、域名配置以及反向IP登记等等。说得简单点就是将好记的域名解析成IP,服务由DNS服务器完成,是把域名解析到一个IP地址,然后在此IP地址的主机上将一个子目录与域名绑定。
国内DNS列表
NTP : network time protocol 网络时间协议
作用:网络中所有的设备进行统一时间设置
用来使计算机时间同步化的一种协议,它可以使计算机对其服务器或时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),且可介由加密确认的方式来防止恶毒的协议攻击
CSW(config)#ntp server 192.168.250.2 CSW(config)#ntp update-calendar
什么样的设备可以作为NTP的server?
路由器
三层交换机
专门的server服务器
路由转发功能
需要搭建或指定一个服务器,服务器中开启对应的服务
Syslog和SNMP
既常用又简单
Syslog :日志
日志分类
系统日志
操作日志
网络日志服务器:
对于网络来说,最大的好处就是可以协助排查网络故障
日志存储位置
设备本地
日志服务器
企业收费
开源产品
ELK
LogAnalyzer
日志的展示
一定格式的日志内容
日志分析系统:AnalyzerSystem
Router(config)#logging ? A.B.C.D IP address of the logging host buffered Set buffered logging parameters console Set console logging parameters host Set syslog server IP address and parameters on Enable logging to all enabled destinations trap Set syslog server logging level userinfo Enable logging of user info on privileged mode enabling Router(config)#logging on Router(config)#logging host 192.168.1.2 Router(config)#logging trap ? debugging Debugging messages (severity=7) <cr> Router(config)#logging trap debugging ? <cr> Router(config)#logging trap debugging
SNMP simple network management protocol :简单网络管理协议
R1(config)#snm R1(config)#snmp-server ? community Enable SNMP; set community string and access privs R1(config)#snmp-server co R1(config)#snmp-server community ? WORD SNMP community string R1(config)#snmp-server community grow ? ro Read-only access with this community string rw Read-write access with this community string <cr> R1(config)#snmp-server community grow rw ? <cr> R1(config)#snmp-server community grow rw
可以让服务器对设备的数据进行查看和管理
netflow检测路由器接口流量
RR1(config)#int f0/1 RR1(config-if)#ip f RR1(config-if)#ip flow ? egress Enable outbound NetFlow ingress Enable inbound NetFlow monitor Apply a Flow Monitor to this interface RR1(config-if)#ip flow in RR1(config-if)#ip flow ingress RR1(config-if)#ip f RR1(config-if)#ip flow e RR1(config-if)#ip flow egress
链路到Internet链路上
广域网技术
广域网和局域网的区别
覆盖范围
pstn 公共电话线网络
pstn使用的是模拟信号
调制解调器:modem猫——将数字信号和模拟信号互相转换
底层次中广域的变化
物理层:线缆问题——【PSTN、点到点专线(SDH、MSTP)、无线 GSM、卫星通道】、信号问题——【解调器】
后来为什么不用PSTN了呢?
费用昂贵
速度慢
配置复杂
不灵活
所以改用:point to point 点到点链路
CSU:channel service unit 信道服务单元
主要用来做数据传输
DSU:data service unit 数据服务单元
主要用来做帧的转码
明显的DCE设备
DCE和DTE又是什么?
data communication equipment 数据通信设备
data terminal equipment 数据终端设备
数据链路层:ppp HDLC ADSL PPPoE FR、X.25、ATM【这三个都已经不用了,也不怎考】
HDLC:high-level data link control
点对点默认封装协议,但每个厂家都有所不同,所以转用PPP协议
PPP:point-to-point protocol
PPP链路工作过程分为两个子层协议完成 subprotocol
LCP:链路控制协议,协商链路控制信息,认证
NCP:网络控制协议,协商数据包封装的类型和格式
PPP的认证:
PaP认证
两次握手
可单向认证,本质是明文认证
在传输的接口中声明认证: R2(config-if)#ppp authentication ? chap Challenge Handshake Authentication Protocol <CHAP> pap Password Authentication Protocol <PAP> R2(config-if)#ppp authentication pap 创建数据库: R2(config)#username grow password grow123
在对端设备的端口中,使用帐号密码: R1(config-if)#ppp pap ? sent-username Set outbound PAP username R1(config-if)#ppp pap s R1(config-if)#ppp pap sent-username ? WORD Outbound PAP username R1(config-if)#ppp pap sent-username grow ? password Set outbound PAP password R1(config-if)#ppp pap sent-username grow password grow123
CHAP认证
三次握手
MD5mi'we密文认证,必须是双向认证,定期发送认证信息
互相用对端的HOSTNAME来做指定
如: Router(config-if)#ppp authentication chap RR1(config)#username RR2 password RR123 RR2(config)#USername RR1 password RR123
拓展功能:MLPPP = multilink PPP = EC
将多个物理链接转换为逻辑链接捆绑
端口必须都是统一协议
两端都创建multilink group,名字一致
所有端口都加入此multilink group
R1(config)#interface multilink 110 R1(config-if)#in s1/0 R1(config-if)#ppp multilink group 110
PPP的使用场景
点对点专线场景
相对的
家庭办公用:ADSL 非对称数字用户线路
使用的协议是:PPPoE —— ppp over Ethernet
接口如何改封装类型?
R1(config)#interface s0/3/0 R1(config-if)#en R1(config-if)#encapsulation ? frame-relay Frame Relay networks hdlc Serial HDLC synchronous ppp Point-to-Point protocol
NAT映射技术
network address translation 网络地址转换
网络划分
局域网
使用私网地址
10.0.0.0/8
100.64.0.0/10
新定义
172.16.0.0-172.31.255.255【172.16.0.0/20】
192.168.0.0/16
除此以外的,除了特殊的,基本都是公网地址
广域网
使用公网地址
技术介绍:将一个公网地址,映射成一个具体的私网地址,或将一个私网地址映射成公网地址
这样重复的私网地址就可以和不同局域网的私网地址进行通讯,因为数据包上是两个出口公网地址互相访问
名词解析
分类:
静态NAT
一对一映射的关系
动态NAT
将多个私网地址与多个公网地址进行相互映射
数据:
源NAT
将数据包的源地址转换的NAT
目的NAT
将数据包的目的地址转换的NAT
术语:
内部本地地址【inside local】
自己的地址
内部全局地址【inside global】
自己的地址在内外网间转换后的地址
外部本地地址【outside local】
访问目标的地址
外部全局地址【outside global】
访问目标的地址被转化后的地址
配置
静态NAT
r2(config)#ip nat inside ? source Source address translation r2(config)#ip nat inside source ? list Specify access list describing local addresses static Specify static local->global mapping r2(config)#ip nat inside source static ? A.B.C.D Inside local IP address tcp Transmission Control Protocol udp User Datagram Protocol r2(config)#ip nat inside source static 192.168.1.1 ? A.B.C.D Inside global IP address r2(config)#ip nat inside source static 192.168.1.1 202.201.112.10
202.201.112.10为外网接口相同网段的任意未使用地址
静态NAT配置完成后,会在NAT转换表中自动生成表项
r2#sh ip nat translations Pro Inside global Inside local Outside local Outside global --- 202.201.112.10 192.168.1.1 --- ---
在上互联网的状态,使用静态NAT是没有起到节省IP地址的效果,因为静态是一对一的
动态NAT
多对多
1、启用一个公网地址池:包含一段公网地址
r1(config)#ip nat pool ? WORD Pool name r1(config)#ip nat pool INTip ? A.B.C.D Start IP address r1(config)#ip nat pool INTip 60.28.251.67 ? A.B.C.D End IP address r1(config)#ip nat pool INTip 60.28.251.67 60.28.251.69 ? netmask Specify the network mask r1(config)#ip nat pool INTip 60.28.251.67 60.28.251.69 netmask 255.255.255.240
2、抓取私网网段
r1(config)#access-list ? <1-99> IP standard access list <100-199> IP extended access list r1(config)#access-list 10 ? deny Specify packets to reject permit Specify packets to forward remark Access list entry comment r1(config)#access-list 10 pe r1(config)#access-list 10 permit ? A.B.C.D Address to match any Any source host host A single host address r1(config)#access-list 10 permit 192.168.0.0 ? A.B.C.D Wildcard bits <cr> r1(config)#access-list 10 permit 192.168.0.0 0.0.255.255 ? <cr>
3、两者之间的对应关系
r1(config)#ip nat inside source ? list Specify access list describing local addresses static Specify static local->global mapping r1(config)#ip nat inside source lis r1(config)#ip nat inside source list ? <1-199> Access list number for local addresses WORD Access list name for local addresses r1(config)#ip nat inside source list 10 ? interface Specify interface for global address pool Name pool of global addresses r1(config)#ip nat inside source list 10 po r1(config)#ip nat inside source list 10 pool ? WORD Name pool of global addresses r1(config)#ip nat inside source list 10 pool INTip ? overload Overload an address translation <cr> r1(config)#ip nat inside source list 10 pool INTip
最优使用环境: 在同一时间,并非所有的用户都有访问互联网的需求
动态NAT是不会自动创建表项的,只能被触发
NAT的配置前,要对相对应的接口进行宣告,哪个是inside、哪个是outside
r2(config)#int f0/0 r2(config-if)#ip ? access-group Specify access control for packets address Set the IP address of an interface authentication authentication subcommands flow NetFlow Related commands hello-interval Configures IP-EIGRP hello interval helper-address Specify a destination address for UDP broadcasts inspect Apply inspect name ips Create IPS rule mtu Set IP Maximum Transmission Unit nat NAT interface commands ospf OSPF interface commands proxy-arp Enable proxy ARP split-horizon Perform split horizon summary-address Perform address summarization virtual-reassembly Virtual Reassembly r2(config-if)#ip nat ? inside Inside interface for address translation outside Outside interface for address translation r2(config-if)#ip nat inside ? <cr>
NAT的使用场景
静态NAT
最优、最经常使用的地方是,公司有web服务器需要映射到公网中,供用户访问
动态NAT
并非所有设备或者用户都在同一时间,访问互联网的时候
如果是一个大公司,所有人都在同一个时间有上网的需求呢?这个情况动态NAT也不好使!
新技术:PAT port address translation 端口地址转换---端口复用
r1(config)#ip nat inside source list 10 interface serial 0/0/0 overload
IPv6技术
时代背景
由于IPv4最大的问题在于网络地址资源不足,严重制约了互联网的应用和发展。IPv6的使用,不仅能解决网络地址资源数量的问题,而且也解决了多种接入设备连入互联网的障碍
部署现状
制造业
政府
交通
金融
医疗
公共事业
高等教育研究
报文格式
Flow label 流标签 ≈ ToS字段
128位二进制,采用冒号隔开,每一组总共是4个十六进制,总共8组
版本号 表示协议版本.值为6 流量等级 主要用于QoS 流标签 用来标识同一个流里面的报文 载荷长度 表明该IPv6包头部后包含的字节数,包含扩展头部 下一报头 该字段用来指明报头后接的报文头部的类型,若存在扩展头,表示第一个扩展头的类型,否则表示其上层协议的类型,它是IPv6各种功能的核心实现方法 跳数限制 该字段类似于IPv4中的TTL,每次转发跳数减一,该字段达到0时包将会被丢弃 源地址 标识该报文的来源地址 目的地址 标识该报文的目的地址
扩展头部:IPv6报文中不再有“选项”字段,而是通过“下一报头”字段配合IPv6扩展报头来实现选项的功能。使用扩展头时,将在IPv6报文下一报头字段表明首个扩展报头的类型,再根据该类型对扩展报头进行读取与处理。每个扩展报头同样包含下一报头字段,若接下来有其他扩展报头,即在该字段中继续标明接下来的扩展报头的类型,从而达到添加连续多个扩展报头的目的。在最后一个扩展报头的下一报头字段中,则标明该报文上层协议的类型,用以读取上层协议数据
如何简化描述?
连续个零可以进行省略,使用冒号代替
这样的省略只能出现一次
每个组前面的0可以省略掉,如果一个组全是0,也可以用一个0代替
IPv6地址类型
单播地址
全局单播地址
等同IPv4的公网地址
2000::/3开头
链路本地地址
与IPv4不同,只能在一个链路上有效,类似于以太网MAC地址
FE80::/10开头
不可路由
站点本地地址
2004年已被废除
兼容地址
2002::/16
保留6to4隧道及时使用
多播地址
FF00::/8
代替了IPv4中的组播、广播地址
任意播地址
与其不同的是,只会将数据包发送给其中的一个节点【最近节点】
IPv6地址配置
不管何种方法配置IPv6地址,都需要在对应端口开启IPv6的功能 R1(config-if)#ipv6 enable
配置方法
R1(config-if)#ipv6 enable
在启用IPv6的时候,就会自动生成链路本地地址
R2(config-if)#ipv6 address 2001::2/64
接口里进行配置全局地址
R2(config-if)#ipv6 address 2001::/64 ? anycast Configure as an anycast cga Use CGA interface identifier eui-64 Use eui-64 interface identifier <cr> R2(config-if)#ipv6 address 2001::/64 eui-64
eui-64:指定IPv6地址的前缀,后面部分通过MAC地址随机生成, 缺点是:必须指定前64位,后64位随机填充
生成全局地址,可路由
R1(config)#ipv6 unicast-routing R1(config-if)#ipv6 address autoconfig
自动获取
DHCPv6
静态配置
动态配置
无状态地址自动配置
有状态地址自动配置
IPv6路由配置
无论是什么样的路由协议,都要在配置前确认开启了IPv6的路由协议 R1(config)#ipv6 unicast-routing
静态路由
R1(config)#ipv6 route 2018::/64 f0/0 2021::1230 目标网段 出接口 下一跳
出接口是可以省略的,因为在直连
下一跳可以是用链路本地地址
RIPng
RIPng和RIPv2不兼容
RIPng基于UDP端口号521,没有自动汇总
RIPng本身没有验证,验证已经在IPv6的报头中嵌入
路由更新的多播地址是: FF02::9
R2(config)#ipv6 router rip cisco R2(config-if)#ipv6 rip cisco enable
对应端口配置同样的rip路由,并在端口中进行启用
EIGRPv6
EIGRPv6需要手动开启
EIGRPv6需要手工配置Router-id,否则无法建立邻居
Router-id仍然还是使用点分十进制
EIGRPv6也可以使用链路本地地址来建立邻居关系
R1(config)#ipv6 router eigrp 90 R1(config-rtr)#no sh R1(config-rtr)#eigrp router-id 1.1.1.1 R1(config)#int f0/0 R1(config-if)#ipv6 eigrp 90
R1#sh ipv6 eigrp neighbors EIGRP-IPv6 Neighbors for AS(90) H Address Interface Hold Uptime SRTT RTO Q Seq (sec) (ms) Cnt Num 0 Link-local address: Fa0/0 14 00:01:01 59 354 0 2 FE80::C801:4FFF:FEA8:8
OSPFv3
在ospf的层面上,是通过单播指向邻居来进行区域划分,v3版本优化这项功能---通过实例instance来区分是否是同一个邻居区域
R2(config-if)#ipv6 ospf 110 a 0 instance 1
IPv4到IPv6的过度技术
隧道技术
2手工、3自动
手工隧道
IPv6 ip
GRE隧道
通用路由封装
6 to 4 自动隧道
2002::/16 作为IPv6地址前缀
兼容隧道
ISATAP隧道
NAT-PT
将IPv6地址映射到IPv6地址[Mapping]
MP-6PE
借助IPv4的骨干MPLS网络传递IPv6数据
VPN与GRE技术
VPN:virtual private network 虚拟的私有网络
背景:
不同地域之间的私网之间不能通信的本质原因是什么?
公网设备没有达到私网地址的路由
处理不同地域私网互通的几种方法:NAT、专线、VPN
什么是私网地址,什么是公网地址,他们的本质区别是什么?
本质区别在于,私网地址是可重复的
对VPN重新定义?一种隧道技术
在公网环境打通隧道,隧道内数据加密
定义:打破私有网络的边界,延伸不同地域的私网,使得可以正常互相通讯
分类:
依据工作在TCP/IP的层次
二层VPN
QinQ
L2TP
PPTP
2.5层VPN
MPLS
三层VPN
IPSec
GRE
CISCO Easy-VPN
SSL
OpenVPN
依据应用类型
站点到站点
IPSec
QinQ
MPLS
GRE
远程拨号VPDN
L2TP
PPTP
SSL
OpenVPN
依据安全性
简单、非加密
QinQ
GRE
MPLS
安全、加密
PPTP
L2TP
IPSec
CISCO Easy-VPN
OpenVPN
组合、加密
IPSec
GRE
GRE over IPSec
IPSec over GRE
MPLS over IPSec
DMVPN
GETVPN
什么是隧道技术【tunneling】?
隧道技术的定义相当于对VPN的定义,就是通过公网基础设施传递私网数据
隧道技术有三部分组成:
乘客协议:
承载的私网数据
封装协议:
IPSec、GRE、QinQ、L2TP、PPTP、MPLS、SSL、
传输协议:
IP
轻量级隧道协议-----GRE:generic routing encapsulation
通用路由封装协议,是一种典型的明文隧道技术,故称为简单VPN。之所以称作是轻量级,是因为GRE的头部仅有四个字节组成。
GRE基于Tunnel进行配置
GB_R1(config)#int tunnel ? <0-2147483647> Tunnel interface number GB_R1(config)#int tunnel 12 GB_R1(config-if)# GB_R1(config-if)#ip add 172.31.255.1 255.255.255.252 GB_R1(config-if)#no sh
配置三层接口上的IP地址
GB_R1(config-if)#tunnel ? 6rd set tunnel 6rd parameters bandwidth Set tunnel bandwidth informational parameter checksum enable end to end checksumming of packets destination destination of tunnel flow flow options key security or selector key mode tunnel encapsulation method mpls MPLS tunnel commands path-mtu-discovery Enable Path MTU Discovery on tunnel protection Enable tunnel protection raw-packet-interface physical interface for all packets entering it to be tunneled and for all packets entering the tunnel to exit rbscp Set tunnel RBSCP parameters route-via Select subset of routes for tunnel transport sequence-datagrams drop datagrams arriving out of order source source of tunnel packets tos set type of sevice byte ttl set time to live udlr associate tunnel with unidirectional interface vrf set tunnel vrf membership GB_R1(config-if)#tunnel source ? A.B.C.D ip address Async Async interface Auto-Template Auto-Template interface BVI Bridge-Group Virtual Interface CDMA-Ix CDMA Ix interface CTunnel CTunnel interface Dialer Dialer interface FastEthernet FastEthernet IEEE 802.3 GMPLS MPLS interface LISP Locator/ID Separation Protocol Virtual Interface LongReachEthernet Long-Reach Ethernet interface Loopback Loopback interface MFR Multilink Frame Relay bundle interface Multilink Multilink-group interface Null Null interface Port-channel Ethernet Channel of interfaces Tunnel Tunnel interface Vif PGM Multicast Host interface Virtual-PPP Virtual PPP interface Virtual-Template Virtual Template interface Virtual-TokenRing Virtual TokenRing X:X:X:X::X IPv6 address
GB_R1(config-if)#tunnel source 202.201.112.1 GB_R1(config-if)#tunnel destination 65.28.251.66
配置隧道的出发和终点
GB_R1(config-if)#tunnel mode ? aurp AURP TunnelTalk AppleTalk encapsulation cayman Cayman TunnelTalk AppleTalk encapsulation dvmrp DVMRP multicast tunnel eon EON compatible CLNS tunnel gre generic route encapsulation protocol ipip IP over IP encapsulation ipsec IPSec tunnel encapsulation iptalk Apple IPTalk encapsulation ipv6 Generic packet tunneling in IPv6 ipv6ip IPv6 over IP encapsulation mpls MPLS encapsulations nos IP over IP encapsulation (KA9Q/NOS compatible) rbscp RBSCP in IP tunnel GB_R1(config-if)#tunnel mode gre ? ip over IP ipv6 over IPv6 multipoint over IPv4 (multipoint) GB_R1(config-if)#tunnel mode gre ip
配置隧道的模式和该模式使用的协议
GGB_R1(config)#router ospf 110 GGB_R1(config-router)#router-id 1.1.1.1 GGB_R1(config-router)#network 172.31.255.1 0.0.0.0 a 0 GGB_R1(config-router)#network 192.168.1.0 0.0.0.255 a 0
隧道两端配置相同路由,并将tunnel端口和内网地址宣告出来
当路由形成,隧道端口形成,这样就可以通过隧道进行路由并进行加密传输
组建高可用的网络架构
什么是网关冗余?
FHRP first hop redundacy protocol 首跳冗余协议【网关冗余协议】
HSRP与VRRP
HSRP hot-standby router protocol 热备份 Cisco私有协议
配置虚拟的IP和MAC,对实际交换机接口进行绑定,动态选举
CSW(config)#int vlan 10 CSW(config-if)#? Interface configuration commands: arp Set arp type (arpa, probe, snap) or timeout bandwidth Set bandwidth informational parameter delay Specify interface throughput delay description Interface specific description exit Exit from interface configuration mode ip Interface Internet Protocol config commands no Negate a command or set its defaults shutdown Shutdown the selected interface standby HSRP interface configuration commands CSW(config-if)#standby ? <0-4095> group number ip Enable HSRP and set the virtual IP address preempt Overthrow lower priority Active routers priority Priority level timers Hello and hold timers track Priority Tracking version HSRP version CSW(config-if)#standby 110 ip 192.168.10.254 CSW(config-if)# %HSRP-6-STATECHANGE: Vlan10 Grp 110 state Speak -> Standby %HSRP-6-STATECHANGE: Vlan10 Grp 110 state Standby -> Active
不同的三层交换机上的同vlan,加入同一个standby的group里,进行相同配置
group里的主备选举原则:
比较优先级
接口IP更大优先
存在选举期---3s/次的组播hello信息→224.0.0.2给所有三层设备
CSW(config)#int vlan 10 CSW(config-if)#standby ? <0-4095> group number ip Enable HSRP and set the virtual IP address preempt Overthrow lower priority Active routers priority Priority level timers Hello and hold timers track Priority Tracking version HSRP version CSW(config-if)#standby 110 ? ip Enable HSRP and set the virtual IP address ipv6 Enable HSRP IPv6 preempt Overthrow lower priority Active routers priority Priority level timers Hello and hold timers track Priority Tracking CSW(config-if)#standby 110 priority ? <0-255> Priority value CSW(config-if)#standby 110 priority 150
修改优先级
VRRP virtual router redundancy protocol 虚拟备份协议 业界标准
当下行链路出现问题的时候能否切换?