# Two external ip address for asterisk

**URL:** <https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509>\
**Category:** Asterisk SIP\
**Created:** [May 15, 2024, 5:05pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509 "2024-05-15T17:05:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 15, 2024, 5:05pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/1 "2024-05-15T17:05:25Z")

</div>

i have asterisk 11.25 version system behind firewall, and there are two external IP ,one is pulic ,one is vpn set in firewall, and the two IP had done NAT to the asterisk’s 5060 port.  
my question is i can set only one external\_ip ,when i set public ip in system, **the vpn users make phone and can not hear voice**. is there any thing i can do to handle the problem?

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 15, 2024, 6:13pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/2 "2024-05-15T18:13:03Z")

</div>

If you are using an obsolete Asterisk, you are probably using an obsolete channel driver. The current channel driver can cope with multiple NATted intefaces, by defining a transport for each. Otherwise, you can only have one NATted interface,

Given those constrains, setting directmedia (direct\_media) to no, should help.

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 1:36am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/3 "2024-05-16T01:36:43Z")

</div>

![image](https://global.discourse-cdn.com/asterisk/original/2X/8/80a055722d0dba87037923ed9460934d699ee3d2.png)  
yes,it can copy with multiple interfaces,but the 183 always send the really ip address,not the outside(public or vpn ip address)…

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 2:46am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/4 "2024-05-16T02:46:46Z")

</div>

![image](https://global.discourse-cdn.com/asterisk/original/2X/4/44bea4cd3fc34f10d7c3ea8fe04ecf24213aa1f8.png)

how can change the media address(172.x.x.x) to public(140.x.x.x) or vpn address?

---

<div class="post-metadata">

**Author:** ![voip.com.vn](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@voip.com.vn](https://community.asterisk.org/u/voip.com.vn)\
**Post date:** [May 16, 2024, 2:47am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/5 "2024-05-16T02:47:30Z")

</div>

you need a router with SIP ALG function

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 2:59am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/6 "2024-05-16T02:59:50Z")

</div>

i want to do with this 🙂

 ![image](https://global.discourse-cdn.com/asterisk/original/2X/7/777592de8cf205e3966b64ec0255b9e72cc0a755.png)

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 3:47am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/7 "2024-05-16T03:47:50Z")

</div>

> [@voip.com.vn](#):
>
> you need a router with SIP ALG function

yes,there are two envirment, one with SIP ALG is running good, the other one don’t know weather have this function,i’ll check it out.

---

<div class="post-metadata">

**Author:** ![voip.com.vn](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@voip.com.vn](https://community.asterisk.org/u/voip.com.vn)\
**Post date:** [May 16, 2024, 4:50am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/8 "2024-05-16T04:50:57Z")

</div>

Asterisk can’t set multiple public IP.

So buy many router which have SIP ALG, and you can NAT sip traffic to different IP address for each network.

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 6:04am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/9 "2024-05-16T06:04:13Z")

</div>

the cloud server provider don’t allow add SIP ALG on the router,is there any other way?

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 7:18am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/10 "2024-05-16T07:18:10Z")

</div>

> [@david551](#):
>
> If you are using an obsolete Asterisk, you are probably using an obsolete channel driver. The current channel driver can cope with multiple NATted intefaces, by defining a transport for each. Otherwise, you can only have one NATted interface,

so asterisk 18 don’t have this problem, give me some advise…thanks

---

<div class="post-metadata">

**Author:** ![voip.com.vn](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@voip.com.vn](https://community.asterisk.org/u/voip.com.vn)\
**Post date:** [May 16, 2024, 7:28am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/11 "2024-05-16T07:28:17Z")

</div>

> the cloud server provider don’t allow add SIP ALG on the router,is there any other way?

you can install cloud router

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 8:04am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/12 "2024-05-16T08:04:02Z")

</div>

> [@voip.com.vn](#):
>
> cloud router

install cloud router in every server? let me see see… i’ll googl how to use it…thanks ,

seams it’s a google privide server… my cloud server not privide this function

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 16, 2024, 10:06am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/13 "2024-05-16T10:06:06Z")

</div>

> [@voip.com.vn](#):
>
> yo

SIP ALG is generally strongly discouraged, with Asterisk. I’d fall back to using multiple instances of Asterisk before doing that.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 16, 2024, 10:07am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/14 "2024-05-16T10:07:15Z")

</div>

The media address is one of the parameters for PJSIP transports.

> [@sinoee](#):
>
> so asterisk 18 don’t have this problem, give me some advise…thanks

It’s more a case that no-one remembers or cares what problems your version of Asterisk has.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 16, 2024, 10:11am UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/15 "2024-05-16T10:11:02Z")

</div>

> [@voip.com.vn](#):
>
> Asterisk can’t set multiple public IP.

Hasn’t been true for many years. Whilst it is possible that it is buggy, chan\_pjsip, the only currently supported driver for SIP, allows different addresses for each transport.

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 3:44pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/16 "2024-05-16T15:44:20Z")

</div>

so i can use chan\_pjsip for each extension? or in another way, like for vpn user it use 1001, with transport 10.x.x.x for it’s external\_IP; and 1002 for public user, with 202.x.x.x for ti’s external\_IP? each extension can have it’s own;  
Or i need build each extension a sip trunk?

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 16, 2024, 4:17pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/17 "2024-05-16T16:17:00Z")

</div>

Neither Asterisk nor SIP have a concept of a trunk. What many call an extension, in Asterisk terms is an endpoint that directly represents a telephone.

---

<div class="post-metadata">

**Author:** ![Pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@Pooh](https://community.asterisk.org/u/Pooh)\
**Post date:** [May 16, 2024, 4:19pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/18 "2024-05-16T16:19:11Z")

</div>

On Thursday 16 May 2024 at 17:55:20, sinoee via Asterisk Community wrote:

> so i can use chan\_pjsip for each extension? or in another way, like for vpn  
> user it use 1001, with transport 10.x.x.x for it’s external\_IP; and 1002  
> for public user, with 202.x.x.x for ti’s external\_IP? each extension can  
> have it’s own; Or i need build each extension a sip trunk?

The word “trunk” means nothing in Asterisk-speak.

It is a very common word used by SIP connectivity providers, and therefore  
also plenty of Asterisk users, and in some documentation, but “trunk” is just  
“a SIP connection” as far as Asterisk is concerned.

The most common difference between what some people call a trunk and what they  
call a telephone is that the telephone authenticates with username and  
password whereas a trunk is authenticated purely by IP address.

Antony.

–  
“Have you been drinking brake fluid again? I think you’re addicted to the  
stuff.”

“No, no, it’s alright - I can stop any time I want to.”

```
                                               Please reply to the list;
                                                     please *don't* CC me.

```

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 16, 2024, 4:30pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/19 "2024-05-16T16:30:05Z")

</div>

> [@Pooh](#):
>
> whereas a trunk is authenticated purely by IP address.

Or if by user and password, it is done outbound, rather than inbound. There is actually no technical reason why phones couldn’t be authenticated purely by IP address; it’s just administratively easier to use dynamic addresses.

The other common difference is that “trunks” actually make use of the user part of the SIP URI they receive, although there may be multi-line phones that also do that.

---

<div class="post-metadata">

**Author:** ![sinoee](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sinoee](https://community.asterisk.org/u/sinoee)\
**Post date:** [May 16, 2024, 5:28pm UTC](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509/20 "2024-05-16T17:28:17Z")

</div>

stil don’t know what to do with this problem，give some advice?

[Next page](https://community.asterisk.org/t/two-external-ip-address-for-asterisk/102509.md?page=2)
