121

หนังสือ Cloning freebsd

  • Upload
    man-kb

  • View
    910

  • Download
    1

Embed Size (px)

Citation preview

Page 1: หนังสือ Cloning freebsd
Page 2: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

1

���ก��ก��� �� �<� FreeBSD 8.0 & Authen ������������ �!�"�#��$�%� ����%�"� &�������"����'( ��������ก� Cloning FreeBSD8.0 & Setup Authentications (�"$ �!"��� CPU 32bit) ��G$��H �I� $��I' (� J �$K%ก FreeBSDAuthen &���"�#L$������ � �!KM��%���H� FreeBSD & Authen &L��K��(���(�#�ก� �N������� $LG�!&$�N������"����'(��G$��H

ก���(�I� #M� #M���OP���L���%Q + #M��G�(��� ����%�"� �� �"�ก!��%� (��$I� !�(� �"�ก�PNกS�กG��กK�#���H �G�� I� !����$(LG�"������กKGL��"�'(#�(' � (�G�"T��กG��L �"������ก�"��� ��G��U� �"�����#����(����#$ ก��VW��G(���$�I� #M� �(�#M� #M�X�ก� ��YZ�$�%�XM� (yim) �� �"�#!�� �!�ก� �Lก��ก�������G�#G Config �G� J ��(���$��H!��&��I�^�_���ก�$#L�#M$ Service FreeBSD Server �!�"�"����'(��G$��H�$�a�� � reboot , shutdown , reload squid ��L�fS PHP + Sudo �(�#M� (����ก%��%I�S� �ML����K �"�#!�� �!��L�����$($ #��$�%� &�����������ก� �Lก��� ���h%���%ก� FreeBSD &����TL�NH� �$�aI�^��!KM��%���H� FreeBSD & Authen123 &���!��T� �(�#M�I� $ �$ I� K�������� K(����H���$L &���"�#!�� �! �"�ก!�������$($ (�%��G(�(��($���� MSN �� (��$��)

����� �M���H �(�#M��I' (� J �$K%ก FreeBSD & Authen �Mก�G��"�ก!����� �"�ก�������M���L�����$($ �$�LG� $��UV"�� (M����# ��G�I' (� J กT�"�ก!������"�#!�� �! �"�#��$�%�����G(�I' (I�^�_���ก�$ OPEN SOURCE (��G#�G ICT �(��� ��PK�%�G(&�

#��$�%� ����%�"� 10 ก�กp#$ 2553

�L_"��&r���(ก�� Word KGL���ก��%���H�&���ก �LT�&t�� www.kroonis.org/SetupAuthen8.doc

Page 3: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

2

G�� ก��ก��� �� �<� FreeBSD 8.0

1. "����'(��G$��H�K�#!LG ��'(ก "$�aN� �"�ก���T�&��� #!�� � / �$���� ��(�ก� ���L

ก��MO$ Enter 2. �Mก#��H��� I%$I�#!�� ��� �"�ก��MO$ Enter 3. ��'(ก Package �%���H��� ����(�ก� �"�ก��MO$ Spacebar 4. ก�����Nก&r����L�#!�� � nano �"�ก��MO$ Ctrl + o (��L_(#���) �$��L��MO$ Enter 5. ((ก�กก��ก�&���L�#!�� � nano �"�ก��MO$ Ctrl + x 6. "����'(��G$��H�K� o �����L_( �� 0 ������P����

Setup FreeBSD8.0 �"�M���� ��'(ก�(� ���h%���%ก� FreeBSD8.0 $�����"����'( �I� �U��M����#�' (� PC , �#�' (� Server �GL��"VG� �K�ก������ Onboard a��K��L(��K� ��(���$(�� $��UV"�$$#'( FreeBSD &$G�����กก��ก������ Onboard �N�ก��&L���กLG�ก���กLG#��� a�I��($���LกT��% $�%���H� FreeBSD8.0 ก�����#��� �"��!�$��� "�� (�G��z���$��T��� (&$G$�����V�"�� #��� �ก��LG���(G�� ��z���$ �!�"�ก��%���H��%�I��&��)

1. Setup FreeBSD 8.0 "����'(��G$��H&�������$��G��%���H� FreeBSD 8.0 �"����L#���������G� �K��!"����%���H� 2 ��G� #'( FreeBSD8.0 #1 �� ��G� Config 8.0 a�I��($���LกT��% $�%���H� FreeBSD 8.0 �����H 1.1 ��H�#G CMOS �"� Boot �ก CD-ROM กG(� (�!&��� #��� &$G�(ก�GL� #���) 1.2 �ก��H���G��G��%���H����&���KG(�(G���G� CD / DVD ROM 1.3 � ���h%���%ก� FreeBSD 8.0 � �!ก� Boot �(�(��_�$��% �"��(��กLG� aN���H��(� Country Selection �"���'(ก���� 218 Thailand ���Lก��MO$ Enter

Page 4: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

3

��'(ก USA ISO ���Lก��MO$ Enter

��'(กก��%���H���� Standard ก��MO$ Enter

ก��MO$ Enter �I' (�'����ก��%���H�

Page 5: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

4

ก��MO$ Enter �I' (�'����ก��%���H�

_���ก�$� ����I�%K� ���H�"$� �"���' (���~���กP��NH����fI ���Lก��MO$��L D �I' (��I�%K� ���%$((ก�"�"$�

�ก��H��"�����I�%K� ��"$G _��ก���~�I%$I���L C ���Lก��MO$ Enter

Page 6: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

5

ก��MO$ Enter (�ก#��H� �I' (�'����ก�����I�%K� ���H�"$�

�� ��~�I%$I��"�ก���L q � �����G��H��(� Install Boot Manager for drive �"���'(กก��%���H���� Standard ก��MO$ Enter

� ��� ���� Message LG � �����Gก� Create BSD partition �"�ก��MO$ Enter

� ��� a$LG��(�ก�����I�%K� ��� FreeBSD &"$ �"�ก��MO$ Enter 1 #��H� ��% $����I�%K� ��G� J ������ �$�!��������H

Page 7: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

6

�����H� G�� / 512M

Swap 2 ��G�(���$ �KG� ��$ 1 G 2 ��G�(���$ #'( 2048M /home 5G /tmp 500M /usr 10G

/var L���M<���H��H���M���<����

1. �������� root �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 512M "�'(

1G กT&�� I%$I����T��"�ก��MO$ Enter

1.1 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter

1.2 I%$I� / �ก��H�ก��MO$ Enter 2. �������� Swap Partition �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 2 ��G�(���$ I%$I�������T��"�ก��MO$ Enter

Page 8: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

7

2.1 ก��MO$��กP��� ��'(ก#!�� � Swap A swap partition.

3. �������� home �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 5G

3.1 I%$I����I'H��� ���T� ก��MO$ Enter 3.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter 3.3 I%$I�K' ("�(� /home ���Lก��MO$ Enter

4. �������� tmp �Q�����RS���H��ก�T�� U�V�กW��T��G�V �� X &$G#L���G�&L�$ก �� �!�"���G�&L��� $� 500M 4.1 �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 500M 5. �������� usr �!"����กT���($��� ����H�"$� ���������� �!�"���G�&L� 10G 4.1 �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 10G 4.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter 4.3 I%$I�K' ("�(� /usr ���Lก��MO$ Enter

Page 9: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

8

6. �������� var �Q�����RS�����Y���กW� Log Files , Database �"��K�I'H��� �� �"�'(��H�"$� 6.1 �"�ก��MO$��L C �� ��~�I%$I� ���Lก��MO$ Enter 6.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter 6.3 I%$I�K' ("�(� /var ���Lก��MO$ Enter

�ก��H� �"�ก���L q �I' (((ก�กก���G�I�%K� � (Fdisk) a��!a�ก��(�� &��I�%K� ���H�"$� 6 "�(� ���fI

��H��(�ก� Choose Distributions �"���'(ก 4 , 5 , 6 , B Costom (���L��'(ก src ���� sys)

��' (���กP���$�� [ x ] 4 Developer �ก��H�ก��MO$ Spacebar ��'(ก�$����H � ��� �"�

��'(กfS �"���'(กfS"��ก���� [ x ] en ���fI"��a��&�

Page 10: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

9

��'(ก���T� �"�ก���T�&��� OK ���Lก��MO$ Enter � ก���$���"��"��ก �"���'(ก��ก��G(&� 5 Kern-Developer , 6 User �$�!����� ก�GL$���L������ � ก���$���"��"��ก �"�ก��MO$��กP���&��� B Custom ���Lก��MO$��กP���&��� src

��'(ก [ x ] sys /usr/src/sys (FreeBSD kernel) ���Lก���T�&��� �MO$ OK

Page 11: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

10

� ก���$�� "�� src ก���T�&��� OK ก��MO$ Enter � ก���$"����'(ก��ก� �"�ก���T�&��� OK ���L ก��MO$ Enter � ก���$���"��"��ก �ก��H��"�ก���T�&��� OK ก��MO$ Enter � ��� a$LG��(�ก��%���H��ก�"�G�&"� �"���'(ก 1. CD / DVD Install from a FreeBSD CD/DVD ก��MO$ Enter

ก��MO$ Enter �I' (�'����ก��%���H� �(��กLG� ��� �!ก��%���H��� ��G� Partition ���T� ��H��(���H�K��L���I(�$#L�

"����ก�%���H����T�_���ก�$� ����LG a���(�ก��%���H�_���ก�$�G� J �I% $��%$�"��K�#!�� � /usr/sbin/sysinstall "�'(� I%$I�#!�� � sysinstall กT&��#���

Page 12: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

11

� ��� ��L��(�ก�������(��#�' (� Server �"���'(ก Yes

� ��� �"���'(ก LAN LG��(�ก��K� LAN ��L&"�������L�K' ($�G(��VV�(%���(����T��ก ISP _��_���ก�$ FreeBSD � ������K' (ก�������"��(�#��� �KG� dc0 , dc1"�'( bge0 , bge1 �NH�(��Gก���� "�(�(�ก������ (�กfIก������ #'( em0 �I� �K�_���ก�$�!�(���ก��%���H�)

- �"���'(ก LAN ��L��ก em0 � #��� _��ก��MO$ Enter �G�&����

�"���'(ก No �I� ��&$G�K� IPv6

�"���'(ก No �I� ��&$G��(�ก������ก&(I��ก�#�' (��$G�G�

Page 13: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

12

������H��(�ก���H�#G IP Address �"�ก��ก����������ก#��� �����H - Host : �"�I%$I�K' (�� ��(�ก� �KG� authen.log.com ���Lก���T�&��� Domain : _���ก�$� I%$I�#G_��$��"�(��_�$��% - ก���T�&��� IPv4 Gateway : I%$I�#G Gateway �#�'(�G�(%���(����T��� ���K�(��G - ก���T�&��� Name server : I%$I�#G DNS �(��#�'(�G�(%���(����T��� ���K�(��G - ก���T�&��� IPv4 Address : I%$I�#G&(I��(�ก����������ก �KG� 203.172.188.130 - ก���T�&��� Netmask : I%$I�#G Netmask �(��#�'(�G� a��K������ �� ipstar �(�ก� ��L�PNกSX%ก�� &��#G Netmsk #'( 255.255.255.248 (�K����&(I�&�� 6 / 4 ��(��) �!#G&(I� �������G� &���G����G� KG(��"����ก������"���%ก�(%���(����T��� �K�(��G

����"���%ก� IPv4 Gateway Name Server IPv4 Address Netmask ADSL 192.168.1.1 192.168.1.1 192.168.1.1 255.255.255.0

Leadline �$������ 203.146.15.9 �$������ 255.255.255.248 ipstar samart �$������ 203.192.33.34 �$������ 255.255.255.248 ipstar TOT 192.168.5.100 203.113.24.199 192.168.5.1 255.255.255.0

- ก���T�&��� OK

Page 14: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

13

�� ��"�ก���������� 1 �!�� �"���'(ก Yes

��(�ก��"��#�' (� Server ���� Gateway �"���'(ก Yes

&$G��(�ก��K��� Network service that it Provides �"���'(ก No

��(�ก� Remote ���&�#L�#M$ Server �� SSH �"���'(ก Yes

&$G��(�ก��K��� FTP _�� anonymus �"���'(ก No

&$G��(�ก��K��� NFS Server �"���'(ก No

Page 15: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

14

&$G��(�ก��K� NFS client �"���'(ก No

��H��(���H �"���'(ก No

��(�ก���H�#G time zone �"���'(ก Yes

��H��(���H �"���'(ก No

��'(ก_t��L� �"���' (���กP���&��� Asia

Page 16: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

15

��' (���กP���&��� 44 Thailand ���Lก��MO$ Enter

ICT look reasonable �"���'(ก Yes

� ��a$LG��(�ก� �K���&r���(� Linux "�'(&$G �"���'(ก Yes

� ��a$LG ��(�ก��%���H� Package �I% $��%$ (�ก&"$ �"���'(ก No

� ������LG ��(�ก����� Account user "�'(&$G �"���'(ก Yes

Page 17: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

16

User and group Management � ��� �"�����ก�MG$����K��� �� ��������K��� ��' (���~���กP���$�� Group ���Lก��MO$ Enter

�"�����ก�MG$����K��� admin

- ก�MG$�������� �� (admin)

��' (���~���กP��NH�&��� User �I' ( Add user �"�ก��� ��

Page 18: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

17

Add User K' (LG admin �����H - KG(� Login id: �"�I%$I� admin - KG(� Group: �"�I%$I� admin - KG(� Password: I%$I��"���G��(� admin �$��(�ก� #��$�%�ก!"������ logserver - KG(� Full name: I%$I�K' (��T$�(� User - KG(� Member groups: a���(�ก�(�MV��"� user �� remote server &���"�I%$I� #!LG wheel

�$' (ก�(ก��($���G� J #�����L �"�ก���T�$�� OK

"����ก�!ก� Adduser ���T����L �"���' (���~���กP��NH�&��� X Exit this menu �I' (((ก�กก� Adduser

� ��� �"��~(��"���G��(� root ��#�%#ก�ก!"���"���G� root �� �!�G���G Hack �ก �"�I%$I���~� EN ��L���(#L$fS&�� �KG� I%$I� =k9b9hv�dki8ofu �(��ก ��� #���LG��������I%$I�#!LG( &� ( ..... ���� ..... K�%��(�ก�#���)

Page 19: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

18

New password : �~(��"���G��(� root ��&L�"�$�'$��T��� Retype new password : �'�����"���G��(� root (�ก#��H�

� ��a$LG��(�ก��%���H� Package "�'(�ก�&�#G�G� J (�ก&"$ �"���'(ก No

กT� ก���$���"���%���H� sysinstall Main Menu �"���'(ก [ X Exit Install ]

��'(ก Yes ���L�"��(��G� CD ((ก �ก��H�� ��� reboot �(��กLG� Boot �#�' (����T�

Page 20: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

19

�"��!ก� login : ��L� root �� �~(��"���G��(� root �� &��ก!"��&L��(��%���H� FreeBSD 8.0 a��!�$���������"���G� root #'( =k9b9hvhdki8ofu ��������ก������

a�I%$I��"���G� root a�ก��(� � ��กT� (�MV��"����&���%"����ก�� ��&����H�"$�

��G��G��� 2 ������G� Config 8.0 ���&���KG(�(G� CD-ROM ���L�� � ns# mount /cdrom #!�� ��%��G(ก�� CD-ROM ns# cd /cdrom/distfiles #!�� ����&��K��� CD-ROM "�(� distfiles ns# cp -rf * /usr/ports/distfiles #!�� �#���(ก&r����H�"$�&�&L��� "�(� distfiles ns# cd /cdrom/www/ #!�� ����&��� "�(� www �ก��G� CD-ROM

ns# mkdir /home/admin/www #!�� �����&���ก�(�� www �� "�(� /home/admin/ ns# cp -rf * /home/admin/www #���(ก&r����H�"$�&�&L��� /home/admin/www/

Page 21: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

20

�ก���กก�L����Uj�� CD-ROM �"��(��G� Config 8.0 ((ก

ns# mount /cdrom ns# cd /cdrom ns# cd / #!�� �((ก�กก��K��� CD - ROM ns# umount /cdrom �ก��%กก��K��� CD-ROM

Page 22: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

21

�<�������MH�� Server L�� ��ก��� �UV"ก��%���H�_���ก�$�ก Ports � &$G#G(�I�ก��#!LG Error-Code1 a� Admin &����H�#G Time Zone ��� L�� �L� �����U��M��� #!�� ��!"�����H�#G�L��"$G �K�#!�� � date Rm�n.��M�������.��� �KG� L���� 15/05/2553 �L� 12:30 �K�#!�� �&�������H ns# rehash ns# date 201005151230 �"��K�#!�� � date �I' (��L��(�LG FreeBSD Server ����L���L�����#G�U��M���"�'(��� ns# date Update Ports Tree ก��ก��� KGL��"� Error-code1 ������G(�� ���$�(��G��� �N��(�� �!LG#L��!ก� update ports tree ��L� _���K�#!�� ��G(&���H��#��H���ก ((��(%��ก�LT��(��� ThaiBSD) # portsnap fetch extract update �� ��ก� update #��H��G( J &��K�#!�� � # portsnap fetch update �$' (���T����L ports tree กT� �����U��M��� KGL����UV" url �� &��L��_"��&r��&$G��� �I� &r���กG�ก%�&� ��H��(���H�K��L���I(�$#L��NH�(��Gก��#L$��TL(%���(����T� + #L$��TL�#�' (� Server

�� �<��R�Uก�� nano �Q����Uก��G�T�� Config ��X

ns# cd /usr/ports/editors/nano/ ns# make install clean � ��� �"���H�#G�I% $ �"�ก���T�&��� OK ���Lก��MO$ Enter �G�&���� �(��กLG_���ก�$� �%���H�_���ก�$ nano ���T�

�ก��H��� ��"� FreeBSD ���#G�U��M����I' (�"�_���ก�$ nano �$�a�!��&�� _��&$G��(��� � reboot �"��K�#!�� � rehash ��� �����H ��#�%#ก��K���#!�� � nano �I% $��%$

Page 23: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

22

ก��K�#!�� � nano �� �K��G(� J $������H

- #��"�������� ��(�ก� ก��MO$ Ctrl + w ���LI%$I� ��(#L$�� ��(�ก�� #��"

- &������������ ����(�ก� I%$I� nano +120 /usr/local/etc/squis/squid.conf /usr/local/etc/squid/sqdiu.conf #'( &r���� ��(�ก�� �ก�&�#��� +120 "$�#L$LG �"���z�&r�����LL% �&��� ������ 120

R���U ���V��L�����rL�������� �����W �����

1. config Nameserver ns# nano /etc/resolv.conf ���LI%$I����&(I� DNS �(��#�'(�G� - a��K�(%���(����T��L����$ ipstar ��� DNS �� �K�#'( 203.192.33.34 203.146.237.237 203.146.15.9 - a��K�(%���(����T�������(�ก� ��L�PNกSX%ก� ��� DNS �� �K�#'( 203.146.15.10 203.146.237.237 - a��K�(%���(����T��L����$ ipstar �(� TOT ��� DNS �� �K�#'( 203.113.24.199 203.113.127.199 - a��K�(%���(����T� ADSL ��� DNS �� �K�#'( 192.168.1.1

�I% $ DNS a�ก��(����L�"�����Nก �� ((ก�กก��ก�&�&r�� resolv.conf 2. Config System ns# nano /etc/rc.conf ���L�I% $#G&(I��"�ก��ก���������� 2 �I' (�(&L��K��!"��� remote ���&���%"����ก�� �� ** �$�a�K���_��&$G��(��G(��VV�(%���(����T�กT&�� **

Page 24: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

23

_��I%$I�#!�� � ifconfig_K' (ก���������� 2=�inet 192.168.212.1 netmask 255.255.255.0� �I% $�� �ก�&�a�ก��(����L�"�����Nก&r�� rc.conf _��ก��MO$ Ctrl + o �$��L� Enter �� ((ก�กก��ก�&��"�ก��MO$ Ctrl + x 3. Reboot Server �I' (�"�ก��ก�&��G� J �!��&�������ก�% "����ก�ก�&� �� �I% $#G&(I��"�ก��ก���������� 2 ���L�"��� � reboot server �����H ns# shutdown -r now �(��กLG Server � Boot ���T� ���L$(��G�� Login : �"��!ก� Login �����G� ����L� root �$�� &��ก�GL$���L������ 4. "����ก Boot �#�' (� ���L Login ��L� root ���L �"���L��(���#G ipadress �(�ก��������L�#!�� � ns# ifconfig � ��� ����#G�G� J ���fI

�กfI����� � ������LGI�ก������ 2 �� #'(

- ����ก em0 ก!"��&(I�L��(ก #'( 192.168.5.240 (L��(ก) - ���� 2 em1 ก!"��&(I�L��� #'( 192.168.212.1 (L���)

Page 25: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

24

�G(�ก��H&�&$G��(�&��� ��� "���#�' (� Server ���L �"��K��#�' (���ก�G� (Clients) Remote ���&� config � �� ��$'(�ก��LG Admin &��$�� �(��G"���#�' (� Server ��L�ก� SSH �����H

�� �<��R�Uก�� sshsecureshellclient-3.2.9

�K���G� CD-ROM ��G��� 2 �� �"�$I��($ก��"����'(��G$��H ������G� Config 8.0 ��������&�������$_���ก�$ sshsecureshellclient-3.2.9.exe �"����L#��� &$G��(������L��L_"�� :-)

1. �����%H�#�%ก_���ก�$ sshsecureshellclient-3.2.9.exe

2. #�%ก�MO$ 3. #�%ก�MO$

4. #�%ก�MO$ 5. #�%ก�MO$

6. #�%ก�MO$ 7. #�%ก�MO$

8. �(��กLG_���ก�$� �%���H����T�

Page 26: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

25

9. #�%ก�MO$ _���ก�$� ����&(#(�&L��� Desktop 2 &(#(�

���fI

�K� Remote Server �K����_���ก�$ FTP

�����(fI _���ก�$ SSHSecureShellClient

Page 27: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

26

Remote �G��R�����Y��ก� FreeBSD Server

�G(����� Cross - "�L����G(&$G�"$'(�ก�� - (a�&$G&���G(�G� Swicthing Hub) �กKG(� LAN ���� 2 ���ก�� LAN �(��#�' (� Clients "�'(�#�' (� Notebook

1. �����%H�#�%ก&(#(� _���ก�$ SSHSecureShellClient-3.2.9.exe � ��z��NH�$�"��K��� �"�#�%ก�� �MO$ Quick Connect ���fI

2. �~(���� �(��� Host Name : �"�I%$I� 192.168.212.1 ���T����L#�%ก�MO$ admin #'( User �� �� ก!"���(��%���H� FreeBSD 8.0 3. a��K' ($�G(ก�� Server &�� � ��� �"���G�"���G��(� User �$�� ก!"��&L��(� �%���H� FreeBSD 8.0 ��������ก!"���"���G� admin �(��%���H���L�#!LG logserver

4. a�I%$I��"���G�a�ก��(� � ��� (�MV��"���� Server FreeBSD �� �K�#!�� � su &�� ns$: su passwd : I%$I��"���G� root

Page 28: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

27

a�I%$I��"�� root a�ก��(� กT� �����G�a� # ����LG���� root ���L#���

5. #�%ก�� �MO$ New File Transfer Window

6. _���ก�$ SSH Secure File Transfer � ��z��NH�$�"��K��� �!"���ก��K���กT#��� ก��_���ก�$ ftp �� L J &� �r�$���t�������#�' (���ก�G� �� �r�$����L�����#�' (� Server ก�_(���($���"�#�%ก��'(ก&r���� �r�$���t��#��&L� I��($ก���ก&���G(��� �r�$����L PNกS��H��(�ก� Remote Server ��L�_���ก�$ SSH �� �LT�&t�� http://www.npd.in.th/~manis

ก�L�����R�Uก�� vi �Q���� Admin

��ก��ก�&�&r���G� J ��� �� UNIX ��� �K�#!�� � vi �����H���#L������กL%X��K�����'H(����กG(�� #��� �!"������ �(���ก��K�#!�� ��"�PNกS�ก��� �����H

L��ก�R�t� ������ L��ก�R�t� ������ dd ����H������� r I%$I������� ��L i �I% $#!�� �&�� R I%$I������� ��L ��กLG� ก� ESC

:wq! ����Nก�� ((ก : set nu ����"$���������� x ����� ��L(�กS� a �I% $��($���G(�ก Cursor

yy #���(ก��H������� :q ((ก�ก_���ก�$ p L�"��� Cursor / string #��"��(#L$�� ��(�ก�

��G"����'(ก��%���H� CloningFreeBSD8.0 & Authen ��G$��H �K�#!�� � nano #��� �I� �"$ �!"��� Admin ��(��"$G ก��K���#��� J ก��ก��K���_���ก�$ Notepad �N�� �Lก�� �K���&��#�G(�กLGก��K�#!�� � vi

Page 29: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

28

ก� Compile Kernel

�� Compile Kernel �I' (�"��(����ก��ก��K��� Authen , QUOTA , ADSL ������� I��($���L�"��!�$�����H ns# cd /usr/src/sys/i386/conf ���&����"�(� /usr/src/sys/i386/conf ns# cp /home/admin/www/WIFI8 ./ #���(ก&r�� /home/admin/WIFI8

����#!�� �#���(ก&r�� WIFI8 tN �#��$�%�&�������$&r�� WIFI8 _��I%$I�#!�� � options �G� J I��($�K���&$G��(������L�$I%$I��(� �(�H!LG&$G��(�I%$I��(�� #��� L��G���R�Q�����H 29 ������ ��Ga� Admin �� $�#L$K!�Vก����L a���(�ก��!�(��"��I% $ options �G� J �����H

# cd /usr/src/sys/i386/conf ���&����"�(� /usr/src/sys/i386/conf # cp GENERIC WIFI8 #���(ก&r�� GENERIC ����&r���"$G#'( WIFI8 # nano WIFI8 ���LI%$I�#!�� � options �G� J �����H * "�$I%$I��%�� #��� �$��'(����L� *

ident WIFI8 options IPFIREWALL options IPFIREWALL_FORWARD options IPFIREWALL_DEFAULT_TO_ACCEPT options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=120 options IPDIVERT options ALTQ options ALTQ_CBQ options ALTQ_RED options ALTQ_RIO

Page 30: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

29

options ALTQ_HFSC options ALTQ_PRIQ options ALTQ_NOPCC device pf device pflog device pfsync #ADSL Manis options NETGRAPH options NETGRAPH_ASYNC options NETGRAPH_BPF options NETGRAPH_ECHO options NETGRAPH_CISCO options NETGRAPH_FRAME_RELAY options NETGRAPH_HOLE options NETGRAPH_IFACE options NETGRAPH_LMI options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_PPP options NETGRAPH_PPTPGRE options NETGRAPH_RFC1490 options NETGRAPH_KSOCKET options NETGRAPH_TEE options NETGRAPH_TTY options NETGRAPH_UI options NETGRAPH_VJC options NETGRAPH_ETHER options NETGRAPH_SOCKET

Page 31: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

30

options NETGRAPH_PPPOE options HZ=1000

����Nก&r�� ก��MO$ Ctrl + o �$��L��MO$ Enter �� ((ก�กก��ก�&�ก��MO$ Ctrl + x # config WIFI8 # cd ../compile/WIFI8 # make cleandepend;make depend;make;make install

��H��(�ก� Compile kernel �"��(���� NAT Authen FIREWALL � �K��L���I(�$#L� (�� $� 30 - 40 ���) �"��(��กLG� ��� compile kernel ���T� ���L�"�I%$I�#!�� �

# nano /etc/rc.conf ���L�I% $#!�� � *** "�$I%$I��%�� #��� ����'(�#M����L ***

firewall_enable="YES" firewall_type="OPEN" firewall_quiet="YES" natd_enable="YES" natd_interface="em0" // em0 #'( ก����������ก�� �G(�ก����(��((ก��T� natd_flags="-s -u -m"

pf_enable="YES" pf_rules="/etc/pf.conf" pf_flags="" pflog_enable="YES" pflog_logfile="/var/log/pflog" pflog_flags=""

�ก�&�&r�� /etc/rc.conf a�ก��(����L�"�����Nก�� ((ก�กก��ก�&� �"� boot �#�' (��"$G_���K�#!�� � reboot ก� Enter �$' ( boot �#�' (����T����L �"���L��(�LG��&�� kernel �"$G"�'(��� _��I%$I�#!�� � uname -a � I���(#L$

Page 32: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

31

ns# uname -a FreeBSD ns.authen123.com 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Tue Apr 6 11:13:15 ICT 2010 [email protected]:/usr/src/sys/i386/compile/WIFI8 i386 ns#

G�<� ��ก� �� �<� FAMP 8.0 (Mysql50 + Apache22 + PHP5)

������ ก�I%$I�#!�� ��� UNIX &$G��(�I%$I�#!�� �"$�กT&�� I%$I� 2-3 ��L �ก��H� ก��MO$ TAB FreeBSD � I%$I�#!�� ��� �"�'(�"��(�#���

�ก�� ��ก����%���H� Server ��L� FreeBSD $"��#��H� �$�a�!�����H��(�ก��%���H� FAMP �(�� ���h%���%ก� FreeBSD �"��%���H��$�!��������H 1. Setup Perl5.8 �!�$�����H ns# cd /usr/ports/lang/perl5.8 ns# make config ��'(ก Options �I% $��%$���fI

ก���T�&��� OK ���Lก��MO$ Enter ns# make install && make clean // �(��กLG� ��� �%���H� Perl5.8 ���T� � I�ก����(#L$LG ..... Clearning .... perl5.8 ����LG�%���H�&���!��T� �G(��( 2 ���#���

Page 33: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

32

2. Setup Mysql50

ns# cd /usr/ports/databases/mysql50-server ns# make WITH_CHARSET=tis620 WITH_XCHARSET=all WITH_COLLATION=tis620_thai_ci WITH_OPENSSL=yes BUILD_OPTIMIZED=yes WITH_ARCHIVE=yes WITH_FEDERATED=yes WITH_NDB=yes install clean ������ make WITH_CHARSET=tis620 �"�#���(ก�ก&r�� Authen8.doc _��#��$�%�&�������$&r��&L��"����L(��G����G� Config 8.0 ���L�!&�L��� "���G� SSH �!�"�� �Lก �L���TL �$G��! a�ก��(� &$G��(������L�I%$I�#!�� ��(�#��� (�� �%�I��&��

�!"�����H��(�ก�#���(ก#!�� ��ก&r�� Authen8.doc �"����ก��!��&��� _���ก�$ Microsoft Word ���L��z�&r�� Authen8.doc �NH�$�K��� �ก��H��"��!�$�����H �R���R�Uก�� SSH Secure Shell Client G�<��L���� U����Q 1. #�%ก�MO$ ���L�~(���($��ก��%��G(ก�� Server ���fI

2. a�I%$I���($��ก��%��G(a�ก��(� _���ก�$ SSH Secure Shell Client � �"��~(��"���G�����K�

Page 34: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

33

3. a�I%$I��"���G� admin a�ก��(� � ��� (�MV��"������%"����ก� Server &��

#�%ก�MO$ OK ���L�(��กLG� ��� �����#�' (�"$� $ ����LG�����G� ��&�����L ���� ����K� K' (LG admin �� $��%�X%�K�#!�� � su �I' (���� ���a� ���� root &��

4. I%$I�#!�� � su ���Lก��MO$ Enter

Page 35: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

34

5. I%$I��"���G� root a�a�ก��(� FreeBSD 8.0 กT� (�MV��"�����K� admin ���� ���a� ���� root &�� $��%�X%�������G root �Mก�� ก� �a� root ���� ���ก�#�' (�"$� $ �����#�' (�"$� # ���L#���

6. ���&�#���(ก#!�� �&r�� Authen8.doc _���!�$��H��(��� �(ก&L� �ก��H� ���ก�

�!��$�� _���ก�$ SSH Secure Shell Client (��#�%# �"�ก��MO$ Alt + Tab ����#!�� ������ �K�����ก��!��� "LG�_���ก�$�� ��z�(��G�� Windows) 6.1 #�%ก�� �MO$L� 6.2 �(��กLG� ��� �!ก�L�#!�� ��� &��#���(ก&L� ก��K���_���ก�$ SSH Secure Shell Client �!�"�� �Lก �L���TL a�ก��(� �$G��! �I� &$G��(�I%$I�#!�� ��(� �!aN�"��&"� กT�"����$#���(ก#!�� ��ก&r�� Authen8.doc ���L���&��� _���ก�$ SSH Secure Shell Client �ก��H�กT�"�#�%ก�MO$ &�����#��� �"$ �!"��� Admin ��(��"$G�� ����(� �������ก������ ������������ �I� #���(ก���LL�#!�� ���G��H��(�

����fI�� �K�#!�� �L� ��L�_���ก�$ SSH Secure Shell Client �N��(�� �!�!"�����(��"$G �"��K�L%X�#���(ก���LL� (�GI%$I�#!�� ��(�� #��� �I� _(ก��%�$�$กกLG �"�#���(ก���LL���� � �Lก �L���TL a�ก��(� �$G��! &$G�����L�I%$I�#!�� ��(�

�(��กLG� ��� �%���H� Mysql50 ���T� a��K� FAMP 8.0 �� �����$�"�����G� CD-ROM � ��� �%���H�_���ก�$ Mysql50 �"������ &$G��(�&��N�_���ก�$�I% $��%$�ก ports $(�ก �!�"�

Page 36: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

35

� �Lก�� �L���TL�G(ก��%���H� �K��L��� $� 15 -25 ��� "����ก�%���H����T����L

� ��� ���� �����H

This port has installed the following startup scripts which may cause /usr/local/etc/rc.d/mysql-server // #!�� � start / stop mysql-server ===> Cleaning for mysql-server-5.0.45_1 ns#

���L�I% $#!�� � mysql_enable="YES" ���&r�� /etc/rc.conf �����H ns# echo �mysql_enable=�YES�h >> /etc/rc.conf ns# reboot �� � restart server �I' (�"� mysql50 �� �%���H�&L��!��

"����ก�����G Server &�����L �"�I%$I�#!�� �

# /usr/local/bin/mysqladmin -u root password I%$I��"���G� mysql root �KG�

# /usr/local/bin/mysqladmin -u root password dkil7dkk=k9b

�!"���ก�����K��� mysql �"�#���(ก(�กS���L"�� #��� &�L��� "���G� SSH

ns# mysql -u root -p'dkil7dkk=k9b' // dkil7dkk=k9b #'( �"�� rootmysql Welcome to the MySQL monitor. Commands end with ; or \g. mysql>

��������($��K' (LG radius , syslog �� ก!"���%�X%�"� root �K�����($�� radius , syslog &�� _���K��"���G� dkil7dkk=k9b (�"���G�ก!"���(�� #��� ��G��(��K��"���� ก!"���(���H��ก��ก�&�&r�� Config �G� J �"��"$'(�ก���Mก&r�� tN �� &��ก�GL��"�L��(�G(&� I%$I�#!�� ���I ����

Page 37: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

36

mysql> create database radius; // #!�� ���������($��K' (LG radius Query OK, 1 row affected (0.00 sec) mysql> create database syslog; // #!�� ���������($��K' (LG syslog Query OK, 1 row affected (0.00 sec)

mysql> grant all on radius.* to root@localhost identified by 'dkil7dkk=k9b'; // #!�� �ก!"���%�X%�"�ก������K�������($�� radius ���� ��Hก!"���"� root $��%�X%�K�����($�� radius �� ก!"���"���G��K�����($�� radius #'( dkil7dkk=k9b

mysql> grant all on syslog.* to root@localhost identified by 'dkil7dkk=k9b'; // #!�� �ก!"���%�X%�"�ก������K�������($�� syslog ���� ��Hก!"���"� root $��%�X%�K� ����($�� syslog �� ก!"���"���G��K�����($�� rdius #'( dkil7dkk=k9b mysql> exit // I%$I�#!�� � exit �I' (((ก�ก��K���_���ก�$ Mysql

3. �� �<��R�Uก�� Apache22 ��MH�L�����ก� www ns# cd /usr/ports/www/apache22 ns# make config ��H�#Gก���'(ก �"�ก��MO$ Spacebar "�'(#��L��L��# 1 #��H� �!#�V$ก� #��� �"���'(ก

&��� [ * ] MYSQL ���Lก���T�&��� OK ก��MO$ Enter

ns# make install && make clean

�(��กLG_���ก�$� �%���H����T� a�$�"���G�a$LG� �"��%���H�( &��I% $"�'(&$G �"�ก��MO$ Spacebar �I' (��'(ก#G�I% $ ���Lก��MO$ Tab &��� OK �ก��H�ก��MO$ Enter (�K��L�ก��%���H��� $� 10 � 20 ���) "����ก�%���H����T����L &r�� config_���ก�$ Apache22 � (��G�� "�(� /usr/local/etc/apache22 �� �!�"�G�&r���LT�&t��"��ก��������&��ก!"���"$G�"�(��G�� "�(� /var/www/html/ �I' (�"����ก�� path _���ก�$�(�_#��ก�_����������ก�����

Page 38: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

37

R���U ��Uก��G�T�� httpd.conf

�"��$�a�!��&���ก�% �G� J _������� shellscipt �I% $#G Config �"�ก�� apache22 �����H

ns# nano /root/apache22.sh I%$I�#!�� ��G(&���H

#!/bin/sh kldload accf_http mkdir /var/www mkdir /var/www/html sed -i '' 's,DocumentRoot "/usr/local/www/apache22/data",DocumentRoot "/var/www/html",g' /usr/local/etc/apache22/httpd.conf echo �accf_http_load="YES"h >> /boot/loader.conf

/usr/local/sbin/apachectl start echo �apache22_enable="YES"h >> /etc/rc.conf

����� �K�#!�� � sed -i �� �s,��(#L$��%$,�����L���(#L$�"$G,g� �!�"�G�&r�� ��������� sed -i �� �"�I%$I��G(ก����������������L

����Nก&r���� ((ก�กก��ก�&� �ก��H��� ��"�&r�� apache22.sh �!�������H ns# chmod 775 /root/apache22.sh ns# sh /root/apache22.sh

��z�_���ก�$ Internet Explorer ���LI%$I� 192.168.212.1 � I��(fIก��!���(� _���ก�$ Apache22

Page 39: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

38

R���U �� Apache22 L�� User L������W��� ����

# cd /usr/local/etc/apache22/Includes # nano user_dir.conf #���(ก#!�� �����G�&�L��� "���G� SSH <IfModule mod_userdir.c> UserDir public_html <Directory /var/www/html/*> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS PROPFIND> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS PROPFIND> Order deny,allow Deny from all </LimitExcept> </Directory> </IfModule>

4. �� �<� PHP5 ���V��R���� �ก� FreeBSD8.0 ns# cd /usr/ports/lang/php5 ns# make config �!#�V$ก ��(���'(ก [ * ] APACHE ��L� a�&$G�!ก�������

�(�fS PHP � error �"��� save ... Files "�'(�����LT��I�"���L J ����'(�#M����L��(��!�$� #���

Page 40: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

39

ns# make install clean �(��กLG� �%���H� PHP5 ���T� a�$�"���G�a$( &�กT&$G��(���'(ก�I% $� #��� �"�ก���T�&��� OK ��� "����ก�%���H� PHP5 ���T����L �"��%���H� php5-extensions �G(&�����

# cd /usr/ports/lang/php5-extensions # make config

�"���'(กrU�ก��G(&���H BZ2 , CALENDAR , CTYPE , CURL , DOM , EXIF , FILETNFO , FILTER , FRIBIDT , FTP , DG , GETTEXT , IMAP , MBSTRING , MYSQL , ODBC , OPENSSL , PCRE , PDF , PDO , PDO_SQLITE , POSIX , SESSION , SIMPLEXML , SOCKETS , SPL , SQLITE , TOKENIZER , XML , XMLREADER , XMLWRTTER , ZIP , ZLIB

�$' (��'(ก#�����L ก���T�&��� OK ก��MO$ Enter ���L�� � # make install && make clean

a�$�"���G�a$( &�กT&$G��(���'(ก#G�I% $ "�'(� ��'(ก�I% $กT&�� �"�ก���T�&��� OK ��� �(��กLG� ��� �%���H� php5-extention ���T� (��K��L���"�G(� 20 -30 ��� &�� ��GกT#M�$#Gก���L��� ����&�#��� � I�ก����(#L$ Cleaning ...... php5-extensions

R���U ���T�� php.ini L�� php5 ���r�Q�����

�"�#���(ก&r�� php.ini �ก /home/admin/ConfigWWW/php5/php.ini �����H ns# cp /home/admin/www/ConfigWWW/php5/php.ini /usr/local/etc/ _��#��$�%�&���ก�&�&r�� php.ini �"�I��($�K������L#��� &$G��(��ก�&��(�

5. R���U �� Apache22 L�����Y�กก�� PHP5 # nano /usr/local/etc/apache22/httpd.conf

���L#��" index.html �$' (I����L�"�I%$I� index.php กG(� index.html

Page 41: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

40

DirectoryIndex index.php index.html // I%$I� index.php กG(� index.html

#��"������ AddType application/x-compress .Z ���LI%$I�#!�� ��I% $���&� �����H AddType application/x-compress .Z ��%$ #���(ก#!�� � 3 ������ &�L��� "���G� SSH AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps AddType application/x-httpd-php .html

����Nก&r�� httpd.conf �ก��H��"�����&r�� test.php �� "�(� www �����H ns# echo '<? phpinfo(); ?>' > /var/www/html/test.php

ns# /usr/local/sbin/apachectl stop

ns# /usr/local/sbin/apachectl start

���(�����ก&r�� test.php �ก�#�' (���ก�G�LG PHP5 �!��"�'(��� �"�I%$I� 192.168.212.1/test.php &������IX����fI"��a��&�

Page 42: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

41

ก�L���Q��H� echo

�ก#!�� � echo "�� 40

echo '<? phpinfo(); ?>' > /var/www/html/test.php

����� �K�#!�� � echo ����&r�� /var/www/html/test.php _�����ก#!�� �����&r�� test.php #'( <? phpinfo(); ?> - �#�' (�"$� > "$�aN� �"�#!�� � echo ����� ��(#L$��%$��H�"$���&r����H� a����&$G$�&r��กT�"�����&r���"$G�"������ - �#�' (�"$� >> "$�aN� �"�#!�� � echo ���ก"�'(�I% $��(#L$����&r����H�

Setup Authentications & Wifi Hostpot

1. Setup Freeradius2 + Setup Coovachilli ns# cd /usr/ports/net/freeradius2 ns# make rmconfig-recursive // #!�� ���Ha��#���'(ก&L����L� ��� �����($���กG((ก

ns# make config ��'(ก Options �I% $ �����H USER , MYSQL , PERL , PYTHON , DHCP EXPERIMENTAL ��'(ก���T��"�ก���T��� OK ���Lก��MO$ Enter

Page 43: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

42

ns# make install && make clean �(��กLG� ��� �%���H� Freeradius2 ���T� � I�ก����(#L$�� $���H

http://www.freeradius.org/ ===> Cleaning for freeradius-2.1.8_1

2. Setup Coovachilli

ns# cd /usr/ports/net-mgmt/coovachilli/ ns# make install && make clean

�(��กLG� ��� �%���H� Coovachilli ���T� � I�ก����(#L$�� $���H http://www.coova.org/ ===> Cleaning for coovachilli-1.0.12_1

"����ก�%���H� Freeradius2 , Coovachilli ���T����L ��H��G(&��"� Config Files �G� J �(� radiusd , Coova �$�!�����H��(��G(&���H

�� �<��R�Uก�������Y��ก������j��L�������� �����W (Web Mangement) ns# cd /home/admin/www ns# cp -rf * /var/www/html/ �(��กLG� ��� �!ก�#���(ก&r����H�"$����T� �"���G��(� rootmysql #��$�%� ก!"���"����L#'( dkil7dkk=k9b a���(�ก����� ���"���G� rootmysql �����"���"$G�� Admin ��(�ก��"��K�#!�� ������H ns# mysql -u root -phdkil7dkk=k9bh

Mysql> grant all on radius.* to root@localhost identified by ����������L���h; Mysql> grant all on syslog.* to root@localhost identified by ����������L���h; Mysql > exit

�$' (((ก�ก_���ก�$ Mysql ���L �"�����K���_���ก�$ Mysql �"$G(�ก#��H���L��"�� rootmysql �� ���� ���"$G �����H

Page 44: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

43

ns# mysql -u root -ph���� rootmysql ��H�R��H��L���h

กT� �$�a����K�_���ก�$ Mysql &��

�Q�G� ����G����� radius �����R�Uก�� phpMyAdmin ���&��!���� "���G�_���ก�$ Internet Explorer �ก��H�I%$I� 192.168.212.1/db �(��ก#��G� ��� ��z�_���ก�$ phpMyAdmin2.10.3 �NH�$�K��� �"������G� ����L� root �"���G�a��!�$#��$�%� กT�K� dkil7dkk=k9b ���Lก��MO$ Enter (�"���G� #'( ก�PNกSK�%)

��'(ก����($�� radius �ก�r�$��t�� ���L�(��ก#��G �ก��H�#�%ก#!�� � Import �I' (�!��������($���G� J �(� Freeradius2 �"���'(ก�ก��G� Config 8.0 K' (&r�� radius.sql ���L#�%ก�MO$ �I�����G��H� ��กT� �!�������G� J �!�L� 18 ��� �������(����L

Page 45: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

44

R���U ���T�� Config Freeradius2

�I' (�"��G��� �L���TL #��$�%������$&r�� Shellscript K' (LG radius.sh &L��"����L#��� �!�$�����H ns# nano /root/radius.sh ## �"�#���(ก#!�� �����G�&�L��� "���G� SSH

#!/bin/sh echo "######################################" echo "Script Config Freeradius2 By Manis Slangsingha" echo "#######################################" cp /home/admin/www/radius2/clients.conf /usr/local/etc/raddb/ cp /home/admin/www/radius2/sql.conf /usr/local/etc/raddb/ cp /home/admin/www/radius2/radiusd.conf /usr/local/etc/raddb/ cp /home/admin/www/radius2/default /usr/local/etc/raddb/sites-available/ cp /home/admin/www/radius2/dialup.conf /usr/local/etc/raddb/sql/mysql/ echo 'radiusd_enable="YES"' >> /etc/rc.conf /usr/local/etc/rc.d/radiusd start echo "######################################" echo "Create Config Files Freeradius2 Finish" echo "#######################################"

ns# chmod 775 /root/radius.sh ns# sh /root/radius.sh �I�����G��H Freeradius2 กTI��($�!�����L#���

�!"��� Admin �� $�#L$K!�V���L &$G��(�ก�( &����ก��L� J �I� &$G����#L$�$�a�(����(� �"��ก�&�&r�� Config radiusd �(��$�!�����H��(��G(&���H "�$��$��H��(���T��� (r���H���� radius.sh U���กW��� ����Q�V����)

ns# sed -i �h -ehs,testing123,wifi,gh /usr/local/etc/raddb/clients.conf ��� �� �K�#!�� � sed #��"��(#L$ testing123 ���L�����L� secret ��������ก!"������#!LG wifi

Page 46: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

45

ns# nano +683 /usr/local/etc/raddb/radiusd.conf �(�#�' (�"$� # "����������H((ก

#$INCLUDE sql.conf กG(��ก�&� $INCLUDE sql/mysql/counter.conf "����ก�&�

ns# nano +38 /usr/local/etc/raddb/sql.conf ���� �������� login=�root� ���� �������� password=��"�� rootmysql� ���fI$�"�����L�#��� ns# nano + 148 /usr/local/etc/raddb/sites-available/default �ก�&�#G���fI

�I% $�#�' (�"$� # "�������� unix �� files ���#�' (�"$� # ((ก"�������� sql

Page 47: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

46

���#�' (�"$� # ((ก"�������� daily �I% $#!�� �����G��G(�ก������

expiration logintime

_���I% $#!�� �����G���H�G(�ก#!�� ��� $�(��G��%$����� expire_on_login noresetcounter dailycounter monthlycounter

�I% $�#�' (�"$� # "�������� unix

�I% $�#�' (�"$� # "�������� files

Page 48: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

47

�I% $�#�' (�"$� # "�������� unix �I% $�#�' (�"$� # "�������� radutmp ���#�' (�"$� # ((ก"�������� sql

�I% $�#�' (�"$� # "�������� radutmp ���#�' (�"$� # ((ก"�������� sql

ก!"��ก���L��(�K' (����K���� case sensitive "�$����K��$�a�K� user ����Lก������K�I��($ก��&�� �ก�&������H (&��$�ก#M�I�"$$P �tG�� L) ns# nano +81 /usr/local/etc/raddb/sql/mysql/dialup.conf

fIกG(��ก�&� �"����#�' (�"$� # "�������� 82 � 89 &����ก��ก�&����fI

fI"����ก�&�

Page 49: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

48

#��"������ The default queries are case insensitive �"��I% $�#�' (�"$� # &L����"��

������ 93 - 100 ���fI fIกG(��ก�&�

fI"����ก�&�

#��"������ group_membership_query = "SELECT groupname �"����#�' (�"$� # ���"�������� 103 - 106 ((ก ���fI

fIกG(��ก�&�

fI"����ก�&�

fI"����ก�&� #��"������ simul_count_query = "SELECT COUNT(*) �"����#�' (�"$� # "��������((ก ���fI

fIกG(��ก�&�

Page 50: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

49

fI"����ก�&� �I% $#!�� ���&r�� /etc/rc.conf ns# echo �radiusd_enable="YES"h >> /etc/rc.conf ก��� ��"� Freeradius2 �!�� ��L�#!�� � ns# /usr/local/etc/rc.d/radiusd start ���(�LG radiusd �%��G(ก������($�� Mysql &��"�'(��� # radiusd -X "����ก_���ก�$"�M�������L�"� #���(ก#!�� ���H&�L��� "���G� SSH ns# radtest a1 12345 localhost 0 wifi � &����ก���� � ������LG radiusd �$�a�%��G(ก����VK�����K����ก����($�� radius &�����L � &����ก���� �� $���H

Page 51: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

50

R���U ���T�� Config G�� CoovaChilli

����&r�� Shellscript �I' (#���(ก&r�� Config Coovachilli #��$�%��ก�&�I��($�K������L (��(���G��G� ConfigAuthen8.0 �� �#�' (� Server ��L�) �$ก!"��L� LAN ���� 192.168.212.0/24 ns# nano /root/coova.sh

#!/bin/sh echo "######################################" echo "Script Config Coovachilli By Manis Slangsingha" echo 'kern.ipc.msgseg=16000' >> /boot/loader.conf echo 'kern.ipc.msgmnb=16000' >> /boot/loader.conf touch /usr/local/etc/chilli/hs.conf touch /usr/local/etc/chilli/local.conf cp /home/admin/www/coova/defaults /usr/local/etc/chilli/ cp / home/admin/www/coova/main.conf /usr/local/etc/chilli/ echo 'coovachilli_enable="YES"' >> /etc/rc.conf echo 'coovachilli_flags="--coaport 3779 --conf /usr/local/etc/chilli.conf"' >> /etc/rc.conf echo "######################################" echo "Create Config Files Coovachilli Finish" echo "#######################################"

# chmod 775 /root/coova.sh # sh /root/coova.sh �ก�&�&r�� /usr/local/etc/chilli/defaults �I� &r���!��T��� #��$�%������$�"� ����K�&$G&�� �I� #G�(� LAN �G� Server K' (�(����กT�G�ก����L�

Page 52: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

51

ns# ifconfig -a � ��� ����LG$� LAN ก� �� K' (( &� � &����ก�����

��������H�� �� - em0 ก!"���"�����ก������L��(ก (WAN) - em1 ก!"���"�����ก������L��� (LAN)

�K�#!�� � sed ����G��I' (�ก�&�K' (ก������L��� _��ก������L����(� Server �����#'( dc1 ns# sed -i �h -e �s,em1,dc1,gh /usr/local/etc/chilli/defaults ns# sed -i �h -e �s,em1,dc1,gh /usr/local/etc/chilli/main.conf

�� ��"�_���ก�$ Coovachilli �!����L�#!�� � ns# /usr/local/etc/rc.d/coovachilli start

�ก�&��I% $��%$_���ก�$ $.�� 2 �"��(����ก��!��ก�� Freeradiusd2 #��$�%�&��������G��� �ก�&��I% $��%$�ก $.�� ��%$ _���K��"���G��(� rootmysql #'( dkil7dkk=k9b a��K��"�� rootmysql �� ก!"���(���(��ก�&�&r���%��G(����($��กG(�� &��ก�GL��"�L��(a��&�

Page 53: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

52

# chmod 777 /var/www/html/admin/upload # chmod 777 /var/www/html/bsex.txt # /usr/local/www/lightsquid/lightparser.pl Uก��GL��ก�T mrtg U�����ก�TG�� Server R�YY����

ns# cfgmaker public@localhost> /usr/local/etc/mrtg/mrtg.cfg Yก��<�Uก��G config �T�� mrtg.cfg �����< ns# nano /usr/local/etc/mrtg/mrtg.cfg U���������Q��H� �����<

WorkDir: /var/www/html/show/ Options[_]:growright,bits

indexmaker --columns=1 --output=/var/www/html/show/index.html /usr/local/etc/mrtg/mrtg.cfg

I%$I�#!�� �������G(��������������L ���T����Lก��MO$ Enter �� ����&r�� mrtg.cfg 3 #��H��%��G(ก�� (�� $� Error ���กT&$G��(�����

ns# mrtg /usr/local/etc/mrtg/mrtg.cfg

��H�#G�"�ก�r mrtg ����$�L��� ����(� _����H�#G Crontab �����H

ns# nano /etc/crontab �I% $#!�� ���H&L� �������G��M��(�&r�� */5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg #L$"$� �� ��"�ก�r mrtg ����ก�r�"$G (update) �Mก J 5 ��� (http://www.thaibsd.com/webboard/show.php?Category=thaibsd&No=11781) �I�����G��HกTI��($�K� Authen ���L#��� �"� reboot server ��L�#!�� � # reboot

Page 54: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

53

�Q���� Admin ��H���M<���L�ก�R���U �� ��(�ก��ก�&�#G Config �(� �"��ก�&�#G �$�!�����H��(��G(&���H ns# echo 'kern.ipc.msgseg=16000' >> /boot/loader.conf ns# echo 'kern.ipc.msgmnb=16000' >> /boot/loader.conf

�"�#���(ก�� ����&r�� Config Coova �����H ns# cp /usr/local/share/examples/coovachilli/main.conf.sample /usr/local/etc/chilli/main.conf ns# touch /usr/local/etc/chilli/hs.conf ns# touch /usr/local/etc/chilli/local.conf

ns# nano +14 /usr/local/etc/chilli/defaults �ก�&�#G&(I��� K' (ก������� LAN �����H

HS_LANIF=dc1 # Subscriber Interface for client devices # �ก�&������� HS_LANIF=eth1 ���� HS_LANIF=K' (���ก������� 2 (LAN) HS_NETWORK=192.168.212.0 # HotSpot Network (must include HS_UAMLISTEN) HS_NETMASK=255.255.255.0 # HotSpot Network Netmask HS_UAMLISTEN=192.168.212.1 # HotSpot IP Address (on subscriber network) # ���� ��&(I�L�f����$��(�ก� �ก 10.1.0.0 �� 10.1.0.1 ����&(I�L��"$G HS_UAMPORT=3990 # HotSpot Port (on subscriber network) # �ก�&�#G�G� J �����H HS_UAMSECRET= ht2eb8ej6s4et3rg1ulp HS_RADIUS=127.0.0.1 HS_RADIUS2=127.0.0.1 HS_RADSECRET=wifi HS_UAMALLOW=192.168.212.0/24 HS_UAMSERVER=192.168.212.1 HS_UAMFORMAT=http://$HS_UAMSERVER/hotspotlogin.php HS_UAMHOMEPAGE=http://$HS_UAMLISTEN:$HS_UAMPORT/prelogin HS_UAMSERVICE=http://$HS_UAMSERVER/hotspotlogin.php

Page 55: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

54

HS_WWWDIR=/var/www/html HS_WWWBIN=/usr/local/etc/chilli/wwwsh

�ก�&�&r�� /usr/local/etc/chilli/main.conf "�'(#���(ก#!�� �����G�&����#!�� ���%$ # nano /usr/local/etc/chilli/main.conf

cmdsocket /var/run/chilli.sock pidfile /var/run/chilli.pid net 192.168.212.0/255.255.255.0 uamlisten 192.168.212.1 uamport 3990 dhcpif dc

// �ก�&� dc1 ����K' (ก������L��� (� LAN) adminuser chillispot adminpasswd chillispot uamallowed 192.168.212.0/24 uamdomain .pm.int uamdomain .authen123.com uamdomain .avast.com uamdomain .free-av.com uamdomain .eset.co.th uamdomain .eset.com uamdomain .malwarebytes.org uamdomain .update.microsoft.com uamdomain .mozilla.com #domain lan dns1 192.168.212.1 dns2 8.8.8.8

Page 56: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

55

uamanydns #nodynip statip 192.168.212.0/24 dynip 192.168.212.0/24 dhcpstart 20 // ��% $�"� Coova ��ก&(I���H���G 192.168.212.20-254 dhcpend 254 // �GL�&(I� 192.168.212.2-192.168.212.19 �"� Fix ip &�� uamhomepage http://192.168.212.1:3990/prelogin uamserver http://192.168.212.1/hotspotlogin.php uamsecret ht2eb8ej6s4et3rg1ulp radiussecret wifi radiusserver1 127.0.0.1 radiusserver2 127.0.0.1 radiusauthport 1812 radiusacctport 1813 radiusnasid nas01 radiuslocationid isocc=,cc=,ac=,network=Coova, radiuslocationname My_HotSpot locationname "My HotSpot" wwwdir /var/www/html wwwbin /usr/local/etc/chilli/wwwsh coaport 3779

��L��(�LG �ก�&�a�ก��(� �"�����Nก&r���� ((ก�กก��ก�&�

��H�L�� CoovaChilli �Q�������Q��H� ns# /usr/local/etc/rc.d/coovachilli stop ns# /usr/local/etc/rc.d/coovachilli start � ���!����LG Starting coovachilli

Page 57: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

56

ns# ifconfig -a � ������((ก$LG Coovachilli I��($�!�����L _�� Coova � ���� TUN0 ก!"��#G&(I�L� 192.168.212.1 �"�ก��ก���������� 2 (� LAN) �"��(� (��_�$��% _���� ��&$G��(�ก!"��#G&(I��"�ก��ก������L�f������

Uก�R�����Rก������M�G����H ��� Fix ip ��(�#�ก��G�a�$�(M�ก����#�'(�G� �KG� Printer Network �"���H�#G Fix ip &����H���GKGL�&(I� 192.168.212.2-192.168.212.19 ��G��(��� ��"� Coovachilli "�M�ก��!��กG(���L�#!�� � /usr/local/etc/rc.d/coovachilli stop �$' (�!ก� Fix ip ���T����L�N��� ��"� Coovachilli �!���"$G(�ก#��H���L�#!�� � /usr/local/etc/rc.d/coovachilli start �I�����G��HกT�ก��UV" Coovachilli ก��(M�ก����#�'(�G��� $�#L$�!������(� Fix ip

R���U ���R�Uก�������Y��ก������j��L�������� �����W a� Admin &$G&��ก!"���"���G� rootmysql ���� dkil7dkk-vh=k9b �"��ก��"���G��(�

rootmysql �"�a�ก��(�ก��&r���G(&���H (�ก"�(� //var/www/html)

1. �ก�&�&r�� admin/include/config.inc.php �I' (�%��G(ก������($�� radius �����H

Page 58: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

57

ns# nano /var/www/html/admin/include/config.inc.php

<? php # configuration for database $_config['database']['hostname'] = "localhost"; $_config['database']['username'] = "root"; $_config['database']['password'] = "L������ rootmysql "; $_config['database']['database'] = "radius"; ����Nก&r�� config.inc.php �� ((ก�กก��ก�&�

2. �ก�&�&r�� log/ Connections/ dbconnect.php �I' (�%��G(ก������($�� radius �����H ns# nano /var/www/html/log/Connections/dbconnect.php

<?php $hostname_syslog = "127.0.0.1"; $database_syslog = "radius"; $username_syslog = "root"; $password_syslog= "L������ rootmysql"; ����Nก&r�� config.inc.php �� ((ก�กก��ก�&�

3. �ก�&�&r�� syslog/ Connections/ dbconnect.php �I' (�%��G(ก������($�� radius �����H ns# nano /var/www/html/syslog/Connections/dbconnect.php

<?php $hostname_syslog = "127.0.0.1"; $database_syslog = "radius"; $username_syslog = "root"; $password_syslog= "L������ rootmysql"; ����Nก&r�� config.inc.php �� ((ก�กก��ก�&�

Page 59: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

58

U�V�Qก�L�����R�Uก�� �.����

1. ���ก��!��&��� �#�' (� Clients �G(�ก"�L��(�!���&r�� radius.sql �$' (�!���T����L �"�((ก�ก� �� ���L�� KG(� Address I%$I� 192.168.212.1/admin

2. Login �����G� �� _��ก�(ก��($���� KG(� Login : admin password : passwd

� I�ก���$��"��ก�(�_���ก�$ Web Mangement ���fI

���H�ก����j��L�������� �����W �����H 1. #�%ก�$�� Y��ก�ก����j��L��

2. #�%ก�MO$ �I' (�I% $ก�MG$����K���(%���(����T� �$�aก!"��K� L_$�ก��K���(%���(����T�&�� ��K� L_$� , ��L���� ����'(�&��

Page 60: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

59

3. ก�(ก��� �(����ก� �Lก��ก�MG$����K��� #��� J fI��"��a��&�

�� Attribute ������ ��G�&����#��H�� (�MV��"��K�(%���(����T�&������#��H� �$�!�L�K� L_$��� ก!"��&L�

��ก�MG$����K��� (�K� Attribute Expire-After) ��G�&����L��� (�MV��"��K�(%���(����T�������'(� �$�!�L�K� L_$��� ก!"��&L�

��ก�MG$����K��� (�K� Attribute Max-Daily-Session) ��G�&������'(�� Max-Monthly(�MV��"��K�(%���(����T�������'(� �$�!�L�K� L_$�

�� ก!"��&L���ก�MG$����K��� (�K� Attribute -Session �L��� ��G�&����H�"$�

(�MV��"��K�(%���(����T����K� L_$� "$����L�K���(ก�G(&�� �$�!�L�K� L_$��� ก!"��&L���ก�MG$����K��� (�K� Attribute Max-All-Session

�"��������� �� ก!"��LG ก�MG$����K�����H $��%�X%�K���(%���(����T��������&"� �$�a�(&��� �Mก��ก�����(%���(����T�#�rO&��#��� (�"����(��I% $ก�MG$����K����(�� #���)

�$' (ก�(ก��� �(���#�����L�"�#�%ก�MO$ _���ก�$� �!ก�����Nกก�MG$����K���������($�� radius I��($ก����z��K���ก�MG$��H��"�(��_�$��% ���fI"��a��&�

Page 61: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

60

a���(�ก��ก�&���� �(����(�ก�MG$�"$G�"�#�%ก��� "�'(��(�ก���ก�MG$��H��%H��"�#�%ก�� ��� ก�����ก�MG$����K�����(�&$G$��$K%ก��ก�MG$��H� �N�� �$�a��&��

���H�j��L��U��ก���� �$����H�"$ �!"������(%���(����T�#�rO _���ก�$a�ก((ก����"��$�aI%$I�#��(������K���(%���(��&�� �!"�����H��(�ก��I% $����K����ก�MG$ �!�$�����H

1. #�%ก�$�� ���H�j��L��U��ก����

Page 62: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

61

�ก��H�#�%ก�MO$ �(��ก#��G_���ก�$� �G�((ก����(%���(����T�����&r�� PDF ���fI

�I' (�"�����K��������G� ��&��� �Lก #��$�%��N��ก�&� Code php �"$G �"�_���ก�$�MG$�"���G��"��I��� 4 ��L(�กS� ����ก������� 1 "��ก� �S A4 �"�I%$I�����(%���(����T�&�� �!�L� 40 ���� (�(�#M���(��$�a �� KGL�������G�&r�� ThaiPDF/exportPDF.php)

�Q�G������j��L�������V�ก X L���Q�G������T�� Excel _�����������($�� User

������

1. �����$��($����VK�����K�����L�_���ก�$ Excel ���L�~(���(#L$��G� rzL�� �����H

K' (����K��� �"���G� K' ( �$�กM� (��$�� 04123 123456 ���MfI �������(� [email protected] 04124 123456 ����ก�� ������%� [email protected] 04125 123456 ����($ ��T���� [email protected]

2. _���ก�$�!�����($������K��� �$�a�!�����($����L�&r�� excel &����� $ก J �I' ((!�L�#L$� �Lก�"�ก��(�#�ก�"�'(�a�PNกS�� $�����K����!�L�$ก KG(��"���G�� ก!"���"��"$'(�ก��กT&�� ���L�(ก�"��$K%ก���� ���"���G��(�&�� �$' (�����$��($�����T����L�"�����Nก&r��K' (( &�กT&�� �KG� user.xls 3. ���ก���$�!���� "���G�_���ก�$ $. ���I �ก��H��"�����ก�MG$����K��� _���"�������� ก�MG$����K��� �KG� ก�MG$ m1 �!"�����ก�����K�H� $. 1

Page 63: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

62

4. #�%ก�$�� �I% $����K���� $ก J �ก���fI�$�����ก�� "�'(�$�����L�(�_���ก�$กT&�� 5. ��'(กก�MG$����K��� �� ��(�ก��!�����($������K����ก&r�� Excel #�%ก�� �MO$

6. ��'(ก&r���� ��(�ก��!���_��#�%ก�� �MO$ 7. ���L��'(ก&r�� user.xls �ก��H�#�%ก�� �MO$ �(��ก#��G _���ก�$� �!�����VK�����K����ก&r�� user.xls �"����L� ������ก��!������fI

Page 64: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

63

8. #�%ก�$�� ���ก���($������K� ���L��'(กก�MG$����K����� �!����ก&r�� Excel �(��ก#��G_���ก�$� ������ก���VK��T�K����� a�ก�!�����H�"$�

8.1 ��' (��$��&�#�%ก�� �MO$ �I' (��L��(�LG _���ก�$�!�����($��a�ก��(�"�'(&$G ���fI (I�LG_���ก�$�!�����($��&��a�ก��(� admin �$�a�ก�&���($���G� J &��)

Page 65: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

64

Setup Squid Proxy Server

�!&$��(��%���H�_���ก�$��"$Nก (squid) #!�(�#'( �I' (�"���ก�G��$�a����ก�K���(%���(����T�&����TL�NH� �����#�' (�$'(KGL��������� ���"��$�a#L�#M$ก� Blockweb �� &$G�"$ �$#L�#M$���&r���� � (�MV��"��L_"��&�� _���$�a#L�#M$����KGL�L�� �L�&���$#L$��(�ก��(��������� ���(�(�#�ก���H� J a�I��($���LกT$�%���H� squid30 �$�!����G(&���H

ns# cd /usr/ports/www/squid30 ns# make config � ��� �"���'(กrU�ก�K���I% $ �"���'(ก [ x ] SQUID_DELAY_POOLS �I' (�"��K�#!�� �

�ก� �Lก��ก��!ก�����L%� �� Blockweb ���ก!"��L�� �L� � &��ก�GL��"�L��(�G(&� ��'(ก���T��"�ก���T�&��� OK ���Lก��MO$ Enter

ns# make install clean �(��กLG� ��� �!ก��%���H� squid30 &���!��T� .........

�!"�������� ก!���PNกS FreeBSD ��������&�������$&r�� squid.conf �"����L �I' (#L$� �Lก��ก��K��� _��&$G��(��ก�&�&r�� squid.conf �(� �"�#���(ก&r�� squid.conf �����H ns# cd /usr/local/etc/squid ns# cp /home/admin/www/ConfigWWW/squid.conf ./

�!"�������� �#��K� FreeBSD $���L (Admin) "����ก�%���H� squid30 �ก ports ���T����L ��(�ก��� � �ก�&�&r�� squid.conf �(� �"��!�$�����H

ns# nano /usr/local/etc/squid/squid.conf ���L�ก�&��������G(&���H�� �(�#�' (�"$� # ((ก

http_port 8080 transparent // I%$I��I% $���&� icp_port 3130 // I%$I��I% $���&�

Page 66: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

65

cache_dir ufs /usr/cache 3500 16 256 �� # "��������((ก �� �ก�&�"�(�

�กT�&r�� cache �"$G access_log /var/log/access.log squid �� # "��������((ก �� �ก�&�"�(�

�กT� Log Files �(� squid �"$G ก!"���กT�&L��� "�(� /var/log/ cache_log /varlog/cache.log �� # "��������((ก cache_store_log /var/log/store.log �� # "��������((ก

#��" acl localhost src �$' (I����L�"��ก�&�����������G��"$G acl localnet src 192.168.212.0/24 #��"������ acl CONNECT method CONNECT �"��I% $#!�� �����G�

# ก�MG$����������G� �"� squid30 �"��$�a Blockweb �� &$G�"$ �$&�� a�$��#�' (���ก�G�����L����(�"�$� ����"���LT� http://192.168.212.1/STOP/ ����LT���(�"�$�� � ��z�

acl time_block time M T W H F 08:00-16:30 acl time_block time A S 06:00-13:00 acl time_block time A S 20:00-24:00 acl bsex url_regex "/var/www/html/bsex.txt" http_access deny bsex time_block deny_info http://192.168.212.1/STOP/ bsex time_block

# ก�MG$����������G� �"� squid30 #L�#M$���&r���� (�MV��"��L_"��&�� a��ก%� 50M � ����"�� Error ���

acl time_acl time M T W H F 8:00-16:00 acl time_acl2 time S A 8:00-17:00 reply_body_max_size 50 MB time_acl reply_body_max_size 50 MB time_acl2

Page 67: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

66

# Block �LT�&t�� �� &r���$�กM��� "�$�L_"�� _����T��� acl limitspeed_web url_regex -i youtube.com 4shared.com .rar .wmv .mov / # �!ก�����L%� ก��L_"��&r���ก�LT��� ก!"�� delay_pools 2 delay_class 1 2 delay_parameters 1 15000/15000 8000/8000 delay_access 1 allow limitspeed_web time_block delay_class 2 2 delay_parameters 2 512000/512000 64000/64000 delay_parameters 2 512000/512000 300000/300000 delay_access 2 allow my_network time_block �!ก��ก��L_"�� �"�����&��$�L��� ก!"���� time_block ��"�� 65

#��"��(#L$ our_networks ���LI%$I�#!�� ��I' ((�MV�&(I�L��� �"��$�a�K��� Proxy &��

#http_access allow our_networks http_access allow localwifi I%$I��I% $ # And finally deny all other access to this proxy http_access deny all #���%$

���T����LกT�!ก�����Nก�� ((ก�กก��ก�&�&r�� squid.conf �� ��"� squid ���� Cache �(&L��!"����กT��LT�&t���� �#�����ก�K������L # /usr/local/sbin/squid -zD // �� ��"� squid ���� cache "�'(� �K�#!�� � squid -z กT&�� # /usr/local/sbin/squid & // �� ��"� squid �!��

�ก��H��I% $#!�� ��� &r�� rc.local ����G(&���H ns# nano /etc/rc.local ���L�I% $#!�� ������H

ipfw add pass tcp from any to any 3990 via setup // #���%$ ipfw add 1700 fwd 192.168.212.1 tcp from any to 192.168.212.0/24 80 // I%$I��I% $ ipfw add 1800 fwd 192.168.212.1,8080 tcp from 192.168.212.0/24 to any 80 // I%$I��I% $ ipfw add 1900 deny ip from any to any 8080 // I%$I��I% $

Page 68: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

67

����Nก&r�� /etc/rc.local ���L((ก�กก��ก�&� �ก��H��I% $#!�� �&L��� &r�� rc.conf �����H ns# echo �squid_enable=�YES�h >> /etc/rc.conf

�<����������� Cache squid �� ���� � Uก��GR��� Cache � W� �$' (��z��K��� Proxy &��� J กT� �!�"�"�(� cache ��T$ �!�"��#�' (���ก�G�&$G�$�a�K���(%���(����T�&�� �ก�&�_������&r�� clearcache.sh ���L��H��L��"�_���ก�$�#����� Cache �"�(��_�$��% �����H ns# nano /etc/squid.sh I%$I�#!�� ��G(&���H

#!/bin/sh echo "###############################################" echo "Script Clear Cache squid30 Auto" echo "###############################################" /usr/local/etc/rc.d/squid stop /bin/sleep 10 rm -rf /var/cache/* /bin/sleep 10 /usr/local/sbin/squid -z /bin/sleep 10 /usr/local/etc/rc.d/squid start echo "#############################################" echo "Clear Cache Squid Proxy Finish"

��L��(�#!�� ��"�a�ก��(� �ก��H�����Nก&r���� ((ก�กก��ก�&�

ns# chmod 775 /etc/squid.sh ns# nano /etc/crontab

��' (���กP���&���������� I%$I�#!�� ���H�I% $���&�

Page 69: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

68

ก�ก!"���L�ก��! log rotate �ก�&�&r�� /etc/crontab

0 0 * * * root /usr/local/sbin/squid -k rotate -f /usr/local/etc/squid/squid.conf 0 0 * * 0 root /root/squid.sh

#!�� ���ก� �!ก� rotate logfile �(� squid �MกL�� #!�� ��� �(�� �!ก��#����� cache �(� squid �Mก����"� (�(�#M� #M�I�"$$P)

#!�� ���L��� Log Files �� squid ����Nก��($��ก��K��� ports 80 "�'(ก��K��� www �"��K�#!�� �����G�

ns# tail -f /var/log/access.log

a�$�ก��ก�&�&r�� squid.conf �"��K�#!�� � squid -k reconfigure �I' ( restart squid �"$G

�����L�����V��U��� �� �j��L�������� �����W (Authentications)

�G(��������ก��ก���������� 2 �I' (�K����T��"�ก���#�' (���ก�G� ���ก�� Swicth Hub � I�LG�#�' (���ก�G�&�������ก&(I�L� 192.168.212.x _��� ��% $��ก&(I���H���G��(�� 192.168.212.20 &���' (� J ��aN���(�� 192.168.212.254 ����ก���ก&(I��$ class C

���(��"��#�' (���ก�G�����ก�LT�&t�� www.google.co.th � ��� ����"���LT��I��"� Login �����G� �� �"����(������G� ����L� K' (����K� a1 �"���G� 12345 �(��ก#��G_���ก�$ Coovachilli � ��L��(�LG�#� Login "�'(��� �GL�_���ก�$ Freeradius2 � ��L��(�LG��VK�����K��� a1 $�(��G��� ��"�'(&$G a���L��(�LG$� กT� (�MV��"������G� ��&�� ���fI

Page 70: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

69

�� �<��R�Uก�� syslog-ng Y���กW� log files

�$' (�%���H� FreeBSD ���T����L _���ก�$ syslog � a�ก�%���H�$�"�I��($�K������L#��� ��G��� &$G�K� syslog ���� ��H� �K� syslog-ng ��� �!"���ก��%���H��!�$��H��(��G(&���H

ns# cd /usr/ports/sysutils/syslog-ng ns# make & make install

�$' (�%���H��������(����L �"��ก�&�&r�� /etc/rc.conf �I' (�"�����ก�K� syslog-ng ��� syslog ��L��%$ _��I%$I�#!�� ��I% $�����H ns# echo �syslogd_enable="NO"h >> /etc/rc.conf

ns# echo �syslog_ng_enable="YES"h >> /etc/rc.conf �� � kill process syslogd ��%$ _���K�#!�� � ns# kill �cat /var/run/syslog.pidh ��������&�������$&r�� syslog-ng.conf �"����L#��� �$�a�!&��K���&����� _��I%$I�#!�� �

Page 71: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

70

ns# cd /usr/local/etc/syslog-ng/

ns# cp /home/admin/www/ConfigWWW/syslog-ng/syslog-ng.conf ./ ns# cp /home/admin/www/ConfigWWW/syslog-ng/syslog2mysql.sh ./ �� ��"� syslog-ng �!�� ��L�#!�� �

ns# /usr/local/etc/rc.d/syslog-ng start

��&����������($��K' (LG syslog ���L ��H��G(&�����ก��!������ log �����H

ns # mysql -u root -ph��������� root mysqlh Mysql> use syslog;

Mysql> ���LI%$I�#!�� ���������G(&���H CREATE TABLE `log` ( `host` varchar(32) collate tis620_bin default NULL, `facility` varchar(10) collate tis620_bin default NULL, `priority` varchar(10) collate tis620_bin default NULL, `level` varchar(10) collate tis620_bin default NULL, `tag` varchar(10) collate tis620_bin default NULL, `datetime` datetime default NULL, `program` varchar(15) collate tis620_bin default NULL, `msg` text collate tis620_bin, `seq` bigint(20) unsigned NOT NULL auto_increment, PRIMARY KEY (`seq`), KEY `host` (`host`), KEY `program` (`program`), KEY `datetime` (`datetime`), KEY `priority` (`priority`), KEY `facility` (`facility`) ) ENGINE=InnoDB DEFAULT CHARSET=tis620 COLLATE=tis620_bin;

Page 72: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

71

I%$I� exit ก��MO$ Enter �I' (((ก�กก��K��� Mysql

I� �K��VV��%LG��L�ก�ก� �!#L$�%���#($I%L��(�� I.P. 2550 &���"��Mก(�#�ก� �Mก"�GL��� ��H�f#����� �(กK� &������กT� log files ก��K����G� J �(�����K���(%���(����T�(�G���(� 90 L�� �� ����!� ��������L������K���(%���(����T� a��K�&r�� syslog-ng.conf �ก��G� Config8.0 &$G��(��!��H��(��$�� #M��%$ก�GL� #��� �I� ��������&���ก�&�&r�� syslog-ng.conf �"�I��($�K������L#��� #M�X�ก� (yim) &���������#L$��H����I�G�� �LT����� ThaiBSD LG"����ก�%���H� syslog-ng ���L �"��ก�&�&r�� config �G� J �(� syslog-ng ����G(&���H

ns# nano /usr/local/etc/syslog-ng/syslog-ng.conf ���L�I% $#!�� ��G(&���H

destination ipfw { file"/var/log/ipfw/ipfw.log"); }; filter f_ipfw { program("ipfw"); }; log { source(src); filter("f_ipfw"); destination(d_mysql); }; destination d_mysql { pipe("/var/log/mysql.pipe" template("INSERT INTO log (host, facility, priority, level, tag, datetime, program, msg,seq) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG','$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC','$PROGRAM', '$MSG',null );\n\n") template-escape(yes)); };

�ก��H��"�I%$I�#!�� ������H ns# cd /usr/local/etc/syslog-ng ns# cp /home/admin/www/ConfigWWW/etc/syslog.conf ./

�!"��� Admin �� ��(�ก��ก�&�#!�� ��(��"��!�$�����H

Page 73: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

72

ns# nano /etc/syslog.conf I%$I�#!�� ��G(&���H �I% $���&����&r��

!ipfw *.* /var/log/ipfw/ipfw.log

����&r�� syslog2mysql.sh �I' (�� ��"� ipfw �G� log files &��กT�&L��� ����($�� syslog

ns# nano /usr/local/etc/syslog-ng/syslog2mysql.sh ���LI%$I�#!�� ��G(&���H

#!/bin/sh export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin if [ ! -e /var/log/mysql.pipe ] then mkfifo /var/log/mysql.pipe fi while [ -e /var/log/mysql.pipe ] do /usr/local/bin/mysql -uroot -p���� rootmysql syslog < /var/log/mysql.pipe > /var/log/sql.log done

a�&$G��(�ก�I%$I�#!�� ��(��"� #���(ก&r�� syslog2mysql.sh &���ก"�(� /home/admin/www/ConfigWWW/syslog2mysql.sh

�I% $#!�� ��G(&���H���&���&r�� /etc/rc.local ns# nano /etc/rc.local �I% $#!�� ��� ���� ��L"� �I% $��%$ �����H ipfw add 65200 allow log all from any to any // I%$I��I% $

/bin/sh /usr/local/etc/syslog-ng/syslog2mysql.sh & // I%$I��I% $ /bin/sh /root/clear.sh & // I%$I��I% $ ipfw add pass tcp from any to any 3990 via setup // #���%$

Page 74: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

73

ipfw add 1700 fwd 192.168.212.1 tcp from any to 192.168.212.0/24 80 // #���%$ ipfw add 1800 fwd 192.168.212.1,8080 tcp from 192.168.212.0/24 to any 80 // #���%$

ipfw add 1900 deny ip from any to any 8080 // #���%$ ����Nก�� ((ก�กก��ก�&�&r�� /etc/rc.local

Uก��G�� config ��MH�L���R�Uก�� Syslog ���r �� ��ก����G��������

ns# nano /var/www/html/syslog/Connections/ dbconnect.php ���L�ก�&������� $password_syslog= "I%$I��"�� rootmysql"; ���L����Nก&r���� ((ก�กก��ก�&� ns# nano /var/www/html/log/Connections/ dbconnect.php ���L�ก�&������� $password_syslog= "I%$I��"�� rootmysql"; ���L����Nก&r���� ((ก�กก��ก�&�

Uก�R������MH����กG�� Login U��� �� Pop-up Windows

�!"����#�' (���ก�G� (Clients) �� �K� WindowsXP �ก�%"����ก�%���H� WindowsXP ���L � Block Pop-up Windows �G����"�ก��K���� ��������L������K���(%���(����T� (Authen & WIFI Hotspot) �%��UV" Pop-up ���ก�GL $PNกS��H��(��ก��%ก�����H

1. "����ก����K��� (Users) &���!ก� Login �����G� �����L � �%� popup windows

User Login �����G� ��

"����ก� ����L��(����L�� (�MV��"� User ��H� �K���(%���(����T�&�� � ��� ����"���G��a� ���� Pop-up windows ����NH�$ _���ก�% WindowsXP � Block Pop-up &L� ���fI

Page 75: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

74

2. #�%ก�����H

3. #�%ก#!�� � Always Pop-ups from This site. 4._���ก�$ Internet Explorer � a$LG��(�ก�(�MV��"� Pop-up ����"�'(&$G �"�#�%ก�MO$ Yes

5. ��ก#��G _���ก�$ Internet Explorer กT� (�MV��"�����"���G� Pop-up �����L�ก��K�(%���(����T� ���fI

��H��G(&� ����ก��ก��%ก&$G�"� Internet Explorer �!ก� Block Pop-up

Page 76: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

75

6. #�%ก�$�� Toos ���L��'(ก#!�� � Internet Options   ���fI

7. #�%ก��T�#!�� � Privacy ���L#�%ก�#�' (�"$�a�ก "��#!�� � Block pop-ups ((ก

8. #�%ก�MO$ �(��กLG_���ก�$� ��H�#G�"$G���T�

9. #�%ก�MO$

�I�����G��H_���ก�$ Internet Explorer กT� &$G Block pup-up ���L#���

Page 77: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

76

Uก�R��� User ���L��V������ kick user

_���ก�$ Kick User (�MV��"� admin �� ����K����$�a Clear Login �(����(�((ก�ก� ��&�� ��G�!������(��%���H� sudo �I% $ ก��%���H��!�$�!��� �����H

1. Setup sudo ns# cd /usr/ports/security/sudo ns# make install clean ��'(ก��ก� 1 �� 2 ก���T�&��� OK ก��MO$ Enter �(��กLG� ��� �%���H� sudo ���T�

2. R���U ���T�� sudoers �K�#!�� ������H

# echo ' www ALL=NOPASSWD: /bin/echo, /usr/local/bin/radclient' >> /usr/local/etc/sudoers # echo ' www ALL=NOPASSWD: /usr/local/etc/rc.d/squid' >> /usr/local/etc/sudoers # echo �www ALL=NOPASSWD: /usr/local/sbin/squid' >> /usr/local/etc/sudoers # echo �www ALL=NOPASSWD: /sbin/init' >> /usr/local/etc/sudoers # echo �www ALL=NOPASSWD: /sbin/reboot' >> /usr/local/etc/sudoers

3. กQ���������T�� sudoers U�V radiusd L��� # chmod 440 /usr/local/etc/sudoers # chmod 711 /usr/local/etc/raddb # chmod 755 /usr/local/etc/raddb/dictionary

4. ����LT� http://192.168.212.1/admin ���L#�%ก�$�� ��K' (����� ก!����K���(��G �"�#�%ก��� ��� user �� #����� ��

Page 78: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

77

�I�����G��H admin กT�$�a�#���������K����� #����� ��_���K��G�_���ก�$ $.���I 2 &��

a���(�ก��"�����K��� clear Login ���(�&�� �!�$�����H 1. ����LT� http://192.168.212.1

2. #�%ก 3. ก�(ก��($�������G� ���"�a�ก��(� ���L#�%ก�MO$

3. � ��� ����LG&���#�������($������K������L �$�a Login �I' (�����G� ���"$G&��

Page 79: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

78

�� �<��R�Uก���� Logs files Yก Squid ���� Lightsquid

ns# cd /usr/ports/www/lightsquid ns# make install clean ns# cd /usr/local/www/lightsquid

��H�#G�"� .cgi �� perl �!�� ns# chmod +x *.cgi ns# chmod +x *.pl

ns# nano /usr/local/etc/lightsquid/lightsquid.cfg �ก�&���ก� �����H

#path to `tpl` folder $tplpath ="/usr/local/www/lightsquid/tpl"; #path to `lang` folder $langpath ="/usr/local/www/lightsquid/lang"; #path to `report` folder $reportpath ="/usr/local/www/lightsquid/report"; #path to access.log $logpath ="/var/log/"; ## �� (��G log Files

��Y���r�ก ���U���L�������ก�T�� ก�R�t� Ctrl + o �����R�t� Enter U�V ��กYกก�Uก��Gก�R�t� Ctrl + x ns# cd /usr/local/share/lightsquid/ ns# cp -rf lang /usr/local/www/lightsquid/

Page 80: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

79

ns# /usr/local/www/lightsquid/check-setup.pl

�� ��"�_���ก�$�!�� ns# /usr/local/www/lightsquid/lightparser.pl

�ก�&�&r�� httpd.conf �"������กก�� lightsquid

ns# nano /usr/local/etc/apache22/httpd.conf �I% $#!�� �����G� ���ก�MG$ Alias

Alias /lightsquid/ "/usr/local/www/lightsquid/"

<Directory "/usr/local/www/lightsquid/"> Options Indexes MultiViews AddHandler cgi-script .cgi AllowOverride All Order allow,deny Allow from all </Directory>

�� ��"� apache22 �!���"$G

# /usr/local/etc/rc.d/apache22 restart

����ก�K���_���ก�$ lightsquid �"��K��#�' (���ก�G�����LT� http://192.168.212.1/lightsquid/

Page 81: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

80

�I% $#!�� ����� Crontab ns# nano /etc/crontab ���L#���(ก#!�� �����G�&�L�&L��������G��M� 59 23 * * * root /usr/local/www/lightsquid/lightparser.pl

��L��(�a�ก��(����L�"�����Nก&r�� ก��MO$ Ctrl + o �$��L��MO$ Enter �� ((ก�กก��ก�&�ก��MO$ Ctrl + x

Page 82: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

81

�<���L�� Apache22 ���Y�ก��W� User U�V�������ก��W����L���� �� ~

��(�ก�� ��(#L$"�'(#!�� ���L"� "$�aN� �"�I%$I�#!�� ��I% $���&� 1. ns# nano /usr/local/etc/apache22/httpd.conf #��"������ DocumentRoot ���L�ก�&��"$G���� #DocumentRoot "/usr/local/www/apache22/data"

DocumentRoot "/home" ������a����$�"��ก�&��� �I% $#!�� � �����H

#<Directory /> # AllowOverride None # Order deny,allow # Deny from all #</Directory> <Directory "/home"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>

#��"������ httpd-userdir.conf ���L�"��� # "��������((ก � &������ Include etc/apache22/extra/httpd-userdir.conf ����Nก&r��

2. ns# nano /usr/local/etc/apache22/extra/httpd-userdir.conf ���L�ก�&��� I%$I�#!�� ��I% $���&��"$G�����H

Page 83: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

82

<Directory "/home"> Options Indexes MultiViews AllowOverride None Order allow,deny Allow from all </Directory>

"����ก�ก�&�a�ก��(����L�"�����Nก&r�� �� ((ก�กก��ก�&� 3. ns# nano /usr/local/etc/apache22/Includes/user_dir.conf �"�I%$I�#!�� ��I% $���&��"$G �����H

<IfModule mod_userdir.c> UserDir public_html <Directory /home/*> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS PROPFIND> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS PROPFIND> Order deny,allow Deny from all </LimitExcept> </Directory> </IfModule>

����Nก&r�� �� ((ก�กก��ก�&� 4. ns# /usr/local/sbin/apachectl restart �� ��"� Apache22 �!���"$G 5. ns# shutdown -r now �� � reboot server �"$G

Page 84: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

83

"����ก�� �#�' (� Server I��($�!�����L �"����&����(��� �#�' (���ก�G� (Clients) �"�����ก�LT� http://192.168.212.1/user กT�$�a��z�&�� ���fI

�����L#��� ��H��(�ก��ก�&� Apache22 �"������กก���LT� User �� �ก��%ก��L ~ �L�����ก�LT� User &$G��(�����ก�����%$(�ก���L http://192.168.212.1/~user

ก� �� �<�ก�T mrtg ��MH�U���R����G�G�U�VG��กG��ก�Y�Y�

�!"�����H��(�ก��%���H�ก�r mrtg �"��!�$�!�����H��(��G(&���H 1. �%���H� snmp �G� ports กG(�

ns# cd /usr/ports/net-mgmt/net-snmp/ ns# make ; make install clean ns# rehash

�ก�&� config &r�� �����H ns# nano /usr/local/share/snmp/snmpd.conf

�"�I%$I� 4 ��������H��&�กTI(#���

Page 85: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

84

rouser public noauth rocommunity public localhost syslocation gateway at service room // �ก�&���(#L$�� ��(�ก� syscontact I%$I� E-mail �(� Admin // I%$I�(��$���� ��(�ก�

I%$I�#!�� �a�ก��(����L�"�����Nก�� ((ก�กก��ก�&�&r�� snmpd.conf �� ��"� snmpd �!�� ��L�#!�� � ns# snmpd & ��L��(�LG$� process snmpd �!��"�'(��� ��L�#!�� � ns# ps -ax | grep snmpd

��H�#G�"� snmp �!���Mก#��H��� reboot Server �"��I% $#!�� �����&r�� /etc/rc.conf �����H

ns# echo �snmpd_enable="YES"h >> /etc/rc.conf ns# echo �snmpd_flags="-a -Lsd -p var/run/snmpd.pid"h >> /etc/rc.conf 2. �%���H� MRTG �G� port �!�$�����H

ns# cd /usr/ports/net-mgmt/mrtg/ ns# make ; make install clean ns# rehash ns# cfgmaker public@localhost > /usr/local/etc/mrtg/mrtg.cfg

�ก��H��ก�&� config &r�� mrtg.cfg �����H ns# nano /usr/local/etc/mrtg/mrtg.cfg ���LI%$I�#!�� � �����H

WorkDir: /var/www/html/show/ Options[_]:growright,bits

Page 86: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

85

indexmaker --columns=1 --output=/var/www/html/show/index.html /usr/local/etc/mrtg/mrtg.cfg �� ����&r�� mrtg.cfg 3 #��H��%��G(ก�� (�� $� Error กT&$G��(�����#��� �����H

ns# mrtg /usr/local/etc/mrtg/mrtg.cfg

��H�#G�"�ก�r mrtg ����$�L��� ����(� _����H�#G Crontab �����H ns# echo �*/5 * * * * root /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfgh >> /etc/crontab #L$"$� �� ��"�ก�r mrtg ����ก�r�"$G (update) �Mก J 5 ��� �(�(�#M� http://www.thaibsd.com/webboard/show.php?Category=thaibsd&No=11781

Page 87: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

86

Admin ��ก�� ����Y� �������MH�L��Uก�R������

1. Boot Server ���j��YV�Q�������� (����ก%��%I�S� �ML����K ก�GLaN��"�Mก�����HLG �ก%��NH�&���ก�UV""��(�G� �KG� &���ก�&�&r�� /etc/rc.conf ���LI%$I�#!�� ��%� "����ก��H�กT�� � reboot กT� �!�"�� ��&$G�$�a Boot &��(�G��$����� "ก�ก%��"�Mก��������HกT�$�a�ก�&�&����L�#!�� ������H

# mount -u # mount -a -t ufs # swapon -a # /usr/local/bin/nano /etc/rc.conf

2. ก����TT���� U��� Boot FreeBSD ���j�� YV�Q������

�UV"&rr~��� �����UV"�"VG�!"����������� �� #L����"�#�' (� UPS �!"��� Server�I' (�~(�ก��&rr~��� &rr~�ก a�&rr~����G(� J � ���h%���% FreeBSD กT$%�%�X%���H��&��#�������������(�"�Mก��������H$"��#��H�"��#�L#��� &$G��(��%���H� FreeBSD �"$G��� £a��K���%�ก��UV"�

�UV"���ก�GL �!�"� Boot �����G� ��&$G&�� � ��� ��� �(���LG /dev/ad1s1d: UNEXPEXTED SOFT UPDATE INCONSISTENCY ; RUN fsck MANNUALLY. automatic file system check failed ; help ! ...... Jun 26 18:15:45 init : /bin/sh on /etc/rc terminated abnormally, going to single user mode enter full pathname of shell or RETURN for /bin/sh: // ��������H Admin &$G(�ก��(#���

�!"���ก��ก�&��UV"���ก�GL �"��K�#!�� � fsck -y

"�'(�K�#!�� � fsck_ufs -y

Page 88: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

87

�(��กLG� ���h%���%ก� FreeBSD � �!ก�tG($�t$ ก��#'�� ���"�#��� #��� J ก��ก���(�#'� �L� Hard Disk ��L�ก��! System Restore �� WindowsXP �"��(��กLG Server � Boot ���T� a�&$G$��%�I�� � ��กT� Boot �G� �$�a�K���&���ก�% (��������I�ก�����(�#��� #!�� � fsck �y ����#!�� ��� Admin #L����!&L�� #��� �(&L��K����$#�����&������(�G���#���) PNกS�กก� ��� http://www.thaibsd.com/webboard/show.php?Category=thaibsd&No=19063 #M�I� $ �$�� #M�I�"$$P �"�#!�� �! KGL��"�'(_���K�#!�� �tG($�t$�I' (�"��$�a Boot �����G FreeBSD Server &��(�ก#��H�

3. �R�� Ports ��H�� ���ก�L����L��V��R���� �ก� FreeBSD �LT�$���(���GL��"VG� I�^��LT�&t����L�fS PHP + Mysql �N��!������(��K��� ports �� �ก� �L��(�ก����L_���ก�$ tN �� ���h%���%ก� FreeBSD ����� ���h%���%ก��� $�#L$#��� ��a���fI��� �%���H����T�� ��� �!ก��z� ports &L� �I' (#L$��(�f���G(� �� �����H� a���(�ก��K��� ports �� #M�X�ก� (yim) &���"�#!�(�LG�$�a�!&�� _��ก��K�#!�� ������H ��L(�G� ��(�ก���z��K��� Ports 8443 ns# nano /etc/rc.local ���L�I% $#!�� ������H

ipfw add 250 allow tcp from any to any dst-port 8443 ipfw add 250 allow udp from any to any dst-port 8443

�ก�&����T����L �"�����Nก&r�� rc.local ���L�� � reboot �I' ( restart Server 1 #��H�

������ก� recovery password G�� root L� mysql

��ก� recovery password �$' ( Admin �'$�"���G��(� root �� mysql �$�a���� ���"���G��(� mysqlroot &�������H # killall mysqld # /usr/local/bin/mysqld_safe --skip-grant-tables --skip-networking & mysql -u root a�&$G$� Error �"�I%$I�

use mysql;

Page 89: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

88

� &������ mysql > �ก��H��"�I%$I�#!�� �

mysql >UPDATE user SET Password=PASSWORD("��������� mysqlroot L���")

WHERE User="root"; mysql > exit; # killall mysqld # /usr/local/etc/rc.d/mysql-server start

�I�����G��H Admin ��H�'$กT�$�a���� ���"���G� root �� Mysql5.0 &�����L#��� ��������&����#�%#$�ก (����ก%��%I�S� �ML����K �ก�(��� ThaiBSD.com

���ก��กW����� disfiles ����RS� FAMP.tar.gz �Q������

a��������� �� (Admin) ��(�ก����(��&r����H�_I���(���� (��G��"�(� /usr/ports/distfiles �"�I%$I�#!�� ������H ns# cd /usr/ports/distfiles ns# tar cvf - * | gzip > FAMP.tar.gz �L��! FAMP7.tar.gz &��K� �"�I%$I�#!�� � ns# tar xvfz FAMP.tar.gz �(��กLG� ��� �!ก���ก&r����"�(� distfiles ���T�

�R�� - R�� Server �RS���� R���ก�� Hacker ���

(. ก%��%I�S� �ML����K &���� �!��#�%#��H#��� $��� _�K��(�G�$ก�G(�������� ��#��� �I� � �!�"� FreeBSD Server &��"�M�I�กก��ก��%��G(�ก_�กf��(ก �$KGL��L��� ��ก!"�� �!�$�����H ns# cd /root ns# nano working.cron ���LI%$I�#!�� ������H

Page 90: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

89

0 2 * * * /sbin/ifconfig rl0 down // �L����(� �"� rl0 "�M��!�� 0 5 * * * /sbin/ifconfig rl0 up // �L���"� �"� rl0 ��% $�!��(�ก#��H�

ns# crontab working.cron // �K���H��L��$�� ��ก!"��

ns# crontab -l // ������ก�#!�� � � I� 2 ������ �!�����L#���

0 2 * * * /sbin/ifconfig rl0 down 0 5 * * * /sbin/ifconfig rl0 up

�� �<� FTP Server �����R�Uก�� Proftpd

����ก���%ก� ftp �"� user �$�a(�I_"����($���G��� port 21 _��$�_���ก�$(!�L�#L$� �Lก��ก�(�I_"��$ก$� ���GL��(� Server ��(��!��%�ก���z��"���%ก� ftp server ��L�

1. �%���H��G� ports ns# cd /usr/ports/ftp/proftpd/ ns# make install clean

2. �� ���&��ก� file proftpd �I' (�"���% $�!���Mก#��H��� ��� �� (�ก(�G�$��� ��z�I(��� 21 �"���L���� &$G��(�&��ก� inetd.conf

sed -i �h -e �s,proftpd_enable:-"NO",proftpd_enable:-"YES",gh /usr/local/etc/rc.d/proftpd

ns# nano /usr/local/etc/proftpd.conf # To cause every FTP user to be "jailed" (chrooted) into their home # directory, uncomment this line. ServerName "ns.kroonis.org" // �ก�&��"�����K' ( server �(��� DefaultRoot ~ // �(�#�' (�"$� # �� (��G���"��((ก �I' (�~(�ก��&$G�"�

user ((ก�(ก���I'H��� �(���L�(�

Page 91: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

90

AllowOverwrite on AllowStoreRestart on // �I% $#!�� � AllowStoreRestart on ���&��I' (�"�(�I_"��

��� resume &�� (�G(�ก������ AllowOverwrite on)

�I' (�"� user chmod &�� �ก�&�#!�� � <Limit SITE_CHMOD> DenyAll </Limit>

���� <Limit SITE_CHMOD> AllowAll </Limit>

����Nก&r���� ((ก�กก��ก�&� �ก��H�I%$I�#!�� �����G��I' (�"� proftpd �!���Mก#��H��� Reboot Server

ns# echo �proftpd_enable="YES"h >> /etc/rc.conf

R���U ��L�� FreeBSD Server Boot �����W�G�<�

�(����#L$�%�����L�ก�� Admin �Mก�G� a��G��!�$��' (� J ��aN�"����H FreeBSD Server & Authentications + Log Files �$�a�!��&��(�G��$��������L#��� �!"�����#L$��' (���H ��(�ก��"� FreeBSD Boot &����TL�NH� &$G�"� Delay &L��� �"��ก�&������H

ns# sed -i �h -e �s,# autoboot_delay="10", autoboot_delay="3",gh /boot/defaults/loader.conf

Page 92: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

91

R���ก��������MH��G��RUก��G����j��G�� root �"� Admin �~(�ก��&L���กLG�ก� ��G���L� �ก�&$G��� �� Single Mode a��#����&��กT�$�a���� ���"���G��(� root &�� �!�"�&$G��(�f���G(� �� (ก�����H$��M##�(' �$�� � Hack "���#�' (� Server _����� ����&�&����(�$ก�� � $��#�$�MG�ก���#�' (� Server &���ก��K%������H) �"�I%$I�#!�� ������H sed -i �h -e �s, console none unknown off secure, console none unknown off insecure,gh /etc/ttys

��� Cloning FreeBSD 8.0 ก���r�V

���������L�ก� �� �<� FreeBSD Server 8.0 ���U����V �ก����ก J #��$�%�&���� �!ก��%���H�� ���h%���%ก� FreeBSD8.0 , Config � ����'H(���� , Setup FAMP8.0 �I' (�%���H� Web Server , Compile Kernel , DHCP SERVER , Squid Proxy Server , FTP �� ก��%���H�_���ก�$���%$(' � J � �"T�LG�K��L���ก��%���H�_���ก�$��G� ��L��$ก �I� FreeBSD ��(�&��N��(_���ก�$�� ��� �%���H�$ Compile �(� �!�"�����V�����L�&�ก��ก��%���H�"��K� L_$�

� L����H #��$�%�&��#��I�L%X��� � KGL���f� ���(��������� �� �N��(����กLG ก� Cloning FreeBSD กT���Lก�� �� �(��H�K' (KM��%���H��!��T����LG EasyInstall123 "����ก�!KM��%���H��!��T�������T����L กT�!&��%���H������#�' (� FreeBSD Server ��~"$� �K��L��%���H�� ����H�"$�I��($�K����I��� 20 -25 ��� a�I��($���L��KL�YP���(� $�!KM��%���H� EasyInstallAuthen123 &L��K���(�#�ก�ก���a( �$�!�����H��(��G(&���H

�$' (�G��!�$"����'(��G$��H$��aN���' (� Cloning FreeBSD ���L � �(���H�#�' (� FreeBSD Server �(��G�กTI��($�!�� Authen , Web Server , FTP SERVER , DHCP , Squid , �� _���ก�$���%$(' � J #��$�%��(�!���(ก��!�(#G�G� J �� ���!���T����L��H�"$�&��กT�&L��K���#�L�G(&� _��&$G��(�$�����L�ก��ก��%���H�� ����� �K��L���ก��%���H�� ���I�����Tก��(�กTI��($�K������L#���

Page 93: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

92

���กก� Cloning �V��R���� �ก� FreeBSD

1. ��(��!ก� Cloning FreeBSD �ก�#�' (� FreeBSD Server �� I��($�K����Mก(�G� 2. �%���H�� ���h%���%ก� FreeBSD _���"���'(กก��%���H���� Express �K��L���ก��%���H���(� � ��� �%���H���I &r�� Boot � ����G��H� 3. �!��G� DVD _���ก�$ EasyInstall123 ���&���KG(�(G� CD-ROM �(� Server ���L�� ��"� FreeBSD �%��G(ก�� CD-ROM �ก��H�กT�� � sh install.sh �(�� $� 20 ���

4. �����ก�&�&r�� Config 4 &r�� #'( rc.conf , resolv.conf , defaults , main.conf (ก!���I�^� Shellscript �I' (���UV" Admin ��(��"$G &$G��(��ก�&�#G Config �(�)

��� �� �<��V��U��� �� �j��L�������� �����W �����V��R���� �ก� FreeBSD 8.0 ������� ������� �������� ���������������������������� ���.�.� .2

G�<� ��ก�� ������� �� �<� Install EasyInstallAuthen123

1. �����$��($���ก�#�' (� FreeBSD 8.0 & Authen �� �!��&���$��������L _���"��%���H��ก"����'(ก��%���H�� ���h%���%ก� FreeBSD 8.0 &Authen) _��I%$I�#!�� ���� ������ ���Lก��MO$ ENTER

ns# cd /usr/ ns# tar -cvf - * | gzip > /home/admin/usr.tar.gz ns# cd /var/ ns# tar -cvf - * | gzip > /home/admin/var.tar.gz ns# cd /etc/ ns# tar -cvf - * | gzip > /home/admin/etc.tar.gz ns# cd /boot/ ns# tar -cvf - * | gzip > /home/admin/boot.tar.gz

Page 94: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

93

ns# cd /root/ ns# tar -cvf - * | gzip > /home/admin/root.tar.gz

2. Remote ��� Server ��L�_���ก�$ SSH Secure Shell Client �����G� ���"�&���a� root �ก��H�#�%ก�MO$ �ก&r�� *.tar.gz ��H�"$�$&L��� �#�' (�¦UZ���t��$'(

3. ����� Shell Script �I' (�� ��"� &r���� �����(��&L��� ��H��(��� 1 ��ก&�����#�' (� FreeBSD 6.4 ������� �%���H���� Express _�������#!�� � Shell Script &�������H

#!/bin/sh echo "##############################################################" echo " Script Auto Install Authen and Log Server System By FreeBSDAuthen " echo " www.kroonis.org " echo " E-mail [email protected] Setup Time 20 -30 Minute " echo " #############################################################" mkdir /home/setup/ cp /etc/fstab /home/setup/ cp /cdrom/usr.tar.gz /usr/ cp /cdrom/etc.tar.gz /etc/ cp /cdrom/var.tar.gz /var/ cp /cdrom/root.tar.gz /root/ cp /cdrom/boot.tar.gz /boot/ echo " #######################################################" echo " Install FreeBSD 6.4 Authen1-2-3 Time 20 -30 Minute " echo " #######################################################" cd /usr/ tar xvf usr.tar.gz rm -rf usr.tar.gz cd /etc/

Page 95: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

94

tar xvf etc.tar.gz rm -rf etc.tar.gz cd /var/ tar xvf var.tar.gz rm -rf var.tar.gz cd /root/ tar xvf root.tar.gz rm -rf root.tar.gz cd /boot/ tar xvf boot.tar.gz rm -rf boot.tar.gz cp /home/setup/fstab /etc cfgmaker public@localhost> /usr/local/etc/mrtg/mrtg.cfg echo �WorkDir: /var/www/html/show/h >> /usr/local/etc/mrtg/mrtg.cfg echo �Options[_]:growright,bitsh >> /usr/local/etc/mrtg/mrtg.cfg

indexmaker --columns=1 --output=/var/www/html/show/index.html /usr/local/etc/mrtg/mrtg.cfg mrtg /usr/local/etc/mrtg/mrtg.cfg mrtg /usr/local/etc/mrtg/mrtg.cfg mrtg /usr/local/etc/mrtg/mrtg.cfg /usr/local/www/lightsquid/lightparser.pl chmod -R 777 /tmp echo " Install FreeBSD8.0 & Authen Finish By .:: Manis Slangsingha .:: Thank You "

�!&r����H�"$�&����������G� DVD กT� &����G� Easy Install FreeBSD8.0Authen123

Page 96: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

95

การติดต้ัง การติดต้ัง การติดต้ัง การติดต้ัง Server Server Server Server ดวย ดวย ดวย ดวย FreeBSD & AuthenticationFreeBSD & AuthenticationFreeBSD & AuthenticationFreeBSD & Authentication

1. Setup FreeBSD 8.0 "����'(��G$��H&�������$��G��%���H� FreeBSD 8.0 �"����L_���K��%���H� 2 ��G� #'( FreeBSD 8.0 #1 �� ��G� Config 8.0 a�I��($���LกT��% $�%���H� FreeBSD 8.0 _����'(ก��H���I &r��� ����G��H� (Express) �����H 1.1 ��H�#G CMOS �"� Boot �ก CD-ROM กG(� (�!&��� #��� &$G�(ก�GL� #���) 1.2 �ก��H���G��G��%���H����&���KG(�(G���G� CD / DVD ROM 1.3 � ���h%���%ก� FreeBSD 8.0 � �!ก� Boot �(�(��_�$��% �"��(��กLG$aN���H��(� Country Selection �"���'(ก���� 218 Thailand ���Lก��MO$ Enter

��'(ก USA ISO ���Lก��MO$ Enter

Page 97: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

96

��'(กก��%���H���� Express ก��MO$ Enter

ก��MO$ Enter �I' (�'����ก��%���H�

ก��MO$ Enter �I' (�'����ก��%���H�

_���ก�$� ����I�%K� ���H�"$� �"���' (���~���กP��NH����fI ���Lก��MO$��L D �I' (��I�%K� ���%$((ก�"�"$�

Page 98: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

97

�ก��H��"�����I�%K� ��"$G _��ก���~�I%$I���L C ���Lก��MO$ Enter

ก��MO$ Enter (�ก#��H� �I' (�'����ก�����I�%K� ���H�"$�

�� ��~�I%$I��"�ก���L q � �����G��H��(� Install Boot Manager for drive �"���'(กก��%���H���� Standard ก��MO$ Enter

� ��� ���� Message LG � �����Gก� Create BSD partition �"�ก��MO$ Enter

Page 99: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

98

� ��� a$LG��(�ก�����I�%K� ��� FreeBSD &"$ �"�ก��MO$ Enter 1 #��H� ��% $����I�%K� ��G� J ������ �$�!��������H

�����H� G�� / 512M

Swap 2 ��G�(���$ �KG� ��$ 1 G 2 ��G�(���$ #'( 2048M

/home 10G /tmp 500M /usr 8G

/var L���M<���H��H���M���<����

1. �������� root �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 512M "�'( 1G กT&�� I%$I����T��"�ก��MO$ Enter

1.1 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter

Page 100: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

99

1.2 I%$I� / �ก��H�ก��MO$ Enter 2. �������� Swap Partition �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 2 ��G�(���$ I%$I�������T��"�ก��MO$ Enter

2.1 ก��MO$��กP��ก�� ��'(ก#!�� � Swap A swap partition.

3. �������� home �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 5G

3.1 I%$I����I'H��� ���T� ก��MO$ Enter 3.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter 3.3 I%$I�K' ("�(� /home ���Lก��MO$ Enter

4. �������� var �!"����กT� Log Files �� ����($���G� J �!������(���G�"�(� /var &L��� $� 3 �� 4 �GL��(�I'H��� §���%���H�"$� ���������� �!�"���G�&L� 40G

Page 101: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

100

4.1 �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 40G

4.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter 4.3 I%$I�K' ("�(� /var ���Lก��MO$ Enter

5. �������� tmp �Q�����RS���H��ก�T�� U�V�กW��T��G�V �� X &$G#L���G�&L�$ก �� �!�"���G�&L��� $� 600M 5.1 �"�ก��MO$��L C �� ��~�I%$I� ���Lก!"�����I'H��� ���� 600M

5.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter 5.3 I%$I�K' ("�(� /tmp ���Lก��MO$ Enter

6. �������� usr �Q�����RS������T���V����<���� �"��K�I'H��� �� �"�'(��H�"$� 6.1 �"�ก��MO$��L C �� ��~�I%$I� ���Lก��MO$ Enter 6.2 ��'(ก#!�� � FS A file system ���Lก��MO$ Enter

Page 102: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

101

6.3 I%$I�K' ("�(� /usr ���Lก��MO$ Enter

a���G�a�ก��(�� &��"�(�I�%K� � �G� J 6 "�(� ���fI

�ก��H� �"�ก���L q �I' (((ก�กก���G�I�%K� � (Fdisk)

��'(ก Exit &$G��(���'(ก Package �I% $

��'(ก�%���H��ก CD/DVD �"�ก��MO$ Enter �G�

Page 103: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

102

��'(ก No &$G��(�ก�ก���&���'(ก#G�"$G

_���ก�$� ��% $�%���H������ ....

�%���H����T����L _���ก�$a$LG� ��'(ก#G�I% $"�'(&$G �"��(� No

ก���T�&��� [ x Exit Install ] �I' (���T��%H�ก��%���H�

��'(ก Yes �I' (�"�_���ก�$�ก��%กก�(G���G��%���H� �"�����!��G� FreeBSD ((ก

�(��กLG FreeBSD6.4 � Boot ���T� �"������G� ����L� root

Page 104: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

103

Uก��G�� IP Server + Config LAN

ns# ifconfig -a FreeBSD � ����LG $� LAN 2 �� ���fI

�กfI dc0 #'( �������ก (L��� � LAN) &$G��(�ก!"�����&(I� ��G(��"� Chiilispot �!"���� ��ก�G����&(I��"��#�' (���ก�G� rl0 #'( ������� �(� (L��(ก � WAN)

Uก��G���� Server �T�� /etc/rc.conf , /etc/chilli.conf , /etc/reslov.conf �����H ns# nano /etc/rc.conf �ก�&��������G(&���H ����&(I��#�'(�G��(��G� defaultrouter=" ���&(I� Gateway" ifconfig_rl0="inet ���� Server netmask 255.255.255.0" natd_interface="rl0 #'( ก������L��(ก" (X%�� rl0 #'( K' (ก������L��(ก � WAN netmask �ก��$�#�'(�G��(��G� a��K���T� ipstar �(� TOT ก!"������ 255.255.255.0

Page 105: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

104

natd_interface="rl0" �$' ( rl0 #'(K' (ก�����L��(ก ����Nก&r�� ก�R�t� Ctrl + o ����� Enter ((ก�กก��ก�&� ก�R�t� Ctrl + x

ns# nano +14 /usr/local/etc/chilli/defaults �ก�&��������� 14 �ก HS_LANIF=vr0 ���� HS_LANIF=�MH�ก���U��G LAN

����Nก&r�� ก�R�t� Ctrl + o ����� Enter ((ก�กก��ก�&� ก�R�t� Ctrl + x ns# nano +6 /usr/local/etc/chilli/main.conf �ก�&��������� 14 �ก dhcpif vr0 ���� dhcpif �MH�ก���U��G LAN

����Nก&r�� ก�R�t� Ctrl + o ����� Enter ((ก�กก��ก�&� ก�R�t� Ctrl + x

ns# nano /etc/resolv.conf �ก�&�&(I���� DNS �(� Server �"����ก���#�'(�G�(%���(����T��� �K�(��G �KG� a��K�(%���(����T� ADSL �"��ก�&�#G nameserver �����H nameserver 192.168.1.1 nameserver 8.8.4.4

����Nก&r�� ก�R�t� Ctrl + o ����� Enter ((ก�กก��ก�&� ก�R�t� Ctrl + x ns# reboot

�(��กLG FreeBSD 8.0 Server � Boot ���T� � ��������L������K���(%���(����T�กTI��($�K������L#��� �G� J �K��L��I��� 20 - 30 ��� กT&�� FreeBSD&Authen �(�#��$�%� �K����L#���

�"���G� root #'( =k9b9hvhdki8ofu

�"���G� admin #'( logserver �"���G� rootmysql #'( dkil7dkk=k9b

�"���G� admin _���ก�$ $.�� #'( passwd �!"�����%"����ก���VK�����K���

Page 106: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

105

U�V�Qก�L�����R�Uก�� �.����

� ��������L������K���(%���(����T��� #��$�%� ����%�"� _���K�_���ก�$ $.������_���ก�$��%"����ก���VK�����K���(%���(����T� _��&��I�^��ก��%$�"�$�#L$�$�a�I% $�NH� tN �� &��ก�GL��"�L��(�G(&�

ก��G�����V��L���Vj����U��V�� 1. �K��#�' (���ก�G����(%���(����T� _��I%$I� 10.0.0.1/admin ���Lก��MO$ Enter � ��� ����"���(�����G� �� �"� Admin �����G� ����L�

K' (����K� �"�I%$I� admin �"���G� �"�I%$I� passwd

�(��ก#��GกT� ���"��"��ก�(�_���ก�$ $.�� �� &��I�^��G(�ก��%$ ���fI"���� 16���GL��� I�^��I% $��%$ #'( ������G�ก��������"�ก� ������ �G��G(ก����ก�� �� �!�����VK�����K�(%���(���ก&r�� Excel &�� �!�"�� �Lกก���$���VK�����K����!�L�$ก &r����L(�G� Excel (��G����G� Config8.0 "�(� www/admin/upload/user.xls

Page 107: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

106

���� �R��H������j��

1. #�%ก���fI 2. �ก��H��"��ก�&��"���G������G� ���"$G

� ������LG&������ ���"���G��������(����L

���� ���H�ก����j��L�������� �����W �$����H$�&L��!"�������� �f�ก�MG$����K��� �I' (�"�� �Lก��ก�#L�#M$ก��K�(%���(����T� ��L(�G�ก�#L�#M$������

�MH�ก���� R�V��� ���� L��L�� Internet admin �������� �� &��L��� 20 K$. office ����K��!��ก�� &��L��� 10 K$. wifi �M##��� L&� (wifi) &��L��� 2K$.

Page 108: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

107

1. #�%ก���fI

ก�MG$����K����� �$�����$&L��"����L $� 2 ก�MG$ �����H - ก�MG$ register �!"����"�����K��� L&� ��� ������G�� �� ���L�(�"� admin (�M$��%กG(� �N�� �K���(%���(����T�&�� � ก�GL��"�L��(a��&� - ก�MG$ Admin ����ก�MG$�(��������� �� �$ก!"���"��K�(%���(����T� 20 K$. / L�� G�<� ��ก����H�ก����j��L����

1. #�%ก �ก��H�ก!"����� �(���#G�G� J �$��(�ก� ���fI

2. "����กก�(ก��� �(����G� J ���T����L#�%ก�MO$ �!�"ก��#$�����ก%�����&�����

���&��'��'� �� I��($�K���ก�MG$��H _��&$G��(�#�%ก�MO$��z��K��� �"$'(�_���ก�$ $. �� �������

Page 109: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

108

�"� Admin �I% $ก�MG$ wifi �(�� #��� � �"��%�X%�K�(%���(����T�&��L��� ��G&"�GกTก!"���(����� (���(�"�������� #��!&��� #���) G�<� ��ก����H������j��L���� _���"�_���ก�$ $.�� �MG$#G�"� �"$ �!"������(%���(����T�#�rO , (%���(����T�"(I�ก �� ��(�กk���G(���VV� Wifi Hostpot ��H��(�ก��I% $��VK�����K��� "�'(((ก#��(�(%���(����T� �!�$�!��������H 1. ���&��!���$�����L ��'(ก�$�� ���H�j��L��U��ก����

����� 1.1 ��'(กก�MG$����K���กG(� (�� �Mก���K�ก���!�L�K� L_$�(%���(����T�) 1.2 � �M#!�NH�����(�K' (����K��� �$��(�ก� �KG� �NH������L(�กS� e 1.3 � �M�!�L��� ��(�ก����� �KG� �"�_���ก�$�����"� 8 ����

2. �ก#�%ก�MO$ _���ก�$� �MG$ก�����#��(�����K���(%���(����T�

�"������ �ก��H�#�%ก�MO$ ��VK����ก�GL�N�� �K���(%���(����T�

3. #�%ก�MO$ �G�((ก&r��#��(�(%���(����T� _��_���ก�$� �G�((ก����&r�� pdf (a���(�ก��ก�&���� �(���������(%���(����T� �"��ก�&��� &r��

/var/www/html/admin/ThaiPDF\exportPDF.php

Page 110: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

109

�I' (�"�����K��������G� ��&��� �Lก #��$�%��N��ก�&� Code php �"$G �"�_���ก�$�MG$�"���G��"��I��� 4 ��L(�กS� ����ก������� 1 "��ก� �S A4 �"�I%$I�����(%���(����T�&�� �!�L� 40 ���� (�(�#M���(��$�a �� KGL�������G�&r�� ThaiPDF/exportPDF.php)

���(��K���(%���(����T� _���(���K�����K����ก#��(������� � �������a� LG �$�a�K���(%���(����T�&�� 10 K� L_$� �Q����ก�R�V��ก �L����ก��������� �����W ��Tt a���(�ก��!ก��(�Mก��K��� �KG� ����ก�MG$����K��� 2 K� L_$� �"�����"$�(�Mf��� 5 L�� กT�ก�&�ก�MG$����K����"$G _��� �ML��"$�(�M

���(�������VK�����K����"$G _���"�&�(��Gก�MG$���� 2 K$. "����ก_���ก�$�������T��� �G�((ก&r�� pdf ���L � &��#��(�����(%���(����T� � �ML��"$�(�M&����L�

�!"����a�PNกS"�'((�#�ก�f#����� �(กK� $�����K����!�L�$กa�� �"�_���ก�$�MG$�"�กT#�&$G�"$ �$ �N�&��������M��ก_���ก�$ $.�� ��%$ �� $�#L$�$�a�!�����VK�����K���&��I��($ก����� $ก J &���ก&r�� Excel _���"������$��($��rzL���G� J �����H

�$' (�����$��($����ก�����"�'(�$K%ก��(�#�ก� ���T����L �K��$�� ���H�j��L�������V�กX

Page 111: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

110

"����ก#�%ก�MO$ _���ก�$� �!ก��!������K�����K����ก&r�� Excel �"������ �Q�������� ���H�j��L������ �K��I% $��VK�����K������M##� �"�ก�(ก��� �(����"�#�� �"���G� 4 ��L(�กS�

Page 112: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

111

�!"����$���� �"�'( �"����(��K��(�� #��� ก��K����G��I���#�%ก�$�� �� �ก�&���� �(����$�� ��(�ก� a���(�ก� �ก�&���($������K��� �"�#�%ก�$�� Y��ก�G�����j��L�� �ก��H���'(กก�MG$����K��� �ก�&�#G�G� J �$��(�ก� #�G$'(ก��K���_���ก�$ $.�� �$�����$&r�� pdf &L��"����L#��� (��G�� ��G� Install �ก CD ��K$I� "�(� www/admin/book/

������ก�R���U ���V�� FreeBSD8.0Authen1-2-3 ����ก� Remote

�� �!ก��K�_���ก�$ SSH Secure Shell Client �I' ( remote � � &ก����&�#L�#M$�ก�&��G� J ��������$'(� Admin �� �(��G"���#�' (� FreeBSD Server กG(�(' ��%���H�_���ก�$กG(�� #��� a�$����L�"���$&��!��H��(��G(&���� _���ก�$ SSH Secure Shell Client #��$�%� �����$&L��"����L(��G�� ��G� Install �ก DVD ��K$I�

������H� Remote Server ก���r�V 1. �����%H�#�%ก&(#(� ����ก�K���_���ก�$ SSH Secure Shell Client

2. #�%ก�MO$ ก�(ก��� �(���ก� SSH ���fI

- KG(� Host Name : ก�(ก���&(I� Server �K�&(I�L��(ก "�'(L���กT&�� ��L(�G���H�$�K�&(I�L��� #'( &(I� 192.168.212.1 - KG(� User Name : ก�(กK' (����K��� $��%�X% SSH &�� �$ก!"���"� admin �!ก� Remote Server &����G�I����������L - Port Number : ก�(ก"$���� Port �� (�MV��"� SSH &�� �$ก!"�� Port 2000 �� ����K��� admin ��G��H��� �$�a SSH ��� Server &��

��L��(����La�ก��(� �"�#�%ก�MO$ ��% $�%��G(ก�� Server Authen

Page 113: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

112

�(��ก#��G � ��� �"�ก�(ก�"���G��(� admin �"�ก�(ก#!LG logserver ���Lก��MO$ Enter

a��~(��"���G�a�ก��(� � ��กT� (�MV��"�����K���&�� �"�ก��MO$ Enter (�ก#��H� กT� ��� ��G� ��&�����a� $ ����K��� K' (LG admin

I%$I�#!�� � su �I' (���� ���a� �ก����K�X��$� ��������K���� root

a��~(��"���G� root a�ก��(� กT&���a� # tN �กT#'( root �� ��(� "����ก�%���H� FreeBSD 8.0 + KM��%���H� Authen1-2-3 ���L _���ก�$�Mก(�G�กTI��($�K��Mก��L#��� ��H��G(&�� �� �!ก�������G�_���ก�$�G(&���H �"��"$ ก��(�#�ก��(��G�

R���U ��ก�L�����R�Uก�� Squid30 ns# nano /usr/local/etc/squid/squid.conf ก��MO$ Ctrl + w I%$I� bsex.txt ���Lก��MO$ Enter

�Q�����r�n�ก���M����������H ��� Blockweb �RS������ �Q ������< #��"������ acl time_block time ���Lก!"��L���L� �$��(�ก�#��� ������

��� Y����� ����� ��� �������� n�ก�� ���� ��� �� ��L��� M T W H F A S

�"�� root #'( =k9b9hvhdki8ofu

Page 114: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

113

acl time_block time M T W H F 08:00-16:30 acl time_block time A S 06:00-12:00 acl bsex url_regex "/var/www/html/bsex.txt" http_access deny bsex time_block deny_info http://www.google.co.th bsex time_block acl time_acl time M T W H F 8:00-19:00 acl time_acl2 time A S 8:00-19:00 reply_body_max_size 20 MB time_acl reply_body_max_size 20 MB time_acl2

����� - ������ acl time_block time M T W H F 06:00-19:00 � ��� blockweb ����L���� �L� #'( � block ��H���GL��������aN�PMก�� KGL��L��� block #'( 08.00 � 16.30 �. squid � ��L��(�&r�� /var/www/html/admin/Blockweb/bsex.txt a�$���(#L$"�'(�LT�&$G�"$ �$ squid � Blockweb �"������ ���L� �����LT�&t�� www.google.co.th ��� - ������ acl time_block time A S 06:00-12:00 � ��� blockweb ����L���� �L� #'( � block ��H���GL������aN�(�%��� KGL��L��� block #'( 06.00 � 12.00 �. squid � ��L��(�&r�� /var/www/html/admin/Blockweb/bsex.txt a�$���(#L$"�'(�LT�&$G�"$ �$ squid � Blockweb �"������ www.google.co.th ��� �กก�MG$����������G� ��~�ก���H�#G�"� squid ��L��(����&r���� �L_"�� a��ก%� 20 MB � ��� &$G(�MV��"��L_"�� �$KGL�L���L��� &��ก!"��&L�

acl time_acl time M T W H F 8:00-19:00 acl time_acl2 time A S 8:00-19:00 reply_body_max_size 20 MB time_acl

reply_body_max_size 20 MB time_acl2

Page 115: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

114

a�����K����L_"��&r���� �ก%� 20 MB _���ก�$ squid � ����"�� Error ���fI

��R���� G�G� - G��ก����ก�T Mrtg

�#�' (���ก�G� �"����(%���(����T� I%$I� 192.168.212.1/show ก��MO$ Enter

_���ก�$ mrtg กT� �!�������

Page 116: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

115

��Y����L��กQ���L��������

���(%���(����T� I%$I� 192.168.212.1/log ก��MO$ Enter _���ก�$ log กT� ����LG$��#����ก!����K�(��G �L���% $�K� �L�"�M��K���

��Y����ก� Log Files

���(%���(����T� I%$I� 192.168.212.1/syslog ก��MO$ Enter _���ก�$ syslog กT� ������ก� Log �"���� _���ก�$��H� �!ก��� Log �� �ก%� 120 L��((ก�"�(��_�$��%

Page 117: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

116

���ก�L���� NAT + Squid Proxy ����� ��� ���ก� Authen ��(�#�ก����&$GI��($�� � �K� FreeBSDAuthen ��(�ก��I�����ก��T���L� dhcp �� �K� squid proxy X��$� KM��%���H� Easy FreeBSD6.4Authen1-2-3 กT�����$&L��"����L �"� remote ��� Server (����H��(�ก� remote "���� 22) ���L�!�$��H��(��G(&���H ��G��G� Install Easy FreeBSD6.4Authen1-2-3 ���&��� �#�' (� FreeBSD Server ns# mount /cdrom ns# mv /etc/rc.conf /home/rc.conf_authen ns# cp /cdrom/NAT/rc.conf /etc ns# cp /cdrom/NAT/rc.local /etc ns# cp /cdrom/NAT/squid.conf /usr/local/etc/squid/ ns# nano /etc/rc.conf �ก�&�K' (ก������L����"$G ����K' (ก������L����(��#�' (� FreeBSD Server ifconfig_dc0="inet 192.168.212.1 netmask 255.255.255.0" ����Nก&r��ก��MO$ Ctrl + o �$��L�ก��MO$ Enter ((ก�กก��ก�&� ก��MO$ Ctrl + x ns# reboot

�I' (� J �(��� �Mก����������� Shell Script �� �#���(ก&r���G� J �$#!�� ���������L�� ����&r�� NAT.sh � � �LกกLG#��� �$��% $�"�กG(��

Page 118: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

117

#!/bin/sh echo "###############################################" echo "Script FreeBSD6.4 NAT + Squid Proxy Server By Kroonis " echo "###############################################" mount /cdrom mv /etc/rc.conf /home/rc.conf_authen cp /cdrom/NAT/rc.conf /etc cp /cdrom/NAT/rc.local /etc cp /cdrom/NAT/squid.conf /usr/local/etc/squid/ echo "###############################################" echo " Setup NAT FreeBSD 6.4 Finish By Manis Slangsing" echo "###############################################"

r�����ก�G������R��H��LY�L���V��U��� �� �j��L������ �����W (Authentications) กT�"������ Shell Script �� �#���(ก&r��&����&r����%$ �G� �L���TL a�ก��(� �(��!�(�� #��� (���(�"��������)

#!/bin/sh echo "###############################################" echo "Script FreeBSD6.4 NAT + Squid Proxy Server By Kroonis " echo "###############################################" mount /cdrom mv /etc/rc.conf /home/rc.conf_nat cp /cdrom/Authen/rc.conf /etc cp /cdrom/Authen/rc.local /etc cp /cdrom/Authen/squid.conf /usr/local/etc/squid/ echo "###############################################" echo " Setup Authen FreeBSD 6.4 Finish By Manis Slangsing"

Page 119: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

118

L���� FTP SERVER KM��%���H� Easy FreeBSD 8.0Authen1-2-3 &���%���H�_���ก�$ proftpd &L��"�I��($�K������L#��� ���(� upload / Download ��L�_���ก�$ WS_FTP Pro &������IX����fI

User YV��ก��ก����G�� ����������

Page 120: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

119

��(#L$��H�"$���"����'(#��$�%� �K��I' (ก�PNกS��G��H� "�$�!�I' (ก�#� �I� &�����%��%�X%Q���UVV���L#��� G�������G������ ����� L 1. 3371 �$' (L���� 31 I¨Sf#$ 2553

Page 121: หนังสือ Cloning freebsd

��������ก� Cloning Cloning Cloning Cloning FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0FreeBSD 8.0 ���� ���� �� ���������

������������� �������� ������� ���������������������������� www.kroonis.org [email protected] Mobile : 0-8335-26868 :.������ก�� ��ก������ก������������� ��

.::

120

..... �(�I� #M�$ก#��� .....

��ก��������

1). £ The FreeBSD Project � (online) 2003 Aviable URL: (http://www.FreeBSD.org) , public by The FreeBSD Project 2.) Jim Mock. THE FreeBSD HANDBOOK . 1st ed. : Mediatech 1999 3) ก%��%I�S� �ML����K. (2548) � ���h%���%ก� FreeBSD �� ก��� �Mก���K���. ����M�� : ��%S�� ((r�tT� �I�� �!ก��.

4) http://www.thaibsd.com/webboard/webboard.php?Category=thaibsd 7) "����'(ก��%���H�� ���h%���%ก� FreeBSD 6.4 & Authen 9) #�� Atomy. #�G$'(ก��%���H�� ���h%���%ก� FreeBSD 5.4