%20%E3%82%92%E9%96%8B%E3%81%8F%20.png)
デバッグのために Linux/Debian にエコー サーバーが必要なのですが、そのために割り当てられたポートがすでに '/etc/services' に表示されており、そのポートは TCP/UDP の 7 番ポートであることに気付きました。
Linux (Debian) でこのポートを開くことは可能ですか? できない場合、代替手段は何ですか?
答え1
Debian で echo サービスを設定するには、次のxinetd
コマンドでインストールできます。
apt-get install xinetd
次に、ディレクティブをdisable
に変更する必要があります。ファイルが存在しない場合は、次のように作成します。no
/etc/xinetd.d/echo
# default: off
# description: An xinetd internal service which echo's characters back to
# clients.
# This is the tcp version.
service echo
{
disable = no
type = INTERNAL
id = echo-stream
socket_type = stream
protocol = tcp
user = root
wait = no
}
# This is the udp version.
service echo
{
disable = yes
type = INTERNAL
id = echo-dgram
socket_type = dgram
protocol = udp
user = root
wait = yes
}
disable = no
を設定またはファイルを作成した後、次xinetd
のコマンドで再起動します。
sudo service xinetd restart
TCP サービスをテストするにはecho
:
$nc localhost echo
testing...
testing...
xxxx
xxxx
^C