Restricting SIP access to specific IP address

Hi,

I am wondering if its possible to access SIP accounts from specific IP address only. All I want to do is that I want to configure an extension, so that it would be accessible from only two specifics IP addresses.

Please let me know the way to do it.

Thanks,

Ash

Hi billsimon,

That really works great. Thank you very much for the info.

But is it possible that I will allow/permit multiple IPs.

like for example

deny: 0.0.0.0/0.0.0.0

permit:
203.123.134.111/255.255.255.255
123.222.222.104/255.255.255.255

I tried the following but it doesn’t work:

permit: 203.123.134.111/255.255.255.255 - 123.222.222.104/255.255.255.255

or

permit: 203.123.134.111/255.255.255.255 / 123.222.222.104/255.255.255.255

or

permit: 203.123.134.111/255.255.255.255, 123.222.222.104/255.255.255.255

assuming that Asterisk allows multiple permit lines (I think but am not sure) then you can separate the entries with “&” and you’ll get multiple permit= lines for each IP/Mask you want to set.

This is what the deny and permit lines are for in your SIP extension config. Specify your IPs in the permit and leave the deny at 0.0.0.0 to deny everything else.