Xip.io: Wildcard DNS for everyone
xip.io
xip.io
$ dig 127.0.0.1.xip.io
;; ANSWER SECTION:
127.0.0.1.xip.io. 403 IN CNAME 9zlhb.xip.io.
9zlhb.xip.io. 405 IN A 127.0.0.1
Returning CNAME pointing to some record? Apparently, 9zlhb is a base 36 of integer of 1.0.0.127. ip: 1.0.0.127
dec: 16777343
base 36: 9zlhb
I guess they decided to reverse the IP address to make generated CNAME scale better (in number of characters): base 36 reverse base 36
1.0.0.0 9ZLDS 1
10.0.0.1 2RVXTT 9ZLE2
127.0.0.1 Z8KFLT 9ZLHB $ dig 127.0.0.1.nip.io
;; ANSWER SECTION:
127.0.0.1.nip.io. 432000 IN A 127.0.0.1One of my favorite features of Pow (also 37Signals, mentioned on xip.io) is the ability to forward .dev domains to certain ports. For instance:
`echo 3000 >> ~/.pow/myapplication` gives you `myapplication.dev` as an alias for `localhost:3000`.
xip.io seems to be able to figure that out -- myapplication.10.0.0.1.xip.io will work, whereas myapplication.10.0.0.1.nip.io does not (just shows the Pow page you would see for going to `localhost`).
Am I missing something here to get it to work with nip.io? I'm all for simpler tools, but since the port functionality is 100% of what I use Pow for, xip.io seems to be the way to go for now.
[1]: https://github.com/basecamp/pow/blob/master/lib/configuratio...
[1] https://github.com/sstephenson/xipd/commit/ea40f65300ccc3d32...
Anyway, out of subject.
I guess the 'TLD's shouldn't be polluted' ship has sailed quite some time ago.
Another use case I can see is for testing subdomain-based web apps where you give each customer a subdomain (really just a wildcard dns record), e.g. acme.myapp.com
Yes, you could achieve the same functionality by editing /etc/hosts, but that's a pain in the arse if you're rapidly switching between a set of different sites, or if you want to access a coworker's machine in the same way.
You guys are complaining too much about useful hacker-friendly tools from well-known companies.
No need for DNS or different ports.
Think of setting acme.example.local and foo.example.local in hosts to 127.0.0.1. In my code I have middleware that sniffs the leftmost part of the hostname and authenticates and routes based on that info.
With this I don't need to mess with hosts, and I don't need to worry about putting in a hack for mobile (on which you cannot change any hosts).
private-address: 127.0.0.0/8
private-address: 10.0.0.0/8
private-address: 172.16.0.0/12
private-address: 192.168.0.0/16
private-address: 169.254.0.0/16
private-address: fd00::/8
private-address: fe80::/10
Here is the comment in the config file for the option: # Enforce privacy of these addresses. Strips them away from answers.
# It may cause DNSSEC validation to additionally mark it as bogus.
# Protects against 'DNS Rebinding' (uses browser as network proxy).
# Only 'private-domain' and 'local-data' names are allowed to have
# these private addresses. No default.
The reason I have this enabled is because it can help stop certain attacks against the local network!Allowing this on your network opens you up to http://en.wikipedia.org/wiki/DNS_rebinding attacks.
On the powerdns recursor configuration, tell it to authoritatively serve a tld:
auth-zones=dev=/etc/powerdns/dev.zone
And then use a BIND style zone definition file. Something like: @ 86400 IN SOA ns root 1 604800 86400 2419200 604800
86400 IN NS ns
86400 IN A 127.0.0.1
* 86400 IN A 127.0.0.1
Now, domains such as "newshiningapp.dev" or "imgonatakeovertheworld.dev" resolv to 127.0.0.1.It has built-in support for .xip.io domains; you can configure multiple sites by pointing it at local directories and it'll serve them up using a built-in POW server (http://pow.cx, also from 37signals).
Great for example for remote testing on your local LAN without having to mess with your HOSTS file.
For php apps the only thing I need to do currently is make a symlink, and an apache vhost entry makes it work [2], kinda like pow! Thinking about it, I could even make that symlink step optional, or add passenger to the mix to support nodejs/rack apps.
[1]: https://github.com/larrybolt/dotfiles/blob/master/homebrew/p...
[2]: https://github.com/larrybolt/dotfiles/blob/master/apache/999...
I've toyed with bonjour spoofing before, but I always found querying was incredibly difficult, using dns-sd, e.g.:
HOST=`(dns-sd -L "Name of Machine" _http._tcp local
| grep -o "at .* (interface"
| grep -o "[a-zA-Z\-]\{1,\}\.local" &
); sleep 1 && pkill -f dns-sq`
Obviously tailored specifically for that project, but I hope you catch my drift. And add to that the port lookup.I'm fairly certain I'm not using it as you do, so would you mind giving an example of how your use MDNS for local dev testing?
[1] - http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html
I guess this is because it's been used by some bad guys already.
; localhost
* .local.example.com A 127.0.0.1
; e.g. if dev server is 10.0.0.1
*.dev.example.com A 10.0.0.1
Hence, no 3rd party dependencies.Switching to Google DNS (8.8.8.8) temporarily fixed it.
http://clickontyler.com/virtualhostx/
Xip.io is enormously useful if you are testing on virtual machines or mobile devices.