Yes that is possible, like with any cpu. A good example is PiHole which I run permanently on my home server (which is actually an array of RPi's ) PiHole runs a DNS server and that is basically what you need.
Study the code from PiHole (Python). It should be able to be translated to FreePascal, but I am not really interested in doing that.