Question: Since I do not understand correctly how

<https://github.com/diafygi/webrtc-ips>

works, I would be happy if someone could explain to me what I can do more generally than disabling Webrtc in my browser.
Is there any possibility to prevent this with firewall rules using iptables?

Answer: 
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](https://diafygi.github.io/webrtc-ips/) 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](https://chrome.google.com/webstore/detail/webrtc-block/nphkkbaidamjmhfanlpblblcadhfbkdm?hl=en).

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).
I've wrote an article on how to avoid WebRTC leak with simple iptables not related to port number but instead using the RFC to make sure it match the protocol. Exactly like you asked it use iptables to mitigate the issue.

[Protect yourself from WebRTC leak](https://www.linkedin.com/pulse/protect-yourself-from-webrtc-leak-julien-bedard?articleId=6190558964380368896#comments-6190558964380368896&trk=public_profile_post)