配置如下:
R1(config)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.255
R1(config-if)#no shut
R1(config)#gatekeeper
R1(config-gk)#zone local a cisco.com 1.1.1.1
R1(config-gk)#no shut
R1(config)#int f0/1
R1(config-if)#h323-gateway voip interface
R1(config-if)#h323-gateway voip id a ipaddr 1.1.1.1
R1(config-if)#h323-gateway voip bind srcaddr 192.168.100.1
R1(config-if)#h323-gateway voip h323-id r1
R1(config)#dial-peer voice 2000 voip
R1(config-dial-peer)#destination-pattern 2...
R1(config-dial-peer)#session target ras
R1(config-dial-peer)#dtmf-relay h245-a
R1(config-dial-peer)#no vad
R2(config)#int f0/1
R2(config-if)#h323-gateway voip interface
R2(config-if)#h323-gateway voip id a ipadd 1.1.1.1
R2(config-if)#h323-gateway voip bind srcaddr 192.168.3.1
R2(config-if)#exit
R2(config)#gateway
R2(config)#dial-peer voice 1000 voip
R2(config-dial-peer)#destination-pattern 1...
R2(config-dial-peer)#session target ras
R2(config-dial-peer)#dtmf-relay h245-a
R2(config-dial-peer)#no vad
R1#show gatekeeper endpoints
GATEKEEPER ENDPOINT REGISTRATION
================================
CallSignalAddr Port RASSignalAddr Port Zone Name Type Flags
--------------- ----- --------------- ----- --------- ---- -----
192.168.3.1 1720 192.168.3.1 65439 a VOIP-GW
H323-ID: r2
E164-ID: 2001
Voice Capacity Max.= Avail.= Current.= 0
192.168.100.1 1720 192.168.100.1 61114 a VOIP-GW
H323-ID: r1
E164-ID: 1001
E164-ID: 1002
Voice Capacity Max.= Avail.= Current.= 0
Total number of active registrations = 2
以上是单zone单GK的拓扑用的是e164来解析的。
R1(config)#gatekeeper
R1(config-gk)#alias static 192.168.3.1 gkid a e164 2002 《如何手工注册》
R1(config-gk)#end
R1#show gatek end
GATEKEEPER ENDPOINT REGISTRATION
================================
CallSignalAddr Port RASSignalAddr Port Zone Name Type Flags
--------------- ----- --------------- ----- --------- ---- -----
192.168.3.1 1720 192.168.3.1 64876 a VOIP-GW D S
E164-ID: 2001
E164-ID: 2002 (static)
H323-ID: r2
Voice Capacity Max.= Avail.= Current.= 0
192.168.100.1 1720 192.168.100.1 58492 a VOIP-GW
E164-ID: 1001
E164-ID: 1002
H323-ID: r1
Voice Capacity Max.= Avail.= Current.= 0
Total number of active registrations = 2
试验结果:1001 ----> 2001 可通
======取消自动注册e164===============
R2(config)#ephone-dn 1
R2(config-ephone-dn)#num 2001 no-reg
R1(config)#ephone-dn 1
R1(config-ephone-dn)#number 1001 no-reg
R1(config-ephone-dn)#exit
R1(config)#ephone-dn 2
R1(config-ephone-dn)#number 1002 no-reg
R1(config)#int f0/1
R1(config-if)#h323-gateway voip tech-prefix 1#
R1(config-if)#end
R1#show gateke gw-type-prefix
GATEWAY TYPE PREFIX TABLE
=========================
Prefix: 1#*
Zone a master gateway list:
192.168.100.1:1720 r1
R1(config)#gatekeeper
R1(config-gk)#gw-type-prefix 1# default-technology
R1(config-gk)#end
R1#show gatek gw
GATEWAY TYPE PREFIX TABLE
=========================
Prefix: 1#* (Default gateway-technology)
Zone a master gateway list:
192.168.100.1:1720 r1
试验结果: 2001----calling ----> 1001 是可通的,如下图,原因是有default gateway-technology的缘故
但1001----calling--->2001 不通
不过,静态写明细e164条目和缺省路由都不是常规的部署方案,因为GK可能存在多个default gateway
通常的办法是添加tech-prefix ,通常我们说的区号
PS: translation rules
R1(config)#gatekee
R1(config-gk)#no gw-type-pre 1# default \\取消掉default gateway
R2(config)#int f0/1
R2(config-if)#h323-gateway voip tech-prefix 2#
R1#show gatekeeper gw-type-prefix
GATEWAY TYPE PREFIX TABLE
=========================
Prefix: 1#*
Zone a master gateway list:
192.168.100.1:1720 r1
Prefix: 2#*
Zone a master gateway list:
192.168.3.1:1720 r2
R1(config)#dial-peer voice 2000 voip \\呼叫2...的号码前,加上2#
R1(config-dial-peer)#tech-prefix 2#
R2(config)#dial-p voice 1000 voip \\呼叫1...的号码前,加上1#
R2(config-dial-peer)#tech-prefix 1#
但是还是有个问题,当2#+号码送到R2上是没办法处理的 ,R1 同理
所以R1和R2要做入向裁号
R2(config)#voice translation-rule 1
R2(cfg-translation-rule)#rule 1 /^.*\(2...\)$/ /\1/
R2(cfg-translation-rule)#exit
R2(config)#voice translation-profile for2# \\定义profile name
R2(cfg-translation-profile)#translate called 1\\调用在被叫方向
R2(cfg-translation-profile)#exit
R2(config)#voip-incoming translation-profile for2#
R1(config)#voice translation-rule 1
R1(cfg-translation-rule)#rule 1 /^.*\(1...\)$/ /\1/
R1(cfg-translation-rule)#exit
R1(config)#voice translation-profile for1#
R1(cfg-translation-profile)#translate called 1
R1(cfg-translation-profile)#exit
R1(config)#voip-incoming translation-profile for1#
R1#show voice translation-rule \\察看rules
Translation-rule tag: 1
Rule 1:
Match pattern: ^.*\(1...\)$
Replace pattern: \1
Match type: none Replace type: none
Match plan: none Replace plan: none
R1#show voice translation-pro
R1#show voice translation-profile
Translation Profile: for1#
Rule for Calling number:
Rule for Called number: 1
Rule for Redirect number:
Rule for Redirect-target number:
也可以在dial-peer voice 1111 voip 下调用,看实际情况的应用.
translation-profile outgoing for1#
试验结果1001 calling 2001 successfully
一般来说,zone prefix是GK的管理域,一个GK可以有多个zone, zone是用来管理带宽的 ,它必须跟tech-prefix一起使用
这种情况用的很少
R2(config-if)#int f0/1
R2(config-if)#no h323-gateway voip tech-prefix 2#
R2(config-if)#h323-gateway voip tech-pre 1#
R2(config-if)#gateway
R2(config-gateway)#exit
R1(config)#dial-pee voice 2000 voip
R1(config-dial-peer)#no tech-prefix 2#
R1(config-dial-peer)#tech-prefix 1#
R1(config-dial-peer)#end
\\这样R1和R2都对1#有管理权
R1(config)#gatekeeper
R1(config-gk)#zone prefix a 1 gw-priority 10 r1
R1(config-gk)#zone prefix a 1 gw-priority 0 r2
R1(config-gk)#zone prefix a 2 gw-pri 10 r2
R1(config-gk)#zone prefix a 2 gw-pri 0 r1
R1#show gatekeeper gw-type-prefix
GATEWAY TYPE PREFIX TABLE
=========================
Prefix: 1#*
Zone a master gateway list:
192.168.100.1:1720 r1
192.168.3.1:1720 r2
Zone a prefix 2* priority gateway list(s):
Priority 10:
192.168.3.1:1720 r2
Zone a prefix 1* priority gateway list(s):
Priority 10:
192.168.100.1:1720 r1
\\由于r1和r2都宣称管理tech-prefix是1#的号码,所以向GK查询号码时候"1#1001"
"1#1002"如何路由时,GK认为r1r2均是1#号码的管理者,当2001----calling----1001时 剥离1#前最后,1001号码属于1*归属r1管理.
Gk告诉r2应该向r1发起链接
GW h323-ID |
Local Zone |
E164 |
Tech-prefix |
Zone-prefix |
Ip address |
R1 |
a |
/ |
1# |
1* |
192.168.100.1 |
R2 |
a |
/ |
1# |
2* |
192.168.3.1 |
R1(config)#gatek
R1(config-gk)#no alias static 192.168.3.1 \\清除静态e164地址.
R1/2(config)#int f0/1
R1/2(config-if)#no h323-gateway voip id a ipaddr 1.1.1.1 1719
R1/2(config-if)#no h323-gateway voip tech-prefix 1# <2#>
R1/2(config-if)#no h323-gateway voip h323-id r1 <r2>
R1/2(config-if)#no h323-gateway voip bind srcaddr 192.168.100.1 <192.168.3.1>
R1/2(config-if)#no h323-gateway voip interface
确保没有任何endpoints有注册,如下:
R1#sh gatek endpoints
GATEKEEPER ENDPOINT REGISTRATION
================================
CallSignalAddr Port RASSignalAddr Port Zone Name Type Flags
--------------- ----- --------------- ----- --------- ---- -----
Total number of active registrations = 0
重新注册到gk
R1(config)#gatek
R1(config-gk)#no zone local a cisco.com 1.1.1.1
R1(config-gk)#zone local a1 cisco.com 1.1.1.1
R1(config-gk)#zone local a2 cisco.com 1.1.1.1
R1(config-gk)#exit
R1(config)#int f0/1
R1(config-if)#h323-gateway voip interface
R1(config-if)#h323-gateway voip id a1 ipaddr 1.1.1.1
R1(config-if)#h323-gateway voip h323-id r1
R1(config-if)#h323-gateway voip bind srcaddr 192.168.100.1
R1(config-if)#h323-gateway voip tech-prefix 1#
R2(config-if)#int f0/1
R2(config-if)#h323-gateway voip interface
R2(config-if)# h323-gateway voip id a2 ipaddr 1.1.1.1
R2(config-if)# h323-gateway voip h323-id r2
R2(config-if)# no h323-gateway voip tech-prefix 1#
R2(config-if)# h323-gateway voip bind srcaddr 192.168.3.1
R2(config-if)# h323-gateway voip tech-prefix 2# \\宣告对2#管理
R1(config)#dial-peer voice 2000 voip \\打2#的标
R1(config-dial-peer)#no tech-prefix 1#
R1(config-dial-peer)#tech-prefix 2#
结果如下:
R1#sh gatek end
GATEKEEPER ENDPOINT REGISTRATION
================================
CallSignalAddr Port RASSignalAddr Port Zone Name Type Flags
--------------- ----- --------------- ----- --------- ---- -----
192.168.3.1 1720 192.168.3.1 63388 a2 VOIP-GW
H323-ID: r2
Voice Capacity Max.= Avail.= Current.= 0
192.168.100.1 1720 192.168.100.1 52448 a1 VOIP-GW
H323-ID: r1
Voice Capacity Max.= Avail.= Current.= 0
Total number of active registrations = 2
R1#show gatek gw
GATEWAY TYPE PREFIX TABLE
=========================
Prefix: 1#*
Zone a1 master gateway list:
192.168.100.1:1720 r1
Prefix: 2#*
Zone a2 master gateway list:
192.168.3.1:1720 r2
R1(config)#gatekeeper
R1(config-gk)#zone prefix a1 1*
R1(config-gk)#zone prefix a2 2* \\确定2个zone决定归属权问题
R1(config-gk)#bandwidth total zone a1 1280 \\分别对不同的zone的带宽管理
R1(config-gk)#bandwidth total zone a2 2560
GW h323-ID |
Local Zone |
E164 |
Tech-prefix |
Zone-prefix |
Ip address |
R1 |
a1 |
/ |
1# |
1* |
192.168.100.1 |
R2 |
a2 |
/ |
2# |
2* |
192.168.3.1 |
Gk的决策树:
分为
1管辖层面,不能决定路由,但可以提前拒绝
2 路由层面,e164号码,tech-prefix+zone prefix,default gw technology + zone prefix每个条件可以决定路由
R2向gk 查询号码1#1001,1#1002,gk摘除1#之后1开头的号码都属于1* 归属zone a 1管辖,在zone a 1里1#归属于r1管理,所以gk告诉r2向r1 发起呼叫连接
这里我们只谈GK peer to peer
1-在r1和r2分别作zone local和指定zone remote
R1#sh run | be gateke
gatekeeper
zone local a cisco.com 1.1.1.1
zone remote b cisco.com 2.2.2.2 1719
gw-type-prefix 2#* hopoff b
no shutdown
R2#sh run | be gateke
gatekeeper
zone local b cisco.com 2.2.2.2
zone remote a ciscocom 1.1.1.1 1719
gw-type-prefix 1#* hopoff a
no shutdown
2-在r1 和r2分别注册到gk
R2#sh run int f0/1
Building configuration...
Current configuration : 277 bytes
!
interface FastEthernet0/1
ip address 192.168.3.1 255.255.255.0
duplex auto
speed auto
h323-gateway voip interface
h323-gateway voip id b ipaddr 2.2.2.2 1719
h323-gateway voip h323-id r2
h323-gateway voip tech-prefix 2# //宣告对2#有管理权限
h323-gateway voip bind srcaddr 192.168.3.1
R1#sh run int f0/1
Building configuration...
Current configuration : 281 bytes
!
interface FastEthernet0/1
ip address 192.168.100.1 255.255.255.0
duplex auto
speed auto
h323-gateway voip interface
h323-gateway voip id a ipaddr 1.1.1.1 1719
h323-gateway voip h323-id r1
h323-gateway voip tech-prefix 1#
h323-gateway voip bind srcaddr 192.168.100.1
3-在r1和r2上分别部署dial-peer
R1#sh run | be dial-peer
dial-peer voice 2000 voip
translation-profile incoming for1#
destination-pattern 2...
session target ras
tech-prefix 2#
dtmf-relay h245-alphanumeric
no vad
R2#sh run | be dial-peer
dial-peer voice 1000 voip
translation-profile incoming for2#
destination-pattern 1...
session target ras
tech-prefix 1#
dtmf-relay h245-alphanumeric
no vad
R1#sh gateke end
GATEKEEPER ENDPOINT REGISTRATION
================================
CallSignalAddr Port RASSignalAddr Port Zone Name Type Flags
--------------- ----- --------------- ----- --------- ---- -----
192.168.100.1 1720 192.168.100.1 56259 a VOIP-GW
H323-ID: r1
Voice Capacity Max.= Avail.= Current.= 0
Total number of active registrations = 1
R1#sh gatek gw
GATEWAY TYPE PREFIX TABLE
=========================
Prefix: 1#*
Zone a master gateway list:
192.168.100.1:1720 r1
sh
Prefix: 2#* (Hopoff zone b)
R1#show gateke zone prefix
ZONE PREFIX TABLE
=================
GK-NAME E164-PREFIX
------- -----------
a 1*
b 2*
4-定义zone prefix
R1:gatekeeper
zone local a cisco.com 1.1.1.1
zone remote b cisco.com 2.2.2.2 1719
zone prefix a 1*
zone prefix b 2*
gw-type-prefix 2#* hopoff b
no shutdown
R2:gatekeeper
zone local b cisco.com 2.2.2.2
zone remote a ciscocom 1.1.1.1 1719
zone prefix a 1*
zone prefix b 2*
gw-type-prefix 1#* hopoff a
no shutdown
GW h323-ID |
Local Zone |
E164 |
Tech-prefix |
Zone-prefix |
Ip address |
R1 |
a of gka |
/ |
1# |
1* |
192.168.100.1 |
R2 |
B of gkb |
/ |
2# |
2* |
192.168.3.1 |
Debug ras
Debug gateke main 5 <10>
Show gatekeep calls
标注:以上实验全是来自于yeslab…试验的下载可以到我的网盘下载到.
本文出自 “Erick WAY” 博客,谢绝转载!