🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.program
1 messages
1 total messages Started by ���ܵ�Сʨ Thu, 07 May 1998 00:00
ʹ��inetd����server
#861
Author: ���ܵ�Сʨ
Date: Thu, 07 May 1998 00:00
122 lines
8735 bytes
    Inetd
    UNIX����ϵͳ��,��������TCP/IP֮�ϵ�����server,��:telne
td��ftpd�ȡ���Щ�����һ����ͬ�Ĺ���:����ijһ����˿�,���ͻ�
�������ʱ,����(fork)�ӽ��Ϊ�ͻ��ṩ������Ȼ��Щdaemonֻ
��client���ӽ��������Ľ��ʱ��,����Щ���ʹ���˴������ڴ�
��CPUʱ϶��Ϊ�˽����һ����,UNIX�����"����������"�ĸ���,��
��inetd(internet dam on)��
    inetd��һ��daemon���,����ϵͳ����ʱ��ʼ����,����ֻ����
��һ����̡�inetdʹ��һ�����Ϊ���server����,����inetd����s
erver���Ӷ˿�,server���?����ϵͳ������,�Ӷ����ϵͳ�ĸ���
�����������󵽴�ʱ,��inetd�������ĸ�server�ṩ����,����Ϊ��
������fork�ӽ������server���Բ�ͬ�ķ�������,inetd��ȡ��ͬ��
����ʽ,������������������������,��inetd���̷��ؼ������
�˿ڡ�����������������������ʱ,inetd�ȴ�e rver����,�ڴ��ڼ�
�������κ���������server�˳���,inetd���ؼ������ʹ��inet
���������˿��н�̵�����,���������ɳ���������������������,ʹ
server��ȫ����������򽻵�,ֻ��Ҫʹ�ñ�׼���������clientͨ
�š����ڲ���Ҫ����socket�⺯��,server��д�������,�ļ����ȸ�
��

    ���������ļ�
    inetd������ʱ,��Ҫ��/etc/inetd.conf��/etc/services�ļ���
��ȡ���ò�������ֱ�����������ļ��ĸ�ʽ��
    /etc/services�ļ��е�ÿһ�д��ϵͳ�ṩ������������Ӧ
�Ķ˿����Э����ÿһ�еĸ�ʽ��:<������> <�˿ں�/Э����> <
����>��
    �����Ǹ��ļ��е�һ�Ρ�
    echo�� 7/tcp
    echo�� 7/udp
    discard��9/tcp sink nul
    systat��11/tcp users
    ftp�� 21/tcp
    telnet��23/tcp
    smtp�� 25/tcp
    time�� 37/tcp timeserver
    rlp�� 39/udp resource
    whois��43/tcp nicname
    domain��53/tcp nameserver
    /etc/inetd.conf�ļ��е�ÿһ�и��κ�������:
    �������� ��/etc/services�ļ�ָ��;
    ��socket���� ��stream���ͻ���dgram����;
    ��Э�� ��/etc/protocols�ļ�ָ��,һ��Ϊtcp��udp;
    ��wait|nowait���� ֻ����datagram sockets, stream sockets
Ӧָ��Ϊ nowait
    ���û� ����server���û���;
    ��server���򡡡� inetd���е�server��·����;
    ��server�������server����ʹ�õIJ���
    ������inetd.conf�ļ���һ���֡�
    ftp�� stream tcp nowait root /etc/ftpd�� ftpd -l
    telnet stream tcp nowait root /etc/telnetd telnetd
    tftp��dgram udp��wait root /etc/tftpd��tftpd
    login��stream tcp nowait root /etc/rlogind rlogind
    shell��stream tcp nowait root /etc/remshd��remshd
    exec��stream tcp nowait root /etc/rexecd��rexecd 
    InetdӦ��
    ����inetd���ǿɼ򵥷���ؽ���server,����Ҫ�κ�C���Ա��
����������ʹ��UNIX�е�����who��ʾ��ΰ�who��Ϊһ��server����
��,������Ҫ���ļ�/etc/services��/etc/ie td.conf�мӼ��С�
    ��/etc/services�����������:
    wserver  2100/tcp
    2100������Ϊ�÷������õĶ˿ں�,����Ҳ����ѡ������Ķ˿�
��,ֻҪ�����������˿ںų�ͻ���ɡ�
    ��/etc/inted.conf�����������:
    wserver  stream  tcp  nowait  root /bin/who  who
    �༭���ļ���,���񻹲���ʹ��,��Ϊinetd�������Զ������ļ�
�ĸı���������ý��,��Ҫ������inetd��SIGHUP�ź�ʹ֮���ļ���
�ڷ����ź�ǰ�������ҵ���̵�ID�����ǿ���ʹ�����µ�����:
    s06$ ps -ae | grep inetd
    ��ʾ���Ϊ:
    164 ?    0:00 inetd
    ɱ��164���:
    s06$ kill -HUP 164
    ����ʹ��netstat������ʾ����״̬,���ǻᷢ��inetd�������
���µķ������˿ڡ�
    s06$ netstat -a | head
    Active Internet connections (including servers)
    Proto Recv-Q Send-Q Local Address  Foreign Address   (st
ate)
    tcp��0�� 0�� *.wserve����*.*��������������LISTEN
    tcp��0�� 0�� s06.login�� s04.1022�������� ESTABLISHED
    tcp��0�� 3�� s06.login�� s04.1023�������� ESTABLISHED
    tcp��0�� 0�� s06.3167����192.9.200.206����ESTABLISHED
    tcp��0�� 0�� s06.3166����192.9.200.206����ESTABLISHED
    tcp��0�� 0�� s06.3165����192.9.200.206����ESTABLISHED
    tcp��0�� 0�� s06.3164����192.9.200.206����ESTABLISHED
    tcp��0�� 0�� s06.3162����192.9.200.206����ESTABLISHED
    ��Ȼserver�Ѿ���ʼ�����������ǻ������пͻ��˹��ߡ�����cl
ient��,����Ҳ���������ֳɵ�UNIX����:telnet ��ͨ�������,elne
tʹ�ñ�׼�˿�23���ӵ�telnetd������,�����ǿ���Ϊ��ָ��һ����
�ڡ�telnetʹ�÷�����:telnet <������ ><�˿ں�>������telnetlo 
calhost 1220������ӵ������1220�˿ڡ�ʹ��telnet������serv
er�����ı������ܷ��ص��ı������,telnet������Ϊ�����ı���ʽ
Э��Ĺ��ߡ�
    �������ǿ��Լ���server�Ĺ���������������ǽ�����������,
��s04,ʹ��telnet��s4 ��¼����һ����s06,��telnet������ָ����
��˿ں�2100��
    s04$ telnet s06 2100
    Trying...
    Connected to s06.
    Escape character is ��^��'.
    cat��  console���� Jul 14 08:16
    cat��  ttyp9������ Jul 14 15:02
    cria�� ttypa������ Jul 14 15:04
    dony�� ttypb������ Jul 14 13:15
    ccc��  pty/ttys1�� Jul 14 15:19
    cria�� ttype������ Jul 14 14:04
    robert ttypf������ Jul 14 10:44
    cria��ttyp8������  Jul 14 15:00
    Connection closed by foreign host.
    �µ��������ʼ������
    ����������UNIX����ϵͳΪHP-UX 9.07��

--
 ________ _____          _____        ______________  _____ 
 ___  __ \___(_)________ ___(_)       __  ___/___  /_ ___(_)
 __  /_/ /__  / ___  __ \__  /        _____ \ __  __ \__  / 
 _  ____/ _  /  __  /_/ /_  /         ____/ / _  / / /_  /  
 /_/      /_/   _  .___/ /_/          /____/  /_/ /_/ /_/   
                /_/                                         

�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: hsia.nju.edu.cn]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads