hardware: cisco 1841

firmware: c1841-adventerprisek9-mz.151-4.M10.bin

需要配置的东西:dns name-list,  dns view, dns view-list

Step 1: 配置dns name-list
name-list 10:需要特别处理的域名解析

router(config)#ip dns name-list 10 permit  .*google\.com$
router(config)#ip dns name-list 10 permit  .*google\.com\.hk$

注意上面permit后面的正则表达式:

  • 切记行末不能有空格,否则会当做正则表达式的一部分
  • 精确匹配字符串中的“.”用了“\”转义
  • “.*”匹配任何字符串

name-list 20:

router(config)#ip dns name-list 20 permit  .*

Step 2: 配置dns view

router(config)#ip dns view google
router(cfg-dns-view)# domain lookup
router(cfg-dns-view)# domain name-server 8.8.8.8
router(cfg-dns-view)# domain name-server 8.8.4.4
router(cfg-dns-view)# exit
router(config)#ip dns view other
router(cfg-dns-view)# domain lookup
router(cfg-dns-view)# domain name-server 114.114.114.114
router(cfg-dns-view)# domain name-server 114.114.115.115
router(cfg-dns-view)# end

Step 3: 配置dns view-list

router(config)#ip dns view-list split_dns
router(cfg-dns-view-list)#view google 10
router(cfg-dns-view-list-member)#restrict name-group 10
router(cfg-dns-view-list-member)#exit
router(cfg-dns-view-list)#view other 20
router(cfg-dns-view-list-member)#restrict name-group 20
router(cfg-dns-view-list-member)#end

Step 4:将view-list应用于路由器的LAN侧接口:

router(config)#interface fastEthernet 0/1
router(config-if)#ip dns view-group split_dns
router(config-if)#end
router#wr

Reference:http://www.cisco.com/c/en/us/td/docs/ios/termserv/configuration/guide/15_1/tsv_15_1_book/tsv_reg_express.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注