1.测试拓扑:

参照:http://www.clnchina.com.cn/associate_certs/2012/0823/21890.shtml
2.基本配置:
A.R1:
interface FastEthernet0/0
 ip address 202.100.1.1 255.255.255.0
 no shut
interface FastEthernet0/1
 shut
interface FastEthernet0/1.10
 encapsulation dot1Q 10
 ip address 10.1.1.1 255.255.255.0
interface FastEthernet0/1.11
 encapsulation dot1Q 11
 ip address 1.1.1.1 255.255.255.0
ip dhcp pool telephonepool
 network 1.1.1.0 255.255.255.0
 default-router 1.1.1.1
 option 150 ip 1.1.1.1
ip dhcp pool pcpool
 network 10.1.1.0 255.255.255.0
 default-router 10.1.1.1
B.Switch1:
int f0/1
  sw trunk encapsulation dot1q
  sw mode trunk
VLAN 10
  name PC
vlan 11
 name telephone
int rang f0/2 - 3
 sw mode acc
 sw acc vlan 10
 switchport voice vlan 11
 spanning-tree portfast    
C.R2:
interface FastEthernet0/0
 ip address 202.100.1.2 255.255.255.0
 no shut
interface FastEthernet0/1
 ip address 202.100.2.2 255.255.255.0
 no shut
D.R3:
interface FastEthernet0/0
 ip address 202.100.2.3 255.255.255.0
 no shut
interface FastEthernet0/1
 no shut
interface FastEthernet0/1.20
 encapsulation dot1Q 20
 ip address 20.1.1.1 255.255.255.0
interface FastEthernet0/1.22
 encapsulation dot1Q 22
 ip address 2.2.2.1 255.255.255.0
ip dhcp pool telephonepool
 network 2.2.2.0 255.255.255.0
 default-router 2.2.2.1
 option 150 ip 2.2.2.1
ip dhcp pool pcpool
 network 20.1.1.0 255.255.255.0
 default-router 20.1.1.1
E.Switch2:
int f0/1
  sw trunk encapsulation dot1q
  sw mode trunk
VLAN 20
  name PC
vlan 22
 name telephone
int rang f0/2 - 3
 sw mode acce
 sw acc vlan 20
 switchport voice vlan 22
 spanning-tree portfast    
3.动态路由配置:
A.R1:
route ospf 1
 net 202.100.1.0 0.0.0.255 a 0
 net 10.1.1.0 0.0.0.255 a 0
 net 1.1.1.0 0.0.0.255 a 0
 passive-interface f0/1.10
 passive-interface f0/1.11
B.R2:
route ospf 1
 net 202.100.1.0 0.0.0.255 a 0
 net 202.100.2.0 0.0.0.255 a 0
C.R3:
route ospf 1
 net 202.100.2.0 0.0.0.255 a 0
 net 20.1.1.0 0.0.0.255 a 0
 net 2.2.2.0 0.0.0.255 a 0
 passive-interface f0/1.20
 passive-interface f0/1.22
4.语音网关配置:
A.R1:

①.开启CME服务:
telephony-service
 max-ephones 20
 max-dn 100
 ip source-address 1.1.1.1 port 2000
 no auto-reg-ephone
②.电话号码设置:
ephone-dn 1
 number 1001
ephone-dn 2
 number 1002
③.设置自动注册:
telephony-service
 auto-reg-ephone
 auto assign 1 to 2
此时左边的两个电话直接能够互相拨打。
B.R3:
①.开启CME服务:
telephony-service
 max-ephones 20
 max-dn 100
 ip source-address 2.2.2.1 port 2000
 no auto-reg-ephone
②.电话号码设置:
ephone-dn 1
 number 2001
ephone-dn 2
 number 2002
③.设置手动注册:
ephone 1
 mac-address 0002.17B7.DE38
 type 7960
 button 1:1
ephone 2
 mac-address 00e0.f720.1c46
 type 7960
 button 1:2
此时右边的两个电话直接能够互相拨打。
5.语音网关远程呼叫配置:
A.R1:
dial-peer voice 1 voip
 destination-pattern 20..
 session target ipv4:2.2.2.1
B.R3:
dial-peer voice 1 voip
 destination-pattern 10..
 session target ipv4:1.1.1.1
此时左边和右边的四个电话都能互相拨打。