目录
802.1X基本功能典型配置
一、组网说明
为交换机配置802.1x认证功能,Radius连接在E 1/24端口。
二、组网图
三、配置步骤
#交换机开启802.1x认证功能,配置Radius-Server
Switch(config)#dot1x enable
Switch(config)#aaa enable
Switch(config)#radius-server authentication host 10.1.1.1
Switch(config)#radius-server key test
#配置Radius计费功能(不涉及计费可不配置此步骤)
Switch(config)#aaa-accounting enable
Switch(config)#radius-server accounting host 10.1.1.1
#配置端口的认证模式
Switch(config)#interface ethernet 1/1
Switch(Config-Ethernet1/1)#dot1x enable
Switch(Config-Ethernet1/1)#dot1x port-method port-base
Switch(Config-Ethernet1/1)#exit
Switch(config)#interface ethernet 1/2
Switch(Config-Ethernet1/2)#dot1x enable
Switch(Config-Ethernet1/2)#dot1x port-method user-base
Switch(Config-Ethernet1/2)#dot1x max-user user-base 10
Switch(Config-Ethernet1/2)#exit
Switch(config)#interface ethernet 1/3
Switch(Config-Ethernet1/3)#dot1x enable
Switch(Config-Ethernet1/3)#dot1x port-method mac-base
Switch(Config-Ethernet1/3)#dot1x max-user mac-base 254
Switch(Config-Ethernet1/3)#exit
四、注意事项
1.本例中没有配置交换机的三层接口地址,实例使用中请按规划配置。
2.端口的三种模式,port-base 一个端口只认证一次,user-base 一个端口最多10个用户,mac-base 一个端口最多254个用户
802.1X私有认证典型配置
一、组网说明
为交换机配置802.1x私有认证功能,Radius连接在E 1/24端口。
二、组网图
三、配置步骤
#交换机开启802.1x认证功能,配置Radius-Server
Switch(config)#dot1x enable
Switch(config)#dot1x privateclient enable
Switch(config)#aaa enable
Switch(config)#radius-server authentication host 10.1.1.1
Switch(config)#radius-server key test
#配置Radius计费功能(不涉及计费可不配置此步骤)
Switch(config)#aaa-accounting enable
Switch(config)#radius-server accounting host 10.1.1.1
#配置端口的认证模式
Switch(config)#interface ethernet 1/1
Switch(Config-Ethernet1/1)#dot1x enable
Switch(Config-Ethernet1/1)#dot1x port-method port-base
Switch(Config-Ethernet1/1)#exit
Switch(config)#interface ethernet 1/2
Switch(Config-Ethernet1/2)#dot1x enable
Switch(Config-Ethernet1/2)#dot1x port-method user-base
Switch(Config-Ethernet1/2)#dot1x max-user user-base 10
Switch(Config-Ethernet1/2)#exit
Switch(config)#interface ethernet 1/3
Switch(Config-Ethernet1/3)#dot1x enable
Switch(Config-Ethernet1/3)#dot1x port-method mac-base
Switch(Config-Ethernet1/3)#dot1x max-user mac-base 254
Switch(Config-Ethernet1/3)#exit
四、注意事项
1.本例中没有配置交换机的三层接口地址,实例使用中请按规划配置。
2.端口的三种模式,port-base 一个端口只认证一次,user-base 一个端口最多10个用户,mac-base 一个端口最多254个用户
3.配置为802.1x私有认证后,交换机会和PC客户端进行私有的保活报文通讯。客户端上也需要设置为私有方式。
802.1X Guest-Vlan功能典型配置
一、组网说明
用户全网开启了802.1x认证,同时在Vlan 20中有一台HTTP Server,上面有认证客户端等资源。用户希望PC机在认证失败或没有认证的时候可以访问到HTTP Server,等认证通过之后,Radius Server会根据用户信息下发对应的Vlan信息。
二、组网图
三、配置步骤
#配置Radius、参数
Switch(config)#dot1x enable
Switch(config)#aaa enable
Switch(config)#aaa-accounting enable
Switch(config)#radius-server accounting host 10.1.1.1
Switch(config)#radius-server authentication host 10.1.1.1
Switch(config)#radius-server key test
#创建相应Vlan,并配置端口属于802.1x Guest-Vlan
Switch(config)#vlan 20
Switch(config-Vlan20)#exit
Switch(config)#interface ethernet 1/1
Switch(config-if-Ethernet1/1)#dot1x enable
Switch(config-if-Ethernet1/1)#switchport mode access
Switch(config-if-Ethernet1/1)#dot1x port-method port-base
Switch(config-if-Ethernet1/1)#dot1x guest-vlan 20
Switch(config-if-Ethernet1/1)#exit
四、注意事项
1.Guest-Vlan必须和Port-base同时使用。
2.当交换机从Radius-Server上接收下发的Vlan时,需要确保交换机上已经创建了对应Vlan,否则Radius会下发失败
Web-Portal 配置
一、组网说明
pc为终端用户,上面有http浏览器,但没有任何802.1x认证客户端,pc1想要通过web portal认证上网。
二、组网图
三、配置步骤
Switch1配置
portal 认证过程:client首次发送流量到BAS(radius client 即交换机)BAS重定向到portal server,portal server向client推送认证页面,client输入账号回送给portal server,portal server再送给BAS (radius client), radius client 再发给radius server认证,认证通过放行。
#交换机是Switch为接入设备,上面配置了计费服务器的地址为RADIUS服务器的IP和端口,打开了计费功能。其中Ethernet0/0/14和pc相连,端口打开了web portal认证功能,配置了重定向的地址为portal服务器的IP和端口,因此端口Ethernet0/0/14禁止所有的流量,只放行dhcp/dns/arp报文通过。
Switch(config)#interface vlan 1
Switch(config-if-vlan1)#ip address 192.168.1.232 255.255.255.0
Switch(config)#webportal enable #全局开启web-portal
Switch(config)#webportal nas-ipv4 192.168.1.232 #BAS地址,这里指交换机
Switch(config)#webportal redirect-ipv4 192.168.1.49 #portal server地址
Switch(config)#interface ethernet 0/0/14
Switch(config-if-ethernet0/0/14)#webportal enable #接口下开启web server
Switch(config)#aaa enable
Switch(config)#aaa-accounting enable
Switch(config)#radius-server authentication host 192.168.1.49 #指定radius server
Switch(config)#radius-server accounting host 192.168.1.49
Switch(config)#radius-server key 0 digitalchina
与DHCP snooping binding功能配合Webportal认证功能相关的配置如下:
Switch(config)#interface ethernet 0/0/14
Switch(config-if-ethernet0/0/14)#webportal enable
Switch(config-if-ethernet0/0/14)#ip dhcp snooping binding webportal
交换机安全防护
一、组网说明
用户有如下配置需求:交换机不转发源IP地址等于目的IP地址的数据报,和源端口等于目的端口的数据报,且在IPv4网络内只允许使用默认选项的ping命令,即ICMP request报文不可分片,且净荷长度一般小于 100。
二、配置步骤
#禁止源IP地址等于目的IP地址的数据报
Switch(config)# dosattack-check srcip-equal-dstip enable
#禁止源端口等于目的端口的数据报
Switch(config)# dosattack-check srcport-equal-dstport enable
#禁止报文分片,限制ICMP报文大小
Switch(config)# dosattack-check ipv4-first-fragment enable
Switch(config)# dosattack-check icmp-attacking enable
Switch(config)# dosattack-check icmpV4-size 100
三、注意事项
1.上述安全功能,默认关闭。需要手动开启
MAB 配置
一、组网说明
在实际网络中存在的无法安装认证客户端的设备,比如打印机、PDA设备等,由于它们无法安装客户端,所以无法进行802.1x认证。但它们又要访问网络中的资源,因此需要使用MAB认证,作为对802.1x认证的一个重要补充。
二、组网图
VLAN-ACL 配置
一、组网说明
用户通过对VLAN配置ACL策略,从而实现对VLAN内所有端口的访问控制,VLAN-ACL使用户能够更加方便地管理网络。
二、组网图
三、配置步骤
Switch配置
- ACL策略VACL_A,在休息时间可以访问外网,规则为Permit,其他时间段均为Deny,并应用策略到Vlan1上。
- 为财务部定制ACL策略VACL_B,在任何时间均不允许访问外网,但可以不受限制的访问内网资源,并应用策略到Vlan2上。
1) 先配置一个timerange,有效时间为工作日的上班时间。
Switch(config)#time-range t1
Switch(config-time-range-t1)#periodic weekdays 9:00:00 to 12:00:00
Switch(config-time-range-t1)#periodic weekdays 13:00:00 to 18:00:00
2) 配置IP的扩展acl_a,上班时间仅允许访问同一网段(如192.168.0.255)内的主机。
Switch(config)# ip access-list extended vacl_a
Switch(config-ip-ext-nacl-vacl_a)# permit ip any-source 192.168.0.0 0.0.0.255 time-range t1
Switch(config-ip-ext-nacl-vacl_a)# deny ip any-source any-destination time-range t1
3) 配置IP的扩展acl_b,任何时间仅允许访问同一网段(如192.168.1.255)内的主机。
Switch(config)#ip access-list extended vacl_b
Switch(config-ip-ext-nacl-vacl_a)# permit ip any-source 192.168.1.0 0.0.0.255
Switch(config-ip-ext-nacl-vacl_a)# deny ip any-source any-destination
4) 将配置应用到VLAN。
Switch(config)#vacl ip access-group vacl_a in vlan 1
Switch(config)#vacl ip access-group vacl_b in vlan 2
四、注意事项
- VLAN ACL与Port ACL同时配置时,即需要满足deny优先,当报文同时匹配VLAN ACL和端口ACL时,只要有一个动作是drop,则结果就是drop。
- ACL在一个VLAN上仅能配置一个,如:基本的IP ACL,在每个VLAN上仅能够应用一个。