My first pfSense package 'dd_adv'
Translation of the original in Catalan. Read it in: CatalàCastellano
Direct link to the documentation:
In this article I will try to describe which are the steps I have had to follow to make a package for pfSense. In this case the package I have made is the extension of a function that pfSense already has but that did not behave the way I need. Specifically I am talking about the 'dynamic DNS' service. It must be said that the support is for many public, and paid, services, to publish a mnemonic for a dynamic IP. Which makes it very good. But there are several behaviours of the support that pfSense has for these functions that did not fit my needs. The way this support is programmed, what pfSense does is take the public IP of the WAN interface and every time it changes it updates the public IP in the remote DNS service.
My problem comes from two places, on the one hand I do not have the IP assigned to the interface with internet, but to another interface. On the other hand, the interface that has internet does not have the public IP assigned directly to it but rather a router has it, which through a NAT process gives it connectivity to the internet. So, the problem is on the one hand knowing through which interface we will reach the internet and on the other hand, which is the public IP through which the network is accessed. As a side effect we have yet another problem because the public IP is not assigned to the pfSense interface, I suppose it is obvious that the problem is that we do not know when it changes. Therefore, we do not know when we have to update it in the dynamic DNS service.
The solution I have adopted is to create a new service that through a pooling service does nothing but periodically ask the internet which is the public IP our interface has. Moreover it must be possible to select which is that interface on which we want to verify which is the public IP. Since we have to force the traffic generated to discover the public IP to go out through the interface that really has a connection to the internet. This case, strange as it may seem, is very common, because in an office or similar we may find ourselves with the need to have two lines that go to the internet, one that will be on the pfSense WAN interface and another one that goes through another interface. Often on the WAN interface we have the main internet outlet and on another interface the backup outlet. A common example these days is to use an ADSL on the WAN and another outlet through a 3G router from Vodafone or similar on another interface.
Once it is clear what the goal of the pfSense package is, this is what we want to achieve looks like:
pfsense dynamic DNS advanced settings
The description of the steps to do the configuration you have in the
so if I have to make improvements, tweaks, translations and the like I think it is a more appropriate place to put it than directly an article on the blog, because this one will end up being too long and hard to reference, modify and maintain.
I want to point out the little documentation and examples pfSense has, especially for new developers, since many times I have had to start digging into code or start searching how other 'packages' programmers had done it to know how to solve my problems. Perhaps though the hardest part is the debugging of the package since many times you come across collateral problems of the package programming that you do not know how to fix and that make you lose a lot of time. For example, I do not know because of what strange problem during the debugging process it left the whole pfSense without configuration and I had to restart and restore several times the configuration of the whole firewall to be able to finally find where the problem came from. The process becomes so long and heavy that you end up desperate.