路由减少了一跳

bjut 核心减少一跳

这几天终于把几年以前就一直想做的一个调整做完了。调整之前的网络结构是上面的图,调整后的结果是下面的图。以前FWSM与核心之间采用单独的vlan通信,也就是说所有的流量都必须在核心上做3层转发才能到达防火墙;调整之后的网络各个分核心与FWSM都可以2层直接连接,这样其他分核心的流量经过核心设备只需2层转发,可以节省核心的路由处理器资源,靠硬件即可转发。

改变之后的效果是核心设备的cpu负载下降了20%-30%,转发延迟减少了几个毫秒。 

Still on the way

penguin-writing.jpg9-11那天去考了安全的lab,感觉题目内容有些地方比较变态,但是整体看来还算是合理。

晚上得到的结果是76分,没能通过,虽然只需要再对一个题目就能pass。不过有些部分的得分低于我的预期了。也许确实是有些知识上的缺陷,也许我做的答案和所谓的标准答案有区别。深夜的时候提交了reread,我觉得自己对题目的理解和作答都是合理的,至于考官会怎么理解我的答案那就不知道了……据说整个reread过程需要3周,等3周之后再看了。

不论怎样对技术的学习和追求将一直继续下去。

Cisco IP Phone voice vlan与port-security的问题

由于订购的IP Phone迟迟没有到货,没法自己做实验检验在配置voice vlan的接口上如何同时配置port security。网上有些文档说需要将连接Cisco IP Phone的交换机接口最大mac数目设置成至少3个,有的说设置成至少2个,但是都没有给出明确的原因,让人不知道该怎么办。
晚上在Cisco的网站上逛,看到了一篇文档Cisco Unified Communications SRND Based on Cisco Unified CallManager 5.x (需要CCO)
Voice Security章节里面有下面一段话:
Either port security or dynamic port security can be used to inhibit a MAC flooding attack. A customer with no requirement to use port security as an authorization mechanism would want to use dynamic port security with the number of MAC addresses appropriate to the function attached to a particular port. For example, a port with only a workstation attached to it would want to limit the number of learned MAC addresses to one. A port with a Cisco Unified IP Phone and a workstation behind it would want to set the number of learned MAC addresses to two (one for the IP phone itself and one for the workstation behind the phone) if a workstation is going to plug into the PC port on the phone. This setting in the past has been three MAC addresses, used with the older way of configuring the port in trunk mode. If you use the multi-VLAN access mode of configuration for the phone port, this setting will be two MAC addresses, one for the phone and one for the PC plugged into the phone. If there will be no workstation on the PC port, then the number of MAC addresses on that port should be set to one. These configurations are for a multi-VLAN access port on a switch. The configuration could be different if the port is set to trunk mode (not the recommended deployment of an access port with a phone and PC).
看过之后明白了——通常在交换机上端口上设置voice vlan有两种办法:
(1) Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport trunk native vlan id !— This is the VLAN with untagged frames used by the PC.
Switch(config-if)#switchport mode trunk !— This enables trunking on the port for two VLANs, data and voice.
Switch(config-if)#switchport voice vlan id
Switch(config-if)#spanning-tree portfast trunk
(2)
interface Fa0/1
 switchport access vlan data vlan id
 switchport mode access
 switchport voice vlan voice vlan id
 spanning-tree portfast
第一种配置方法是比较老式的,并且按照文档上说,不推荐在PC和phone同时使用的时候用这样的配置模式。在使用第一种配置方式的时候,电话的MAC会出现在voice vlan和native vlan中,因此算上PC需要占用至少3个MAC;

第二种配置方法被称为“multi-VLAN access port”模式。在这样的情况下电话的MAC只会出现在voice vlan中,因此只需要2个MAC。

其实在Cisco的交换机中内置了一些已经写好的非常好用的macro,可以很方便我们直接配置特定类型的端口。比如cisco-phone这个宏:
C3750#show parser macro name cisco-phone
Macro name : cisco-phone
Macro type : default interface
# Cisco IP phone + desktop template

# macro keywords $access_vlan $voice_vlan

# VoIP enabled interface – Enable data VLAN
# and voice VLAN
# Recommended value for access vlan should not be 1
switchport access vlan $access_vlan
switchport mode access

# Update the Voice VLAN value which should be
# different from data VLAN
# Recommended value for voice vlan should not be 1
switchport voice vlan $voice_vlan

# Enable port security limiting port to a 2 MAC
# addressess — One for desktop on data vlan and
# one for phone on voice vlan
switchport port-security
switchport port-security maximum 2

# Ensure port-security age is greater than one minute
# and use inactivity timer
switchport port-security violation restrict
switchport port-security aging time 2
switchport port-security aging type inactivity

# Enable auto-qos to extend trust to attached Cisco phone
auto qos voip cisco-phone

# Configure port as an edge network port
spanning-tree portfast
spanning-tree bpduguard enable

需要使用的时候接口模式调用即可:
C3750(config-if)#macro apply cisco-phone $access_vlan 20 $voice_vlan 80
C3750(config-if)#do sh run int g1/0/1
Building configuration…

Current configuration : 573 bytes
!
interface GigabitEthernet1/0/28
 switchport access vlan 20
 switchport mode access
 switchport voice vlan 80
 switchport port-security maximum 2
 switchport port-security
 switchport port-security aging time 2
 switchport port-security violation restrict
 switchport port-security aging type inactivity
 srr-queue bandwidth share 10 10 60 20
 srr-queue bandwidth shape  10  0  0  0
 queue-set 2
 mls qos trust device cisco-phone
 mls qos trust cos
 macro description cisco-phone
 auto qos voip cisco-phone
 spanning-tree portfast
 spanning-tree bpduguard enable
end

Cisco Tacacs+ Shell Command Authorization

具体怎么做shell command authorization不写了,遍地都是文档,记录一个经常被忽略的问题。

其实在cisco关于ACS的文档上写的很清楚,我们输入到设备上的命令并不一定是按照原样吐给ACS服务器去进行命令授权验证的。

Cisco文档中的例子,用户输入“interface FASTETHERNET 0/1”,吐给ACS服务器的命令和参数实际上是“interface FastEthernet 0 1”。实际上并不只是大小写变化和去掉"/"这么简单,如果打开"debug aaa authorization",我们可以看到设备吐出的实际命令。

几个有意思的实验:

1.执行copy startup flash:
输出入下:
时间: AAA: parse name=tty66 idb type=-1 tty=-1
时间: AAA: name=tty66 flags=0x11 type=5 shelf=0 slot=0 adapter=0 port=66 channel=0
时间: AAA/MEMORY: create_user (0x83CE97C0) user=’sec’ ruser=’Router’ ds0=0 port=’tty66′ rem_addr=’10.0.1.2′ authen_type=ASCII service=NONE priv=15 initial_task_id=’0′, vrf= (id=0)
时间: tty66 AAA/AUTHOR/CMD(712228085): Port=’tty66′ list=’acs’ service=CMD
时间: AAA/AUTHOR/CMD: tty66(712228085) user=’sec’
时间: tty66 AAA/AUTHOR/CMD(712228085): send AV service=shell
时间: tty66 AAA/AUTHOR/CMD(712228085): send AV cmd=copy
时间: tty66 AAA/AUTHOR/CMD(712228085): send AV cmd-arg=startup-config
时间: tty66 AAA/AUTHOR/CMD(712228085): send AV cmd-arg=flash:c2600-jk9o3s-mz.123-22.bin
时间: tty66 AAA/AUTHOR/CMD(712228085): send AV cmd-arg=flash:123
时间: tty66 AAA/AUTHOR/CMD(712228085): send AV cmd-arg=<cr>
时间: tty66 AAA/AUTHOR/CMD(712228085): found list "acs"
时间: tty66 AAA/AUTHOR/CMD(712228085): Method=tacacs+ (tacacs+)
时间: AAA/AUTHOR/TAC+: (712228085): user=sec
时间: AAA/AUTHOR/TAC+: (712228085): send AV service=shell
时间: AAA/AUTHOR/TAC+: (712228085): send AV cmd=copy
时间: AAA/AUTHOR/TAC+: (712228085): send AV cmd-arg=startup-config
时间: AAA/AUTHOR/TAC+: (712228085): send AV cmd-arg=flash:c2600-jk9o3s-mz.123-22.bin
时间: AAA/AUTHOR/TAC+: (712228085): send AV cmd-arg=flash:123
时间: AAA/AUTHOR/TAC+: (712228085): send AV cmd-arg=<cr>
可以注意要送到ACS上进行授权的命令是copy,命令参数有3个,分别是startup-config(自动补齐)、flash:(2个flash中已经有的文件自动列出都作为参数送出)、<cr>(换行)
如果用ACS授权允许,则可以将命令参数写为"permit ^startup-config flash:"

2.执行copy start tftp:
过程如下:
Router#copy startup-config tftp://1.1.1.1
时间: AAA: parse name=tty66 idb type=-1 tty=-1
时间: AAA: name=tty66 flags=0x11 type=5 shelf=0 slot=0 adapter=0 port=66 channel=0
时间: AAA/MEMORY: create_user (0x8392F428) user=’sec’ ruser=’Router’ ds0=0 port=’tty66′ rem_addr=’10.0.1.2′ authen_type=ASCII service=NONE priv=15 initial_task_id=’0′, vrf= (id=0)
时间: tty66 AAA/AUTHOR/CMD(3197202628): Port=’tty66′ list=’acs’ service=CMD
时间: AAA/AUTHOR/CMD: tty66(3197202628) user=’sec’
时间: tty66 AAA/AUTHOR/CMD(3197202628): send AV service=shell
时间: tty66 AAA/AUTHOR/CMD(3197202628): send AV cmd=copy
时间: tty66 AAA/AUTHOR/CMD(3197202628): send AV cmd-arg=startup-config
时间: tty66 AAA/AUTHOR/CMD(3197202628): send AV cmd-arg=<cr>
时间: tty66 AAA/AUTHOR/CMD(3197202628): found list "acs"
时间: tty66 AAA/AUTHOR/CMD(3197202628): Method=tacacs+ (tacacs+)
时间: AAA/AUTHOR/TAC+: (3197202628): user=sec
时间: AAA/AUTHOR/TAC+: (3197202628): send AV service=shell
时间: AAA/AUTHOR/TAC+: (3197202628): send AV cmd=copy
时间: AAA/AUTHOR/TAC+: (3197202628): send AV cmd-arg=startup-config
时间: AAA/AUTHOR/TAC+: (3197202628): send AV cmd-arg=<cr>
比较有意思的是tftp及后面url中所带的内容都没有被送到ACS上,而仅仅送了一个<cr>过去。我对此的理解是路由器无法事先登录到远端的服务器(tftp)上来列出更多的参数,因此直接送出<cr>替代。

3.执行copy tftp: null:
命令的含义是从tftp服务器上复制一个文件直接送到null文件系统(实际上是直接丢弃),可以用来测试tftp服务器是否能连接上。
过程如下:
Router#copy tftp: null:
时间: AAA: parse name=tty66 idb type=-1 tty=-1
时间: AAA: name=tty66 flags=0x11 type=5 shelf=0 slot=0 adapter=0 port=66 channel=0
时间: AAA/MEMORY: create_user (0x83973290) user=’sec’ ruser=’Router’ ds0=0 port=’tty66′ rem_addr=’10.0.1.2′ authen_type=ASCII service=NONE priv=15 initial_task_id=’0′, vrf= (id=0)
时间: tty66 AAA/AUTHOR/CMD(674610135): Port=’tty66′ list=’acs’ service=CMD
时间: AAA/AUTHOR/CMD: tty66(674610135) user=’sec’
时间: tty66 AAA/AUTHOR/CMD(674610135): send AV service=shell
时间: tty66 AAA/AUTHOR/CMD(674610135): send AV cmd=copy
时间: tty66 AAA/AUTHOR/CMD(674610135): send AV cmd-arg=<cr>
时间: tty66 AAA/AUTHOR/CMD(674610135): found list "acs"
时间: tty66 AAA/AUTHOR/CMD(674610135): Method=tacacs+ (tacacs+)
时间: AAA/AUTHOR/TAC+: (674610135): user=sec
时间: AAA/AUTHOR/TAC+: (674610135): send AV service=shell
时间: AAA/AUTHOR/TAC+: (674610135): send AV cmd=copy
时间: AAA/AUTHOR/TAC+: (674610135): send AV cmd-arg=<cr>
可以看到由于tftp和null都没有办法直接通过设备访问到,没法列出更具体的参数,即无法补齐,因此送到ACS的命令仅仅是命令copy和参数<cr>。

4.是否所有的带有":"的都会被当作<cr>直接送给ACS呢?在2600系列路由器上测试之后的结论是nvram: system: flash: 会将所有的文件作为参数的一部分自动补齐送给ACS作授权。我推测在其他的设备上类似的disk0: disk1:之类实际上可以被直接访问到的存储设备也都会将设备内的文件作为参数补齐自动送到ACS上参数授权过程。

take grant

以前写过一个关于Take-Grant模型的小短文,大概描述的是关于信任关系的传递造成的安全隐患。今天看到了某个安全防护措施相对很完善的网络(堆满了FW,各种各样的ACL,全网流量传输加密)里面由于系统管理员和网络管理员的疏忽造成信任关系非预期的传递了,当然造成的进一步的影响就是越权访问、信息泄露等等。

当然,发现这个问题对于这个网络来说是好事,而且只是一个公司的网络,遇到些漏洞也不会危害到国计民生,所以写出来感慨一下。 这个公司的系统管理员和网络管理员技术非常的好,也很称职,只是对于一个应用了无数策略和设备的小网络来说,管理的难度反而因为这些策略增大了,稍不留神就会出现问题。安全就是这样,不论使用多强的加密策略,使用多好的密钥管理手段,多硬的管理规定,只要有一点出现问题,整个安全系统就全都崩溃失效了。

BTW,所谓的信任关系传递是m$提供的某个标准的常用无害服务造成的。

Typing while imaging~

连续几天都在做各种FW和VPN的实验。有了之前的路由和交换的知识作为基础,外加对ACL的理解,一段时间以来做实验都还算顺利。

发现做安全方面的实验和做路由方面的实验感觉不太一样——做安全实验的时在作配置的同时脑中似乎浮现出了一幅三维的网络拓扑图,不同的流量穿越不同的设备,走各种各样的路径;有些流量经过VPN的时候被转换成了ESP,穿过防火墙的时候acl似乎就是留给特定“形状”流量的一个一个小洞;不同的流量和不同的设备的颜色似乎也是不一样的。

不知道为什么会有这样的感觉,之前做路由和交换实验的时候,脑子里面确实也有图像,但是那只是网络的拓扑,在做安全实验的时候拓扑变成立体的了!

Penguin Run! 

Olivia说:能够改的就改。。。对自己有好无坏的, 就改

Olivia说:能够改的就改。。。对自己有好无坏的, 就改

在网上和Olivia聊天,Olivia用自己的不太熟练的中文解释了“改变/change”的含义。我觉得很经典,于是就在MSN上直接引用了。

我想Olivia的这句话其实是很朴素很实在的一句话。在看到这句话之后我想了很多自己面临的事情和曾经遇到、经历、甚至错过的改变。

以前习惯每天躺在床上思考一天做过的事情,然后进入梦乡。随着工作和生活的节奏越来越快,现在每天倒在床上几乎瞬间就入睡。每天应该留给自己一些时间去思考和改变。

明白?糊涂?

今天出差回来的路上和学生们聊天,我和他们说有些时候对事情都太明白了反而不一定会快乐,稍微糊涂一点挺好的。晚上回到家就发现自己其实言行不一致。刚刚教育完别人就给自己找事。有些时候用技术能让人很明白很明白一些本不该明白的事情。明白这些事情是好吗?还是糊涂着吧,别去自找苦吃、自讨没趣。

很晚了,洗洗睡了。penguin go

%CRYPTO-4-RECVD_PKT_MAC_ERR: decrypt: mac verify failed for

今天在某个设备上配了个IPSEC vpn隧道。在配置结束后遇到了个问题就是ezvpn客户端拨入之后如果跨设备访问丢包,并且偶尔在console上会出%CRYPTO-4-RECVD_PKT_MAC_ERR的错误。网上搜索了一下发现这个报错有可能和route-cache有关。

在应用crypto map的接口上敲上no ip route-cache解决了问题。

但是如果完全禁用route-cache由担心设备的cpu受不了,在接口上尝试了ip route-cache cef、ip route-cache flow两种方式,发现其实是cef方式的route-cache造成的丢包。

对cef的工作原理还不是很了解,只知道大概的原理。虽然仍然不太明白根本的原因是什么,但是解决了问题—我想在接口上使用ip route-cache flow的方式可能要比单纯的禁用route-cache好。

liukang=liukang->next;

退出移动版