2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ネットワークに関する代表的なLinuxコマンド

Last updated at Posted at 2019-04-07

ping

指定したホストがネットワーク上に存在するかどうかを判定します.

ping 192.168.3.14

パケット数を限定したい場合は,-cオプションを使用します.

ping -c 5 192.168.3.14

traceroute

指定したホストまでの経路を調べます.原理としては,IPヘッダのTTL値を1→2→3→...とし,目的のホストに到達するまでTTL値をインクリメントします.そして目的ホストに到達した場合の経路を表示します.

$ traceroute google.co.jp
traceroute to google.co.jp (172.217.31.131), 30 hops max, 60 byte packets
 1  _gateway (10.0.2.2)  0.213 ms  0.136 ms  0.063 ms
 2  192.168.3.1 (192.168.3.1)  1.594 ms  2.187 ms  2.578 ms
 3  softbank221111193130.bbtec.net (221.111.193.130)  8.903 ms  9.325 ms  9.907 ms
 4  softbank221111193145.bbtec.net (221.111.193.145)  9.485 ms  9.434 ms  9.730 ms
 5  * * *
 6  74.125.146.69 (74.125.146.69)  11.332 ms  10.306 ms  10.670 ms
 7  108.170.243.67 (108.170.243.67)  14.842 ms 108.170.243.139 (108.170.243.139)  14.787 ms 108.170.243.35 (108.170.243.35)  15.885 ms
 8  108.177.3.255 (108.177.3.255)  24.294 ms  23.720 ms 108.170.231.181 (108.170.231.181)  30.760 ms
 9  209.85.244.63 (209.85.244.63)  24.279 ms 209.85.241.106 (209.85.241.106)  23.991 ms  23.666 ms
10  108.170.242.161 (108.170.242.161)  23.176 ms 108.170.242.193 (108.170.242.193)  28.098 ms 108.170.242.161 (108.170.242.161)  23.812 ms
11  74.125.251.237 (74.125.251.237)  24.199 ms  24.019 ms  16.536 ms
12  nrt20s08-in-f3.1e100.net (172.217.31.131)  16.357 ms  16.338 ms  33.989 ms

ちなみに,「nrt20s08-in-f3.1e100.net」というのは,検索エンジン大手のGoogle Inc.が管理するドメインです.

nslookup

DNSサーバーにメッセージを送信し,DNSサーバーからの返答を画面に表示します.

$ nslookup
> google.co.jp
Server:		192.168.3.1
Address:	192.168.3.1#53

Non-authoritative answer:
Name:	google.co.jp
Address: 172.217.25.227
Name:	google.co.jp
Address: 2404:6800:400a:80c::2003
> www.google.com
Server:		192.168.3.1
Address:	192.168.3.1#53

> softbank.jp
Server:		192.168.3.1
Address:	192.168.3.1#53

Non-authoritative answer:
Name:	softbank.jp
Address: 54.249.58.86
Name:	softbank.jp
Address: 13.114.61.152

また,IPアドレスからドメイン名を逆引きすることもできます.

$ nslookup
> set q=ptr
> 200.19.106.59.in-addr.arpa.
Server:		192.168.3.1
Address:	192.168.3.1#53

Non-authoritative answer:
200.19.106.59.in-addr.arpa	name = www750.sakura.ne.jp.

Authoritative answers can be found from:
19.106.59.in-addr.arpa	nameserver = ns2.dns.ne.jp.
19.106.59.in-addr.arpa	nameserver = ns1.dns.ne.jp.
ns1.dns.ne.jp	internet address = 61.211.236.1
ns2.dns.ne.jp	internet address = 133.167.21.1

whois

既存ドメインの登録情報(登録者名、連絡先等)を参照するときに使用します.nslookupと似ていますが,nslookupはDNSサーバに登録されているレコードを問い合わせる為のツールです.

$ whois google.co.jp

[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]

Domain Information: [ドメイン情報]
a. [ドメイン名]                 GOOGLE.CO.JP
e. [そしきめい]                 ぐーぐるかぶしきかいしゃ
f. [組織名]                     グーグル株式会社
g. [Organization]               Google Japan
k. [組織種別]                   株式会社
l. [Organization Type]          corporation
m. [登録担当者]                 DL152JP
n. [技術連絡担当者]             TW124137JP
p. [ネームサーバ]               ns1.google.com
p. [ネームサーバ]               ns2.google.com
p. [ネームサーバ]               ns3.google.com
p. [ネームサーバ]               ns4.google.com
s. [署名鍵]                     
[状態]                          Connected (2020/03/31)
[登録年月日]                    2001/03/22
[接続年月日]                    2001/03/22
[最終更新]                      2019/04/01 01:05:59 (JST)

host

DNSサーバーで名前解決をする情報について問い合わせをするコマンドです.DNSに関する各種の調査やデバッグに応用させることができます.

$ host -a akademeia.info
Trying "akademeia.info"
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31221
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 2, ADDITIONAL: 4
;; EDNS: version: 0, udp=4096

;; QUESTION SECTION:
;akademeia.info.			IN	ANY

;; ANSWER SECTION:
akademeia.info.		5	IN	SOA	master.dns.ne.jp. tech.sakura.ad.jp. 2006070300 3600 900 3600000 3600
akademeia.info.		5	IN	MX	10 akademeia.info.
akademeia.info.		5	IN	A	59.106.19.200
akademeia.info.		5	IN	NS	ns2.dns.ne.jp.
akademeia.info.		5	IN	NS	ns1.dns.ne.jp.

;; AUTHORITY SECTION:
akademeia.info.		3600	IN	NS	ns2.dns.ne.jp.
akademeia.info.		3600	IN	NS	ns1.dns.ne.jp.

;; ADDITIONAL SECTION:
akademeia.info.		3600	IN	A	59.106.19.200
ns1.dns.ne.jp.		78053	IN	A	61.211.236.1
ns2.dns.ne.jp.		68086	IN	A	133.167.21.1

Received 254 bytes from 192.168.3.1#53 in 17 ms

-aを指定することで,ターゲットに関連するサーバ一覧が揃うようになります.

引数なしでhostコマンドを実行することで,ドメイン名からIPアドレスを検索することができます.

$ host google.co.jp
google.co.jp has address 216.58.197.131
google.co.jp has IPv6 address 2404:6800:4004:800::2003
google.co.jp mail is handled by 40 alt3.aspmx.l.google.com.
google.co.jp mail is handled by 20 alt1.aspmx.l.google.com.
google.co.jp mail is handled by 30 alt2.aspmx.l.google.com.
google.co.jp mail is handled by 50 alt4.aspmx.l.google.com.
google.co.jp mail is handled by 10 aspmx.l.google.com.

nmap

高機能ポートスキャナーです.

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?