1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Resolve The Public IP Of A URL as a devops til

This commit is contained in:
jbranchaud
2019-04-14 12:38:15 -05:00
parent 3a52fbbe9d
commit 8209281e4d
2 changed files with 40 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
For a steady stream of TILs from a variety of rocketeers, checkout
[til.hashrocket.com](https://til.hashrocket.com/).
_805 TILs and counting..._
_806 TILs and counting..._
---
@@ -113,6 +113,7 @@ _805 TILs and counting..._
- [Path Of The Packets](devops/path-of-the-packets.md)
- [Push Non-master Branch To Heroku](devops/push-non-master-branch-to-heroku.md)
- [Reload The nginx Configuration](devops/reload-the-nginx-configuration.md)
- [Resolve The Public IP Of A URL](devops/resolve-the-public-ip-of-a-url.md)
- [Running Out Of inode Space](devops/running-out-of-inode-space.md)
- [Wipe A Heroku Postgres Database](devops/wipe-a-heroku-postgres-database.md)

View File

@@ -0,0 +1,38 @@
# Resolve The Public IP Of A URL
The `dig` command is a utility for doing DNS lookups. You can run it with a
URL argument to lookup the public IP for that domain.
```bash
$ dig joshbranchaud.com
; <<>> DiG 9.8.3-P1 <<>> joshbranchaud.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62836
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;joshbranchaud.com. IN A
;; ANSWER SECTION:
joshbranchaud.com. 1800 IN A 159.203.106.229
;; Query time: 50 msec
;; SERVER: 75.75.75.75#53(75.75.75.75)
;; WHEN: Sun Apr 14 12:34:52 2019
;; MSG SIZE rcvd: 51
```
The output is a bit noisy, but if you parse down to the _ANSWER SECTION_,
you'll see the IP address that it resolves to.
Alternatively, you can skip the noise and get right to the IP address by
including the `+short` flag.
```bash
$ dig joshbranchaud.com +short
159.203.106.229
```
See `man dig` for more details.