Instead of blocking the access from the firewall (iptables), it is easier to block it from the browser itself. If you are using Firefox or Iceweasel, you can disable Javascript completely (using NoScript addon, or any similar addon).
If you don't want to disable Javascript, you can disable only WebRTC connections. To do that, enter about:config
in your Firefox address bar, confirm that you know what you're doing, and then enter media.peerconnection.enabled
in the search bar displayed. When the name appears in the list below, you'll notice that its value is set to true
. Double click on it to make it false
and that's it! WebRTC is now disabled!
Afterwards, you can visit this demo page and see for yourself that your local and public IP addresses are not leaked any more.
If you're using TorBrowser, you don't need to do anything extra, because the WebRTC setting named media.peerconnection.enabled
is set to false by default.
Just for the sake of completeness, I'll mention that there is also an extension for Google Chrome called WebRTC Block.
I should mention that it is hard to detect IP leaks using a firewall that works only on the transport/network layer (like iptables) when the leaking is done by an application. The reason is that every application has a different way of doing it, and there is no global solution to all. The best thing to do is to either stop using the application entirely (and perhaps find an alternative) or to stop the part where the leakage happens (which usually disables some functionality of the application).