CCNP(Cisco Certified Network Professional)第十八天

SPAN:交换端口分析仪---同一台交换机上

F0/1的流量映射到F0/2

  源端口           目标端口

core(config)#monitor session 1 source interface fastEthernet 0/1

                                       源端口

core(config)#monitor session 1 destination interface fastEthernet 0/2

                                          目标端口

注:会话号必须一致

 

RSPAN:用于同一个交换网络,不同交换机间映射流量

条件:1、交换机间存在trunk干道

 2、专属vlan用于span流量,整个交换网络内所有设备均定义该vlan

sw1(config)#vlan 1000

sw1(config-vlan)#remote-span

sw1(config)#monitor session 2 source interface fastEthernet 0/1

                                      源端口

sw1(config)#monitor session 2 destination remote vlan 1000 reflector-port fastEthernet 0/4

                                        目标为专属vlan

reflector-port fastEthernet 0/4  为映射端口,不能为空,不能为源端口;

 

 

 

sw2(config)#vlan 1000

sw2(config-vlan)#remote-span

sw2(config)#monitor session 2 source remote vlan 1000

sw2(config)#monitor session 2 destination interface fastEthernet 0/2

 

NTP:网络时间协议

core#show clock

r1#clock set 19:00:00 aug 1 2000

 

r1(config)#ntp master ?  本地成为NTPserver

  <1-15>  Stratum number

  <cr>    8

默认等级为8,从该处同步时钟的话,等级为9

若等级为16,那么将不能被同步;

 

r2(config)#ntp server 12.1.1.1 被该serve同步;当被同步后,本地默认成为次级时钟

r3(config)#ntp peer 23.1.1.1 被次级时钟同步

注:若同互联网中ntp服务器同步时间,需要定义时区

r1(config)#clock timezone GMT +8

 

 

基于时间的ACL:

1、定义时间列表

r1(config)#time-range classrooma  创建时间列表

r1(config-time-range)#absolute start 00:00 1 aug 2014 end 00:00 1 aug 2015  定义该时间列表的工作周期

再定义工作明细

r1(config-time-range)#periodic ?

  Friday      Friday

  Monday     Monday

  Saturday    Saturday

  Sunday     Sunday

  Thursday   Thursday

  Tuesday    Tuesday

  Wednesday  Wednesday

  daily      Every day of the week

  weekdays   Monday thru Friday

  weekend    Saturday and Sunday

r1(config-time-range)#periodic daily 9:00 to 12:00

r1(config-time-range)#periodic daily 13:30 to 16:00

 

2、基于ACL进行调用

r1(config)#access-list 100 deny ip 172.16.10.0 0.0.0.255 any time-range classrooma     

r1(config)#access-list 100 permit ip any any

 

 

简单的交换安全:

MAC地址攻击:

1、简单的端口安全服务

Switch(config)#interface fastEthernet 0/1

Switch(config-if)#switchport mode access

Switch(config-if)#switchport port-security  先开启端口安全服务

 

Switch(config-if)#switchport port-security ?

  mac-address  Secure mac address       MAC地址获取方式

  maximum      Max secure addresses   最大地址数量

  violation    Security violation mode     违约后处理方式

 

Switch(config-if)#switchport port-security mac-address ?

  H.H.H   48 bit mac address  手写MAC

  sticky  Configure dynamic secure addresses as sticky  自动粘连,记录流量中的源mac

注:默认此时最大地址数量为1,违约处理方式为逻辑关闭

逻辑关闭接口,若需要重新激活,需要先手工关闭再开启该接口

Switch(config-if)#switchport port-security maximum ? 最大地址数量

  <1-132>  Maximum addresses

 

Switch(config-if)#switchport port-security violation ?

  protect   Security violation protect mode  保护

  restrict  Security violation restrict mode   限制

  shutdown  Security violation shutdown mode  关闭

 

保护:当非法MAC地址出现时,不转发其流量,也不关闭该接口

限制:同保护的处理方法一致,区别在于会向网络中的SNMP发送警告信息;

关闭:逻辑关闭,默认的处理方式

 

 

 

2、静态CAM---MAC地址表

core(config)#mac address-table static aaaa.aaaa.aaaa vlan 10 drop

该源MAC地址在vlan10中出现,将被丢弃

 

手工编辑MAC地址表

CORE(config)#mac address-table static aaaa.aaaa.aaaa vlan 10 interface fastEthernet 0/1

 

3、阻止未知的单播帧,需要结合端口安全服务使用

当端口安全服务开启后接口的MAC地址将被绑定,当未知单播流量被洪范时,不会进入绑定了MAC的接口;除非该接口绑定MAC就为该未知流量的目标MAC地址

core(config)#interface f0/1

core(config-if)#switchport block unicast  在所有进行了端口安全服务的接口上配置

 

4、VACL--vlan访问控制列表,基于IP地址或MAC进行ACL

core(config)#mac access-list extended ccie

core(config-ext-macl)#permit host aaaa.aaaa.aaaa any

 

core(config)#vlan access-map ccna 10

core(config-access-map)#match mac address ccie

core(config-access-map)#action drop

 

core(config)#vlan filter ccna vlan-list 1   vlan1中该ACL生效;不影响其他流量-默认隐含允许所有

 

 

 

 

 

 

 

基于vlan的攻击

1)双重标记攻击

当交换机的access接口接收到的流量存在802.1q封装,那么该封装内的vlan id若为该接口的实际vlan,流量可以被转发,但标签会被去掉;若不在该接口所在vlan,那么流量被丢弃

Native 是在802.1qtrunk干道上,不会进行标记的vlan

以上前提可以实现双重标记攻击:

攻击者所在vlan必须为native vlan,之后攻击者流量封装两层标签,外层为其实际所在vlan,内层为攻击目标所在的vlan;流量进入交换机后,交换机剥离外层标签后,通过trunk转发时,由于为native vlan,将不再压入标记,故对端交换机会将流量转发至被攻击者所在vlan

 

解决方案:

1】将trunk干道的native vlan修改为一个不使用的vlan但该vlan必须被交换机创建

     因为默认cdpdtpntp等信息均在native vlan中传递;

Switch(config)#int f0/3

Switch(config-if)#switchport trunk native vlan 2  直连交换机间需要一致;

 

2】开启native vlan的标记功能

sw2#show vlan dot1q tag native

dot1q native vlan tagging is disabled

sw2(config)#vlan dot1q tag native

2)基于DTP进行攻击----交换机连接用户后,用户利用DTP和交换机生成trunk干道

解决方法:所有连接接入层接口修改为access模式;若为trunk干道,也可以手工关闭dtp,之后trunk干道的建立必须依赖手工

sw2(config)#interface f0/1

sw2(config-if)#switchport nonegotiate

 

建议:所有交换机未使用的接口,这些接口应该放置于同一vlan中,且access,同时关闭;

 

 

3PVLAN:隔离vlan

 

vlan

vlan---隔离vlan 社团vlan

通讯规则:

1、隔离vlan和社团vlan间不能互访

2、隔离vlan之内pc间不能互访

3、社团vlan之内pc间可以互访

4、所有设备均可和主vlan内设备通讯

 

端口角色:

1、混杂接口   vlan

2、主机接口   vlan

 

Cisco 3560系列以上的交换机可以配置

1)配置时VTP模式为透明

2)需要创建所有vlan

sw(config)#vtp mode transparent  修改VTP的模式为透明

sw(config)#vlan 2

sw(config-vlan)#private-vlan primary   vlan

sw(config-vlan)#exit

sw(config)#vlan 201

sw(config-vlan)#private-vlan isolated   隔离vlan

sw(config-vlan)#exit

sw(config)#vlan 202

sw(config-vlan)#private-vlan community 社团vlan

sw(config-vlan)#exit

 

sw(config)#vlan 2

sw(config-vlan)#private-vlan association 201,202 关联vlan

  

sw(config)#int e0/1

sw(config-if)#switchport mode private-vlan promiscuous

sw(config-if)#switchport private-vlan mapping 2 201-202

sw(config-if)#exit

sw(config)#interface range e0/2 -3

sw(config-if-range)#switchport mode private-vlan host

sw(config-if-range)#switchport private-vlan host-association 2 201

sw(config)#interface range e0/4 -5

sw(config-if-range)#switchport mode private-vlan host

sw(config-if-range)#switchport private-vlan host-association 2 202

 

:使用PVLAN 时,交换机上必须开启路由功能

 

 

3560下设备可以使用端口保护来起到类似PVLAN的效果;

 core(config)#int f0/1

 core(config-if)#switchport protected 所有被保护的接口之间不能互访;

DHCP 欺骗

DHCP 服务基于UDP67(服务器)  68(客户端)

C--->S 请求

S--->C 提议(所要下放的地址信息)

C--->S 应答 (确认最先收到的提议)

S---->C 确认

 

DHCP 中继:统一分发管理DHCP server

1、中继点的ip地址需要手工配置

2、中继器和DHCP serve间必须路由可达

r2(config)#int f0/0

r2(config-if)#ip helper-address 23.1.1.2  告知中继点dhcpserver地址

 

使用DHCP snooping来解决DHCP欺骗:

非信任接口                       信任接口

接收DHCP请求、应答         收发所有DHCP信息

其他DHCP信息不能接收

默认所有的接口状态

sw(config)#ip dhcp snooping   先开启服务

sw(config)#ip dhcp snooping vlan 1 再定义所工作的vlan

 

sw(config)#int e0/1

sw(config-if)#ip dhcp snooping trust   定义DHCP serve所在接口为信任接口;中间的trunk干道接口也必须信任

 

pc2(config)#ip dhcp relay information trust-all 在合法的DHCP serve处配置该语法;使交换机产生记录,记录针对某个接口的某MAC所下放的ip地址;该表格对DHCP snooping无意义;但强制要求开启,若不开启信任接口也无法进行DHCP下放---该列表用于帮助解决ARP欺骗;

 

扩展:

core(config)#interface f0/1

core(config-if)#ip verify source port-security  该接口在未进行DHCP 工作前,不能通讯;

坚决不能配置于需要手工配置ip地址的接口---网关/dhcp server或其他server

 

ARP欺骗

临时解决方案:手工ARP

C:\Users\Administrator>arp -s 172.16.10.254         00-0d-ed-18-08-00

router(config)#arp 172.16.10.254  000d.ed18.0800  arpa

 

防止ARP欺骗使用DAI--动态ARP检测,结合DHCP snooping工作

DHCP snooping工作后,交换机生成记录表---针对某个接口的某MAC所下放的ip地址

开启DAI后,所有接口为非信任接口,非信任接口做ARP应答或请求时,其IPMACDHCP snooping记录若不一致将不被转发;基于静态配置ip地址的接口需要信任

 

core(config)#ip arp inspection vlan 1 基于vlan1开启DAI服务

core(config)#interface f0/1

core(config-if)#ip arp inspection trust 信任某个接口

 

 

 

CDPcisco设备发现协议

sw#show cdp neighbors   通过CDP协议可以远程了解网络拓扑;默认开启60s周期向所有邻居告知本地信息;

cdp协议携带目标敏感信息---VTP 域名   nativevlan id

建议同用户相连的接口关闭CDP 协议

sw(config)#no cdp run 全局关闭,该设备上直接关闭CDP协议

sw(config)#interface e0/0

sw(config-if)#no cdp enable  关闭某个接口的CDP协议

 

SSH:安全外壳协议

安全的远程登录协议,自动对流量进行加密传输

IOS版本中携带K字母,标示安全性设备;

 

若一台设备需要基于SSH登录,需要该设备上存在秘钥库;

r1(config)#ip domain name haojian.com

r1(config)#crypto key generate rsa general-keys 默认生成512长度

r1(config)#crypto key generate rsa general-keys modulus 1024

 可修改1024SSH版本1.99支持

 

生成秘钥库后,开启远程登录即可

r1(config)#line vty 0 4

r1(config-line)#login local

r1(config-line)#exit

r1(config)#username ccna privilege 15 secret cisco123

默认此时telnetssh登录均可

r1(config)#line vty 0 4

r1(config-line)#transport input ssh  仅允许SSH登录

 

使用一台设备来SSH登录另一台设备

r2#ssh -l ccna 1.1.1.2

Password:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值