Question

Asterisk running in nested VM (iptables)

Posted November 10, 2019 386 views
Firewall

Hi,
I have asterisk running in a nested VM on a droplet. I can connect to this just fine but I can not hear any Audio. I assume its an issue with iptables. Anyone else get this to work per chance?

Heres what I have so far:

iptables -A FORWARD -i eth0 -o vnet0 -p udp –dport 5060 -m conntrack –ctstate NEW -j ACCEPT
iptables -A FORWARD -i eth0 -o vnet0 -p udp –dport 10000:10500 -m conntrack –ctstate NEW -j ACCEPT

iptables -A FORWARD -i eth0 -o vnet0 -m conntrack –ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i vnet0 -o eth0 -m conntrack –ctstate ESTABLISHED,RELATED -j ACCEPT

iptables -t nat -A PREROUTING -i eth0 -p udp –dport 5060 -j DNAT –to-destination $dest
iptables -t nat -A POSTROUTING -o vnet0 -p udp –dport 5060 -d $dest -j SNAT –to-source $host

iptables -t nat -A PREROUTING -i eth0 -p udp –dport 10000:10500 -j DNAT –to-destination $dest:10000-10500
iptables -t nat -A POSTROUTING -o vnet0 -p udp –dport 10000:10500 -d $dest -j SNAT –to-source $host:10000-10500

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!