{"id":18342069,"url":"https://github.com/vikstrous/pdns-geoip-example","last_synced_at":"2025-04-09T21:25:08.805Z","repository":{"id":142247225,"uuid":"88287112","full_name":"vikstrous/pdns-geoip-example","owner":"vikstrous","description":"Example usage of powerdns's geoip backend","archived":false,"fork":false,"pushed_at":"2017-12-11T20:00:43.000Z","size":253,"stargazers_count":6,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T13:29:14.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vikstrous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-14T17:10:10.000Z","updated_at":"2022-08-17T21:11:58.000Z","dependencies_parsed_at":"2023-07-14T17:01:44.154Z","dependency_job_id":null,"html_url":"https://github.com/vikstrous/pdns-geoip-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikstrous%2Fpdns-geoip-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikstrous%2Fpdns-geoip-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikstrous%2Fpdns-geoip-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vikstrous%2Fpdns-geoip-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vikstrous","download_url":"https://codeload.github.com/vikstrous/pdns-geoip-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113453,"owners_count":21049848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:29:24.656Z","updated_at":"2025-04-09T21:25:08.776Z","avatar_url":"https://github.com/vikstrous.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdns-geoip-example\n\nThe following will show you how to set up a basic DNS server that makes\ndecisions about how to respond based on the source ip of the query and a\ngeoip database. This is not meant to be a complete production-grade solution.\nIt's just an example that will cover the essentials. It's left as an exercise\nfor the reader to figure out how to adapt this example to their own environment.\n\nFirst build the docker image with powerdns and the example configs baked in (or\npull viktorstanchev/pdns-geoip-example from docker hub):\n\n```\nmake\n```\n\nCreate a publicly accessible machine that will act as your nameserver.\n\nCreate a domain for your nameserver.\n```\nA ns1.viktrostanchev.com 34.209.175.83\n```\n\nSet up the nameserver for your domain to delegate queries for your subdomain to your geoip backed name server:\n```\nNS geoip.viktorstanchev.com ns1.viktorstanchev.com\n```\n\nDeploy the DNS server on the nameserver.\n```\ndocker run --rm -it -p 53:53/udp --name dns viktorstanchev/pdns-geoip-example\n```\n\nNow you can query `service.geoip.viktorstanchev.com` from different continents and\nget different results. An easy way to verify this is https://dnschecker.org/.\nThe DNS server with the example config will also respond with custom results for\nqueries coming from the subnets `172.31.0.0/16` and `172.32.0.0./16`, so you can\nsee how one would configure this.\n\nTo verify that the nameserver is working correctly locally you can use the following\ncommands:\n\n```\ndocker network create --subnet 172.31.0.0/16 dnstest1\ndocker network create --subnet 172.32.0.0/16 dnstest2\ndocker run -d --name dns --net dnstest1 --ip 172.31.0.2 viktorstanchev/pdns-geoip-example\ndocker network connect --ip 172.32.0.2 dnstest2 dns\n\ndocker run --rm -it --net dnstest1 alpine sh -c 'apk add --no-cache drill \u0026\u0026 drill @172.31.0.2 service.geoip.viktorstanchev.com'\n# example output:\n# service.geoip.viktorstanchev.com.\t30\tIN\tA\t192.168.0.1\ndocker run --rm -it --net dnstest2 alpine sh -c 'apk add --no-cache drill \u0026\u0026 drill @172.32.0.2 service.geoip.viktorstanchev.com'\n# example output:\n# service.geoip.viktorstanchev.com.\t30\tIN\tA\t192.168.0.2\n```\n\nExample result from https://dnschecker.org:\n\n![](./screenshot.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikstrous%2Fpdns-geoip-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikstrous%2Fpdns-geoip-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikstrous%2Fpdns-geoip-example/lists"}