Skip to content

Instantly share code, notes, and snippets.

@Python1320
Last active May 15, 2024 21:37
Show Gist options
  • Save Python1320/1d7787e93bbb8d5a135f396ca2d54673 to your computer and use it in GitHub Desktop.
Save Python1320/1d7787e93bbb8d5a135f396ca2d54673 to your computer and use it in GitHub Desktop.
Block Google AAAA using nftables on Debian-based routers (optional: dnsmasq)
#!/usr/sbin/nft -f
# $ systemctl enable nftables
# TODO: automate:
# - curl -s "https://www.gstatic.com/ipranges/goog.json" | jq -r '.prefixes[].ipv6Prefix | select( . != null )' | sed '$!s/$/,/'
table ip6 block_destinations {
set angry_destinations {
type ipv6_addr
flags interval
auto-merge
elements = {
2001:4860::/32,
2404:6800::/32,
2404:f340::/32,
2600:1900::/28,
2606:73c0::/32,
2607:f8b0::/32,
2620:11a:a000::/40,
2620:120:e000::/40,
2800:3f0::/32,
2a00:1450::/32,
2c0f:fb50::/32
}
}
# Block forwarded
chain block_forward_to_goog6 {
type filter hook forward priority filter - 10; policy accept;
ip6 daddr @angry_destinations reject;
}
# Block router
chain block_output_to_goog6 {
type filter hook output priority filter - 10; policy accept;
ip6 daddr @angry_destinations reject;
}
}
server=/youtube.com/#
address=/youtube.com/::
server=/g-tun.com/#
address=/g-tun.com/::
server=/g.co/#
address=/g.co/::
server=/g.dev/#
address=/g.dev/::
server=/g.page/#
address=/g.page/::
server=/gateway.dev/#
address=/gateway.dev/::
server=/gcr.io/#
address=/gcr.io/::
server=/gerritcodereview.com/#
address=/gerritcodereview.com/::
server=/getbumptop.com/#
address=/getbumptop.com/::
server=/ggoogle.com/#
address=/ggoogle.com/::
server=/gipscorp.com/#
address=/gipscorp.com/::
server=/globaledu.org/#
address=/globaledu.org/::
server=/gmail.com/#
address=/gmail.com/::
server=/gmodules.com/#
address=/gmodules.com/::
server=/gogle.com/#
address=/gogle.com/::
server=/gogole.com/#
address=/gogole.com/::
server=/gonglchuangl.net/#
address=/gonglchuangl.net/::
server=/goo.gl/#
address=/goo.gl/::
server=/googel.com/#
address=/googel.com/::
server=/googil.com/#
address=/googil.com/::
server=/googl.com/#
address=/googl.com/::
server=/google-access.net/#
address=/google-access.net/::
server=/1e100.net/#
address=/1e100.net/::
server=/appspot.com/#
address=/appspot.com/::
server=/google.ad/#
address=/google.ad/::
server=/google.ae/#
address=/google.ae/::
server=/google.al/#
address=/google.al/::
server=/google.am/#
address=/google.am/::
server=/google.as/#
address=/google.as/::
server=/google.at/#
address=/google.at/::
server=/google.az/#
address=/google.az/::
server=/google.ba/#
address=/google.ba/::
server=/google.be/#
address=/google.be/::
server=/google.bf/#
address=/google.bf/::
server=/google.bg/#
address=/google.bg/::
server=/google.bi/#
address=/google.bi/::
server=/google.bj/#
address=/google.bj/::
server=/google.bs/#
address=/google.bs/::
server=/google.bt/#
address=/google.bt/::
server=/google.by/#
address=/google.by/::
server=/google.ca/#
address=/google.ca/::
server=/google.cat/#
address=/google.cat/::
server=/google.cd/#
address=/google.cd/::
server=/google.cf/#
address=/google.cf/::
server=/google.cg/#
address=/google.cg/::
server=/google.ch/#
address=/google.ch/::
server=/google.ci/#
address=/google.ci/::
server=/google.cl/#
address=/google.cl/::
server=/google.cm/#
address=/google.cm/::
server=/google.co/#
address=/google.co/::
server=/google.co.ao/#
address=/google.co.ao/::
server=/google.co.bw/#
address=/google.co.bw/::
server=/google.co.ck/#
address=/google.co.ck/::
server=/google.co.cr/#
address=/google.co.cr/::
server=/google.co.id/#
address=/google.co.id/::
server=/google.co.il/#
address=/google.co.il/::
server=/google.co.in/#
address=/google.co.in/::
server=/google.co.jp/#
address=/google.co.jp/::
server=/google.co.ke/#
address=/google.co.ke/::
server=/google.co.kr/#
address=/google.co.kr/::
server=/google.co.ls/#
address=/google.co.ls/::
server=/google.co.ma/#
address=/google.co.ma/::
server=/google.co.mz/#
address=/google.co.mz/::
server=/google.co.nz/#
address=/google.co.nz/::
server=/google.co.th/#
address=/google.co.th/::
server=/google.co.tz/#
address=/google.co.tz/::
server=/google.co.ug/#
address=/google.co.ug/::
server=/google.co.uk/#
address=/google.co.uk/::
server=/google.co.uz/#
address=/google.co.uz/::
server=/google.co.ve/#
address=/google.co.ve/::
server=/google.co.vi/#
address=/google.co.vi/::
server=/google.co.za/#
address=/google.co.za/::
server=/google.co.zm/#
address=/google.co.zm/::
server=/google.co.zw/#
address=/google.co.zw/::
server=/google.com/#
address=/google.com/::
server=/google.com.af/#
address=/google.com.af/::
server=/google.com.ag/#
address=/google.com.ag/::
server=/google.com.ai/#
address=/google.com.ai/::
server=/google.com.ar/#
address=/google.com.ar/::
server=/google.com.au/#
address=/google.com.au/::
server=/google.com.bd/#
address=/google.com.bd/::
server=/google.com.bh/#
address=/google.com.bh/::
server=/google.com.bn/#
address=/google.com.bn/::
server=/google.com.bo/#
address=/google.com.bo/::
server=/google.com.br/#
address=/google.com.br/::
server=/google.com.bz/#
address=/google.com.bz/::
server=/google.com.co/#
address=/google.com.co/::
server=/google.com.cu/#
address=/google.com.cu/::
server=/google.com.cy/#
address=/google.com.cy/::
server=/google.com.do/#
address=/google.com.do/::
server=/google.com.ec/#
address=/google.com.ec/::
server=/google.com.eg/#
address=/google.com.eg/::
server=/google.com.et/#
address=/google.com.et/::
server=/google.com.fj/#
address=/google.com.fj/::
server=/google.com.gh/#
address=/google.com.gh/::
server=/google.com.gi/#
address=/google.com.gi/::
server=/google.com.gt/#
address=/google.com.gt/::
server=/google.com.hk/#
address=/google.com.hk/::
server=/google.com.jm/#
address=/google.com.jm/::
server=/google.com.kh/#
address=/google.com.kh/::
server=/google.com.kw/#
address=/google.com.kw/::
server=/google.com.lb/#
address=/google.com.lb/::
server=/google.com.ly/#
address=/google.com.ly/::
server=/google.com.mm/#
address=/google.com.mm/::
server=/google.com.mt/#
address=/google.com.mt/::
server=/google.com.mx/#
address=/google.com.mx/::
server=/google.com.my/#
address=/google.com.my/::
server=/google.com.na/#
address=/google.com.na/::
server=/google.com.ng/#
address=/google.com.ng/::
server=/google.com.ni/#
address=/google.com.ni/::
server=/google.com.np/#
address=/google.com.np/::
server=/google.com.om/#
address=/google.com.om/::
server=/google.com.pa/#
address=/google.com.pa/::
server=/google.com.pe/#
address=/google.com.pe/::
server=/google.com.pg/#
address=/google.com.pg/::
server=/google.com.ph/#
address=/google.com.ph/::
server=/google.com.pk/#
address=/google.com.pk/::
server=/google.com.pr/#
address=/google.com.pr/::
server=/google.com.py/#
address=/google.com.py/::
server=/google.com.qa/#
address=/google.com.qa/::
server=/google.com.sa/#
address=/google.com.sa/::
server=/google.com.sb/#
address=/google.com.sb/::
server=/google.com.sg/#
address=/google.com.sg/::
server=/google.com.sl/#
address=/google.com.sl/::
server=/google.com.sv/#
address=/google.com.sv/::
server=/google.com.tj/#
address=/google.com.tj/::
server=/google.com.tr/#
address=/google.com.tr/::
server=/google.com.tw/#
address=/google.com.tw/::
server=/google.com.ua/#
address=/google.com.ua/::
server=/google.com.uy/#
address=/google.com.uy/::
server=/google.com.vc/#
address=/google.com.vc/::
server=/google.com.vn/#
address=/google.com.vn/::
server=/google.cv/#
address=/google.cv/::
server=/google.cz/#
address=/google.cz/::
server=/google.de/#
address=/google.de/::
server=/google.dj/#
address=/google.dj/::
server=/google.dk/#
address=/google.dk/::
server=/google.dm/#
address=/google.dm/::
server=/google.dz/#
address=/google.dz/::
server=/google.ee/#
address=/google.ee/::
server=/google.es/#
address=/google.es/::
server=/google.fi/#
address=/google.fi/::
server=/google.fm/#
address=/google.fm/::
server=/google.fr/#
address=/google.fr/::
server=/google.ga/#
address=/google.ga/::
server=/google.ge/#
address=/google.ge/::
server=/google.gg/#
address=/google.gg/::
server=/google.gl/#
address=/google.gl/::
server=/google.gm/#
address=/google.gm/::
server=/google.gr/#
address=/google.gr/::
server=/google.gy/#
address=/google.gy/::
server=/google.hn/#
address=/google.hn/::
server=/google.hr/#
address=/google.hr/::
server=/google.ht/#
address=/google.ht/::
server=/google.hu/#
address=/google.hu/::
server=/google.ie/#
address=/google.ie/::
server=/google.im/#
address=/google.im/::
server=/google.iq/#
address=/google.iq/::
server=/google.is/#
address=/google.is/::
server=/google.it/#
address=/google.it/::
server=/google.je/#
address=/google.je/::
server=/google.jo/#
address=/google.jo/::
server=/google.kg/#
address=/google.kg/::
server=/google.ki/#
address=/google.ki/::
server=/google.kz/#
address=/google.kz/::
server=/google.la/#
address=/google.la/::
server=/google.li/#
address=/google.li/::
server=/google.lk/#
address=/google.lk/::
server=/google.lt/#
address=/google.lt/::
server=/google.lu/#
address=/google.lu/::
server=/google.lv/#
address=/google.lv/::
server=/google.md/#
address=/google.md/::
server=/google.me/#
address=/google.me/::
server=/google.mg/#
address=/google.mg/::
server=/google.mk/#
address=/google.mk/::
server=/google.ml/#
address=/google.ml/::
server=/google.mn/#
address=/google.mn/::
server=/google.ms/#
address=/google.ms/::
server=/google.mu/#
address=/google.mu/::
server=/google.mv/#
address=/google.mv/::
server=/google.mw/#
address=/google.mw/::
server=/google.ne/#
address=/google.ne/::
server=/google.nl/#
address=/google.nl/::
server=/google.no/#
address=/google.no/::
server=/google.nr/#
address=/google.nr/::
server=/google.nu/#
address=/google.nu/::
server=/google.pl/#
address=/google.pl/::
server=/google.pn/#
address=/google.pn/::
server=/google.ps/#
address=/google.ps/::
server=/google.pt/#
address=/google.pt/::
server=/google.ro/#
address=/google.ro/::
server=/google.rs/#
address=/google.rs/::
server=/google.ru/#
address=/google.ru/::
server=/google.rw/#
address=/google.rw/::
server=/google.sc/#
address=/google.sc/::
server=/google.se/#
address=/google.se/::
server=/google.sh/#
address=/google.sh/::
server=/google.si/#
address=/google.si/::
server=/google.sk/#
address=/google.sk/::
server=/google.sm/#
address=/google.sm/::
server=/google.sn/#
address=/google.sn/::
server=/google.so/#
address=/google.so/::
server=/google.sr/#
address=/google.sr/::
server=/google.st/#
address=/google.st/::
server=/google.td/#
address=/google.td/::
server=/google.tg/#
address=/google.tg/::
server=/google.tl/#
address=/google.tl/::
server=/google.tm/#
address=/google.tm/::
server=/google.tn/#
address=/google.tn/::
server=/google.to/#
address=/google.to/::
server=/google.tt/#
address=/google.tt/::
server=/google.vg/#
address=/google.vg/::
server=/google.vu/#
address=/google.vu/::
server=/google.ws/#
address=/google.ws/::
server=/google-syndication.com/#
address=/google-syndication.com/::
server=/google.berlin/#
address=/google.berlin/::
server=/google.dev/#
address=/google.dev/::
server=/google.net/#
address=/google.net/::
server=/google.org/#
address=/google.org/::
server=/google.ventures/#
address=/google.ventures/::
server=/googleacquisitionmigration.com/#
address=/googleacquisitionmigration.com/::
server=/googleapis.cn/#
address=/googleapis.cn/::
server=/googleapis.com/#
address=/googleapis.com/::
server=/googleapps.com/#
address=/googleapps.com/::
server=/googlearth.com/#
address=/googlearth.com/::
server=/googleblog.com/#
address=/googleblog.com/::
server=/googlebot.com/#
address=/googlebot.com/::
server=/googlecapital.com/#
address=/googlecapital.com/::
server=/googlecert.net/#
address=/googlecert.net/::
server=/googlecode.com/#
address=/googlecode.com/::
server=/googlecommerce.com/#
address=/googlecommerce.com/::
server=/googlecompare.co.uk/#
address=/googlecompare.co.uk/::
server=/googledanmark.com/#
address=/googledanmark.com/::
server=/googledomains.com/#
address=/googledomains.com/::
server=/googledrive.com/#
address=/googledrive.com/::
server=/googlee.com/#
address=/googlee.com/::
server=/googleearth.com/#
address=/googleearth.com/::
server=/googlefiber.com/#
address=/googlefiber.com/::
server=/googlefiber.net/#
address=/googlefiber.net/::
server=/googlefinland.com/#
address=/googlefinland.com/::
server=/googlemail.com/#
address=/googlemail.com/::
server=/googlemaps.com/#
address=/googlemaps.com/::
server=/googlepagecreator.com/#
address=/googlepagecreator.com/::
server=/googlephotos.com/#
address=/googlephotos.com/::
server=/googleplay.com/#
address=/googleplay.com/::
server=/googleplus.com/#
address=/googleplus.com/::
server=/googlesource.com/#
address=/googlesource.com/::
server=/googlestore.com/#
address=/googlestore.com/::
server=/googlesverige.com/#
address=/googlesverige.com/::
server=/googleusercontent.com/#
address=/googleusercontent.com/::
server=/googleventures.com/#
address=/googleventures.com/::
server=/googlezip.net/#
address=/googlezip.net/::
server=/googlr.com/#
address=/googlr.com/::
server=/goolge.com/#
address=/goolge.com/::
server=/gooogle.com/#
address=/gooogle.com/::
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment