本帖最后由 Rocky 于 2017-8-22 22:07 编辑 1.基本配置及配置内外网接口
conf thostname ASAFW #设置主机名enable secret pass123 #设置特权密码clock timezone GMT 8 #设置时区dns domain-lookup insidedns server-group DefaultDNS name-server 114.114.114.114 name-server 223.5.5.5 name-server 223.6.6.6interface GigabitEthernet0/0 nameif outside security-level 0 ip address 118.25.235.100 255.255.255.0 #我的外网IP是118.25.235.100interface GigabitEthernet0/1 nameif inside security-level 100 ip address 192.168.2.1 255.255.255.0 #我的内网网段是192.168.2.0/24
2.配置外网路由
route outside 0.0.0.0 0.0.0.0 118.25.235.1 1# route outside 0.0.0.0 0.0.0.0 外网网关 13.配置内网NAT上网配置
nat-controlglobal (outside) 1 interfacenat (inside) 1 192.168.2.0 255.255.255.0
4.配置DHCP服务器
dhcpd lease 14400dhcpd address 192.168.2.2-192.168.2.254 inside#设置DHCP的IP地址池dhcpd dns 114.114.114.114 223.5.5.5 interface insidedhcpd enable inside
5.配置端口映射(因为我外网只有一个IP因此,设置的时候就是interface,一定要先设置外网IP再来设置端口映射)
static (inside,outside) tcp interface 80 192.168.2.2 80 netmask 255.255.255.255 static (inside,outside) tcp interface 443 192.168.2.242 tcp netmask 255.255.255.255 如果存在多个外网IP,如何设置端口映射呢?static (inside,outside) tcp 118.25.235.101 80 192.168.2.2 80 netmask 255.255.255.255 static (inside,outside) tcp 118.25.235.101 443 192.168.2.242 tcp netmask 255.255.255.255直接将IP写上,注意如果只有一个IP,只能写interface
6.ACL及内外网策略
access-list outside extended permit ip any any
access-list outside extended deny icmp any any
access-list inside extended permit icmp any any
access-list inside extended permit ip any any
access-group outside in interface outside
access-group inside in interface inside
7.配置ssh登录
crypto key generate rsa modulus 1024aaa authentication ssh console LOCALusername user1 password xxxx //配置ssh用户名密码ssh version 1ssh 0.0.0.0 0.0.0.0 inside //配置SSH内网可以登录及访问#ssh 0.0.0.0 0.0.0.0 outside //配置SSH外网可登录,一般我不打开外网登录,因为只能使用ssh version 1
8.设置ASA系统时间及SNMP
clock set 13:14:00 2 feb 2012snmp-server host inside 192.168.2.2 community public version 2csnmp-server enable traps
9.IP限时限速
#设置时段time-range rate_limit periodic daily 9:00 to 18:00 #设置IP,需要设置上传或下载速度access-list rate_limit20 extended permit ip host 192.168.2.20 any time-range rate_limitaccess-list rate_limit20 extended permit ip any host 192.168.2.20 time-range rate_limit#限速class-map map20 match access-list rate_limit20policy-map rate_limit class map20 police input 10240000 5120 #最多1M的下载速度 police output 10240000 5120 #最多1M的上传速度service-policy rate_limit interface inside
如果需要定义一段IP呢,比如我要定义从192.168.2.20-192.168.2.199这个ip段内IP的速度怎么处理呢,因为一个policy-map里最多含64个class map,那怎么处理呢
注意一下这种策略是IP段所有IP速度之和不大于1M,这样限速没有意义:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 以下限速的是整个IP段的速度之和进行限制@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@time-range rate_limitperiodic daily 09:00 to 18:00object-group network rate_limit network-object 192.168.2.0 255.255.255.0access-list rate_limit extended permit ip object-group rate_limit any time-range rate_limitaccess-list rate_limit extended permit ip any object-group rate_limit time-range rate_limitclass-map map1 match access-list rate_limitpolicy-map map2 class map1 police input 10240000 5120 police output 10240000 5120service-policy map2 interface inside
如何配置呢,找一个折中点:我们把每10个IP作为一组,这样即便是能下载但是也只影响10个人的网速
object-group network rate_limit20 network-object 192.168.2.20 255.255.255.255 network-object 192.168.2.21 255.255.255.255 network-object 192.168.2.22 255.255.255.255 network-object 192.168.2.23 255.255.255.255 network-object 192.168.2.24 255.255.255.255 network-object 192.168.2.25 255.255.255.255 network-object 192.168.2.26 255.255.255.255 network-object 192.168.2.27 255.255.255.255 network-object 192.168.2.28 255.255.255.255 network-object 192.168.2.29 255.255.255.255object-group network rate_limit30 network-object 192.168.2.30 255.255.255.255 network-object 192.168.2.31 255.255.255.255 network-object 192.168.2.32 255.255.255.255 network-object 192.168.2.33 255.255.255.255 network-object 192.168.2.34 255.255.255.255 network-object 192.168.2.35 255.255.255.255 network-object 192.168.2.36 255.255.255.255 network-object 192.168.2.37 255.255.255.255 network-object 192.168.2.38 255.255.255.255 network-object 192.168.2.39 255.255.255.255object-group network rate_limit40 network-object 192.168.2.40 255.255.255.255 network-object 192.168.2.41 255.255.255.255 network-object 192.168.2.42 255.255.255.255 network-object 192.168.2.43 255.255.255.255 network-object 192.168.2.44 255.255.255.255 network-object 192.168.2.45 255.255.255.255 network-object 192.168.2.46 255.255.255.255 network-object 192.168.2.47 255.255.255.255 network-object 192.168.2.48 255.255.255.255 network-object 192.168.2.49 255.255.255.255access-list rate_limit20 extended permit ip object-group rate_limit20 any time-range rate_limit access-list rate_limit20 extended permit ip any object-group rate_limit20 time-range rate_limit access-list rate_limit30 extended permit ip object-group rate_limit30 any time-range rate_limit access-list rate_limit30 extended permit ip any object-group rate_limit30 time-range rate_limit access-list rate_limit40 extended permit ip object-group rate_limit40 any time-range rate_limit access-list rate_limit40 extended permit ip any object-group rate_limit40 time-range rate_limit class-map map20 match access-list rate_limit20class-map map30 match access-list rate_limit30class-map map40 match access-list rate_limit40policy-map rate_limit class map20 police input 10240000 5120 police output 10240000 5120 class map30 police input 10240000 5120 police output 10240000 5120 class map40 police input 10240000 5120 police output 10240000 5120 service-policy rate_limit interface inside
9.开启ASDM图形化管理
webvpnusername admin password adminhttp server enable 或者http server enable 8080(端口号)http 0.0.0.0 0.0.0.0 insideasdm image disk0:/asdm-722.bin
10.如何保存配置
copy running-config startup-config
11.备份配置及操作系统
show flash--#-- --length-- -----date/time------ path 3 4096 Aug 16 2017 12:25:12 log 8 4096 Aug 16 2017 12:25:24 crypto_archive 9 4096 Aug 16 2017 12:25:26 coredumpinfo 10 43 Aug 16 2017 12:25:26 coredumpinfo/coredump.cfg 78 15261696 Aug 16 2017 12:36:40 asa824-k8.bin 79 24047892 Aug 16 2017 12:39:12 asdm-722.bincopy asa824-k8.bin tcopy asdm-722.bin tcopy running-config tftp://192.168.2.3
出处http://fengwan.blog.51cto.com/508652/1957945
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rockyw | If it solves your problem, please mark as answer. Thanks !