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 5 years have passed since last update.

rshサーバーとクライアントの挙動

Last updated at Posted at 2018-11-28

rshでのやり取りは、以下のような接続が確立されることを確認した。

・クライアント(512-1023) -> サーバー(514)
・サーバー(エフェメラルポート) -> クライアント(113)
・サーバー(512-1023) -> クライアント(512-1023)

113ポートについては、以下の内容から。
http://www.novell.com/ja-jp/support/kb/tids/jp/00006500_/00006737.htm

rshで使用する512-1023までのポート番号は、サーバー、クライアントとも、空いている番号を1023からデクリメントしながら探し、使用する。

例:
rshサーバー:192.168.01
rshクライアント:192.168.0.2

上記サーバークライアント間では、以下のように接続が確立される。
192.168.0.2から、2つのrshコマンドを順に実行したとする。

1、192.168.0.2.1023 -> 192.168.0.1.514
2、192.168.0.1.32768 -> 192.168.0.2.113
3、192.168.0.1.1023 -> 192.168.0.2.1022
4、192.168.0.2.1021 -> 192.168.0.1.514
5、192.168.0.1.32769 -> 192.168.0.2.113
6、192.168.0.1.1022 -> 192.168.0.1.1020


以下に、実際にサーバー、クライアントでのやり取りを、
tcpdumpで確認した内容を記載する。

rshサーバー:192.168.0.1
rshクライアント:192.168.0.2

192.168.0.2上で、以下のコマンドを、いくつか平行して実行する。

※rshコマンドをバックグラウンドで実行すると終了しなくなってしまうため、
 ターミナルを複数開いて、それぞれでrshコマンドを実行した。

rsh 192.168.0.1 -l root sleep 100

以下、tcpdumpの内容

[root@localhost ~]# tcpdump -nn -i eth0 host 192.168.0.1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
15:11:37.021335 IP 192.168.0.2.1023 > 192.168.0.1.514: Flags [S], seq 3899179017, win 29200, options [mss 1460,sackOK,TS val 447022391 ecr 0,nop,wscale 7], length 0
15:11:37.021826 IP 192.168.0.1.514 > 192.168.0.2.1023: Flags [S.], seq 940234748, ack 3899179018, win 14480, options [mss 1460,sackOK,TS val 5439958 ecr 447022391,nop,wscale 7], length 0
15:11:37.021848 IP 192.168.0.2.1023 > 192.168.0.1.514: Flags [.], ack 1, win 229, options [nop,nop,TS val 447022392 ecr 5439958], length 0
15:11:37.022005 IP 192.168.0.2.1023 > 192.168.0.1.514: Flags [P.], seq 1:6, ack 1, win 229, options [nop,nop,TS val 447022392 ecr 5439958], length 5
15:11:37.022223 IP 192.168.0.1.514 > 192.168.0.2.1023: Flags [.], ack 6, win 114, options [nop,nop,TS val 5439959 ecr 447022392], length 0
15:11:37.023304 IP 192.168.0.1.59402 > 192.168.0.2.113: Flags [S], seq 760059842, win 14600, options [mss 1460,sackOK,TS val 5439960 ecr 0,nop,wscale 7], length 0
15:11:37.023323 IP 192.168.0.2.113 > 192.168.0.1.59402: Flags [R.], seq 0, ack 760059843, win 0, length 0
15:11:37.027541 IP 192.168.0.1.1023 > 192.168.0.2.1022: Flags [S], seq 2333970990, win 14600, options [mss 1460,sackOK,TS val 5439964 ecr 0,nop,wscale 7], length 0
15:11:37.027555 IP 192.168.0.2.1022 > 192.168.0.1.1023: Flags [S.], seq 4045973478, ack 2333970991, win 28960, options [mss 1460,sackOK,TS val 447022397 ecr 5439964,nop,wscale 7], length 0
15:11:37.027785 IP 192.168.0.1.1023 > 192.168.0.2.1022: Flags [.], ack 1, win 115, options [nop,nop,TS val 5439964 ecr 447022397], length 0
15:11:37.027838 IP 192.168.0.2.1023 > 192.168.0.1.514: Flags [P.], seq 6:26, ack 1, win 229, options [nop,nop,TS val 447022398 ecr 5439959], length 20
15:11:37.028033 IP 192.168.0.1.514 > 192.168.0.2.1023: Flags [.], ack 26, win 114, options [nop,nop,TS val 5439965 ecr 447022398], length 0
15:11:37.045155 IP 192.168.0.1.514 > 192.168.0.2.1023: Flags [P.], seq 1:2, ack 26, win 114, options [nop,nop,TS val 5439981 ecr 447022398], length 1
15:11:37.045363 IP 192.168.0.2.1023 > 192.168.0.1.514: Flags [.], ack 2, win 229, options [nop,nop,TS val 447022415 ecr 5439981], length 0
15:11:39.885979 IP 192.168.0.2.1021 > 192.168.0.1.514: Flags [S], seq 580283947, win 29200, options [mss 1460,sackOK,TS val 447025256 ecr 0,nop,wscale 7], length 0
15:11:39.886380 IP 192.168.0.1.514 > 192.168.0.2.1021: Flags [S.], seq 2594209676, ack 580283948, win 14480, options [mss 1460,sackOK,TS val 5442823 ecr 447025256,nop,wscale 7], length 0
15:11:39.886402 IP 192.168.0.2.1021 > 192.168.0.1.514: Flags [.], ack 1, win 229, options [nop,nop,TS val 447025256 ecr 5442823], length 0
15:11:39.886614 IP 192.168.0.2.1021 > 192.168.0.1.514: Flags [P.], seq 1:6, ack 1, win 229, options [nop,nop,TS val 447025256 ecr 5442823], length 5
15:11:39.886827 IP 192.168.0.1.514 > 192.168.0.2.1021: Flags [.], ack 6, win 114, options [nop,nop,TS val 5442823 ecr 447025256], length 0
15:11:39.887705 IP 192.168.0.1.54912 > 192.168.0.2.113: Flags [S], seq 4187838551, win 14600, options [mss 1460,sackOK,TS val 5442824 ecr 0,nop,wscale 7], length 0
15:11:39.887730 IP 192.168.0.2.113 > 192.168.0.1.54912: Flags [R.], seq 0, ack 4187838552, win 0, length 0
15:11:39.891537 IP 192.168.0.1.1022 > 192.168.0.2.1020: Flags [S], seq 2868284930, win 14600, options [mss 1460,sackOK,TS val 5442828 ecr 0,nop,wscale 7], length 0
15:11:39.891559 IP 192.168.0.2.1020 > 192.168.0.1.1022: Flags [S.], seq 3691450842, ack 2868284931, win 28960, options [mss 1460,sackOK,TS val 447025261 ecr 5442828,nop,wscale 7], length 0
15:11:39.891798 IP 192.168.0.1.1022 > 192.168.0.2.1020: Flags [.], ack 1, win 115, options [nop,nop,TS val 5442828 ecr 447025261], length 0
15:11:39.891931 IP 192.168.0.2.1021 > 192.168.0.1.514: Flags [P.], seq 6:26, ack 1, win 229, options [nop,nop,TS val 447025262 ecr 5442823], length 20
15:11:39.892117 IP 192.168.0.1.514 > 192.168.0.2.1021: Flags [.], ack 26, win 114, options [nop,nop,TS val 5442829 ecr 447025262], length 0
15:11:39.909401 IP 192.168.0.1.514 > 192.168.0.2.1021: Flags [P.], seq 1:2, ack 26, win 114, options [nop,nop,TS val 5442846 ecr 447025262], length 1
15:11:39.909591 IP 192.168.0.2.1021 > 192.168.0.1.514: Flags [.], ack 2, win 229, options [nop,nop,TS val 447025279 ecr 5442846], length 0
15:11:42.343628 IP 192.168.0.2.1019 > 192.168.0.1.514: Flags [S], seq 3370128333, win 29200, options [mss 1460,sackOK,TS val 447027713 ecr 0,nop,wscale 7], length 0
15:11:42.344061 IP 192.168.0.1.514 > 192.168.0.2.1019: Flags [S.], seq 1298434116, ack 3370128334, win 14480, options [mss 1460,sackOK,TS val 5445281 ecr 447027713,nop,wscale 7], length 0
15:11:42.344095 IP 192.168.0.2.1019 > 192.168.0.1.514: Flags [.], ack 1, win 229, options [nop,nop,TS val 447027714 ecr 5445281], length 0
15:11:42.344168 IP 192.168.0.2.1019 > 192.168.0.1.514: Flags [P.], seq 1:6, ack 1, win 229, options [nop,nop,TS val 447027714 ecr 5445281], length 5
15:11:42.344354 IP 192.168.0.1.514 > 192.168.0.2.1019: Flags [.], ack 6, win 114, options [nop,nop,TS val 5445281 ecr 447027714], length 0
15:11:42.345537 IP 192.168.0.1.33123 > 192.168.0.2.113: Flags [S], seq 1883120563, win 14600, options [mss 1460,sackOK,TS val 5445282 ecr 0,nop,wscale 7], length 0
15:11:42.345556 IP 192.168.0.2.113 > 192.168.0.1.33123: Flags [R.], seq 0, ack 1883120564, win 0, length 0
15:11:42.349314 IP 192.168.0.1.1021 > 192.168.0.2.1018: Flags [S], seq 1255913310, win 14600, options [mss 1460,sackOK,TS val 5445286 ecr 0,nop,wscale 7], length 0
15:11:42.349333 IP 192.168.0.2.1018 > 192.168.0.1.1021: Flags [S.], seq 1761009462, ack 1255913311, win 28960, options [mss 1460,sackOK,TS val 447027719 ecr 5445286,nop,wscale 7], length 0
15:11:42.349574 IP 192.168.0.1.1021 > 192.168.0.2.1018: Flags [.], ack 1, win 115, options [nop,nop,TS val 5445286 ecr 447027719], length 0
15:11:42.349719 IP 192.168.0.2.1019 > 192.168.0.1.514: Flags [P.], seq 6:26, ack 1, win 229, options [nop,nop,TS val 447027720 ecr 5445281], length 20
15:11:42.349912 IP 192.168.0.1.514 > 192.168.0.2.1019: Flags [.], ack 26, win 114, options [nop,nop,TS val 5445287 ecr 447027720], length 0
15:11:42.366552 IP 192.168.0.1.514 > 192.168.0.2.1019: Flags [P.], seq 1:2, ack 26, win 114, options [nop,nop,TS val 5445303 ecr 447027720], length 1
15:11:42.366690 IP 192.168.0.2.1019 > 192.168.0.1.514: Flags [.], ack 2, win 229, options [nop,nop,TS val 447027737 ecr 5445303], length 0
15:11:45.240399 IP 192.168.0.2.1017 > 192.168.0.1.514: Flags [S], seq 3315083692, win 29200, options [mss 1460,sackOK,TS val 447030610 ecr 0,nop,wscale 7], length 0
15:11:45.240973 IP 192.168.0.1.514 > 192.168.0.2.1017: Flags [S.], seq 458430819, ack 3315083693, win 14480, options [mss 1460,sackOK,TS val 5448177 ecr 447030610,nop,wscale 7], length 0
15:11:45.240994 IP 192.168.0.2.1017 > 192.168.0.1.514: Flags [.], ack 1, win 229, options [nop,nop,TS val 447030611 ecr 5448177], length 0
15:11:45.241107 IP 192.168.0.2.1017 > 192.168.0.1.514: Flags [P.], seq 1:6, ack 1, win 229, options [nop,nop,TS val 447030611 ecr 5448177], length 5
15:11:45.241302 IP 192.168.0.1.514 > 192.168.0.2.1017: Flags [.], ack 6, win 114, options [nop,nop,TS val 5448178 ecr 447030611], length 0
15:11:45.242418 IP 192.168.0.1.37012 > 192.168.0.2.113: Flags [S], seq 1482576292, win 14600, options [mss 1460,sackOK,TS val 5448179 ecr 0,nop,wscale 7], length 0
15:11:45.242437 IP 192.168.0.2.113 > 192.168.0.1.37012: Flags [R.], seq 0, ack 1482576293, win 0, length 0
15:11:45.246231 IP 192.168.0.1.1020 > 192.168.0.2.1016: Flags [S], seq 3384384418, win 14600, options [mss 1460,sackOK,TS val 5448183 ecr 0,nop,wscale 7], length 0
15:11:45.246257 IP 192.168.0.2.1016 > 192.168.0.1.1020: Flags [S.], seq 1533710240, ack 3384384419, win 28960, options [mss 1460,sackOK,TS val 447030616 ecr 5448183,nop,wscale 7], length 0
15:11:45.246490 IP 192.168.0.1.1020 > 192.168.0.2.1016: Flags [.], ack 1, win 115, options [nop,nop,TS val 5448183 ecr 447030616], length 0
15:11:45.246688 IP 192.168.0.2.1017 > 192.168.0.1.514: Flags [P.], seq 6:26, ack 1, win 229, options [nop,nop,TS val 447030617 ecr 5448178], length 20
15:11:45.246893 IP 192.168.0.1.514 > 192.168.0.2.1017: Flags [.], ack 26, win 114, options [nop,nop,TS val 5448184 ecr 447030617], length 0
15:11:45.264315 IP 192.168.0.1.514 > 192.168.0.2.1017: Flags [P.], seq 1:2, ack 26, win 114, options [nop,nop,TS val 5448201 ecr 447030617], length 1
15:11:45.264430 IP 192.168.0.2.1017 > 192.168.0.1.514: Flags [.], ack 2, win 229, options [nop,nop,TS val 447030634 ecr 5448201], length 0
15:11:47.646608 IP 192.168.0.2.1015 > 192.168.0.1.514: Flags [S], seq 3196915944, win 29200, options [mss 1460,sackOK,TS val 447033016 ecr 0,nop,wscale 7], length 0
15:11:47.647057 IP 192.168.0.1.514 > 192.168.0.2.1015: Flags [S.], seq 3914850372, ack 3196915945, win 14480, options [mss 1460,sackOK,TS val 5450584 ecr 447033016,nop,wscale 7], length 0
15:11:47.647078 IP 192.168.0.2.1015 > 192.168.0.1.514: Flags [.], ack 1, win 229, options [nop,nop,TS val 447033017 ecr 5450584], length 0
15:11:47.647275 IP 192.168.0.2.1015 > 192.168.0.1.514: Flags [P.], seq 1:6, ack 1, win 229, options [nop,nop,TS val 447033017 ecr 5450584], length 5
15:11:47.647494 IP 192.168.0.1.514 > 192.168.0.2.1015: Flags [.], ack 6, win 114, options [nop,nop,TS val 5450584 ecr 447033017], length 0
15:11:47.648441 IP 192.168.0.1.40920 > 192.168.0.2.113: Flags [S], seq 3846477005, win 14600, options [mss 1460,sackOK,TS val 5450585 ecr 0,nop,wscale 7], length 0
15:11:47.648468 IP 192.168.0.2.113 > 192.168.0.1.40920: Flags [R.], seq 0, ack 3846477006, win 0, length 0
15:11:47.652221 IP 192.168.0.1.1019 > 192.168.0.2.1014: Flags [S], seq 17413655, win 14600, options [mss 1460,sackOK,TS val 5450589 ecr 0,nop,wscale 7], length 0
15:11:47.652252 IP 192.168.0.2.1014 > 192.168.0.1.1019: Flags [S.], seq 3533140045, ack 17413656, win 28960, options [mss 1460,sackOK,TS val 447033022 ecr 5450589,nop,wscale 7], length 0
15:11:47.652500 IP 192.168.0.1.1019 > 192.168.0.2.1014: Flags [.], ack 1, win 115, options [nop,nop,TS val 5450589 ecr 447033022], length 0
15:11:47.652567 IP 192.168.0.2.1015 > 192.168.0.1.514: Flags [P.], seq 6:26, ack 1, win 229, options [nop,nop,TS val 447033022 ecr 5450584], length 20
15:11:47.652790 IP 192.168.0.1.514 > 192.168.0.2.1015: Flags [.], ack 26, win 114, options [nop,nop,TS val 5450589 ecr 447033022], length 0
15:11:47.668531 IP 192.168.0.1.514 > 192.168.0.2.1015: Flags [P.], seq 1:2, ack 26, win 114, options [nop,nop,TS val 5450605 ecr 447033022], length 1
15:11:47.668587 IP 192.168.0.2.1015 > 192.168.0.1.514: Flags [.], ack 2, win 229, options [nop,nop,TS val 447033038 ecr 5450605], length 0
15:13:17.063489 IP 192.168.0.1.514 > 192.168.0.2.1023: Flags [F.], seq 2, ack 26, win 114, options [nop,nop,TS val 5540000 ecr 447022415], length 0
15:13:17.063514 IP 192.168.0.1.1023 > 192.168.0.2.1022: Flags [F.], seq 1, ack 1, win 115, options [nop,nop,TS val 5540000 ecr 447022397], length 0
15:13:17.063666 IP 192.168.0.2.1022 > 192.168.0.1.1023: Flags [.], ack 2, win 227, options [nop,nop,TS val 447122434 ecr 5540000], length 0
15:13:17.063909 IP 192.168.0.2.1023 > 192.168.0.1.514: Flags [F.], seq 26, ack 3, win 229, options [nop,nop,TS val 447122434 ecr 5540000], length 0
15:13:17.063934 IP 192.168.0.2.1022 > 192.168.0.1.1023: Flags [F.], seq 1, ack 2, win 227, options [nop,nop,TS val 447122434 ecr 5540000], length 0
15:13:17.064128 IP 192.168.0.1.514 > 192.168.0.2.1023: Flags [.], ack 27, win 114, options [nop,nop,TS val 5540001 ecr 447122434], length 0
15:13:17.064148 IP 192.168.0.1.1023 > 192.168.0.2.1022: Flags [.], ack 2, win 115, options [nop,nop,TS val 5540001 ecr 447122434], length 0
15:13:19.927175 IP 192.168.0.1.514 > 192.168.0.2.1021: Flags [F.], seq 2, ack 26, win 114, options [nop,nop,TS val 5542864 ecr 447025279], length 0
15:13:19.927199 IP 192.168.0.1.1022 > 192.168.0.2.1020: Flags [F.], seq 1, ack 1, win 115, options [nop,nop,TS val 5542864 ecr 447025261], length 0
15:13:19.927670 IP 192.168.0.2.1020 > 192.168.0.1.1022: Flags [.], ack 2, win 227, options [nop,nop,TS val 447125298 ecr 5542864], length 0
15:13:19.927744 IP 192.168.0.2.1021 > 192.168.0.1.514: Flags [F.], seq 26, ack 3, win 229, options [nop,nop,TS val 447125298 ecr 5542864], length 0
15:13:19.927768 IP 192.168.0.2.1020 > 192.168.0.1.1022: Flags [F.], seq 1, ack 2, win 227, options [nop,nop,TS val 447125298 ecr 5542864], length 0
15:13:19.927980 IP 192.168.0.1.514 > 192.168.0.2.1021: Flags [.], ack 27, win 114, options [nop,nop,TS val 5542864 ecr 447125298], length 0
15:13:19.927995 IP 192.168.0.1.1022 > 192.168.0.2.1020: Flags [.], ack 2, win 115, options [nop,nop,TS val 5542864 ecr 447125298], length 0
15:13:22.385738 IP 192.168.0.1.514 > 192.168.0.2.1019: Flags [F.], seq 2, ack 26, win 114, options [nop,nop,TS val 5545322 ecr 447027737], length 0
15:13:22.385741 IP 192.168.0.1.1021 > 192.168.0.2.1018: Flags [F.], seq 1, ack 1, win 115, options [nop,nop,TS val 5545322 ecr 447027719], length 0
15:13:22.386278 IP 192.168.0.2.1019 > 192.168.0.1.514: Flags [F.], seq 26, ack 3, win 229, options [nop,nop,TS val 447127756 ecr 5545322], length 0
15:13:22.386310 IP 192.168.0.2.1018 > 192.168.0.1.1021: Flags [F.], seq 1, ack 2, win 227, options [nop,nop,TS val 447127756 ecr 5545322], length 0
15:13:22.386639 IP 192.168.0.1.514 > 192.168.0.2.1019: Flags [.], ack 27, win 114, options [nop,nop,TS val 5545323 ecr 447127756], length 0
15:13:22.386686 IP 192.168.0.1.1021 > 192.168.0.2.1018: Flags [.], ack 2, win 115, options [nop,nop,TS val 5545323 ecr 447127756], length 0
15:13:25.281668 IP 192.168.0.1.1020 > 192.168.0.2.1016: Flags [F.], seq 1, ack 1, win 115, options [nop,nop,TS val 5548218 ecr 447030616], length 0
15:13:25.281692 IP 192.168.0.1.514 > 192.168.0.2.1017: Flags [F.], seq 2, ack 26, win 114, options [nop,nop,TS val 5548218 ecr 447030634], length 0
15:13:25.282091 IP 192.168.0.2.1016 > 192.168.0.1.1020: Flags [F.], seq 1, ack 2, win 227, options [nop,nop,TS val 447130652 ecr 5548218], length 0
15:13:25.282116 IP 192.168.0.2.1017 > 192.168.0.1.514: Flags [F.], seq 26, ack 3, win 229, options [nop,nop,TS val 447130652 ecr 5548218], length 0
15:13:25.282318 IP 192.168.0.1.1020 > 192.168.0.2.1016: Flags [.], ack 2, win 115, options [nop,nop,TS val 5548219 ecr 447130652], length 0
15:13:25.282320 IP 192.168.0.1.514 > 192.168.0.2.1017: Flags [.], ack 27, win 114, options [nop,nop,TS val 5548219 ecr 447130652], length 0
15:13:27.686645 IP 192.168.0.1.514 > 192.168.0.2.1015: Flags [F.], seq 2, ack 26, win 114, options [nop,nop,TS val 5550623 ecr 447033038], length 0
15:13:27.686688 IP 192.168.0.1.1019 > 192.168.0.2.1014: Flags [F.], seq 1, ack 1, win 115, options [nop,nop,TS val 5550623 ecr 447033022], length 0
15:13:27.687167 IP 192.168.0.2.1015 > 192.168.0.1.514: Flags [F.], seq 26, ack 3, win 229, options [nop,nop,TS val 447133057 ecr 5550623], length 0
15:13:27.687194 IP 192.168.0.2.1014 > 192.168.0.1.1019: Flags [F.], seq 1, ack 2, win 227, options [nop,nop,TS val 447133057 ecr 5550623], length 0
15:13:27.687451 IP 192.168.0.1.514 > 192.168.0.2.1015: Flags [.], ack 27, win 114, options [nop,nop,TS val 5550624 ecr 447133057], length 0
15:13:27.687467 IP 192.168.0.1.1019 > 192.168.0.2.1014: Flags [.], ack 2, win 115, options [nop,nop,TS val 5550624 ecr 447133057], length 0
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?