8/1/12

CẤU HÌNH TẠO NHIỀU FTP SITE


1.1.1.     CẤU HÌNH TẠO NHIỀU FTP SITE

Mô hình và yêu cầu hệ thống

-   Site 1: ftp.serverlinux.vn
-   Site 2: vftp.serverlinux.vn

Hướng dẫn cấu hình

a)     Tạo IP alias cho vftp site
b)     Cấu hình ftp site 1: ftp.serverlinux.vn
c)     Cấu hình ftp site 2: vftp.serverlinux.vn
d)     Kiểm tra hoạt động
1)     Kiểm tra tiến trình vsftpd
2)     Login bằng tài khoản anonymous và user hv1 hv2

Các bước thực hiện cấu hình

a)   Tạo ip alias cho vftp site
b)  Bằng cách vào thư mục /etc/sysconfig/network-scripts để copy file ifcfg-eth0 thanh ifcfg-eth0:0. Sau đó chỉnh sử tập tin ifcfg-eth0:0 với nội dung như sau:
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0:0
BOOTPROTO=none
ONBOOT=yes
HWADDR=00:0c:29:d7:6b:ae
NETMASK=255.255.255.0
IPADDR=192.168.1.6
GATEWAY=192.168.1.254
TYPE=Ethernet
c)   Khởi động lại network bằng lệnh
[root@localhost network-scripts]# /etc/init.d/network restart
Shutting down interface eth0:             [OK]
Shutting down interface eth1:             [OK]
Shutting down loopback interface:         [OK]
Bringing up loopback interface:           [OK]
Bringing up interface eth0:               [OK]
Bringing up interface eth1: Determining IP information for eth1... done.

root@localhost network-scripts]# ifconfig|more
eth0  Link encap:EthernetHWaddr 00:0C:29:D7:6B:AEinet addr:192.168.1.3Bcast:192.168.1.255Mask:255.255.255.0
            UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
            RX packets:5747 errors:0 dropped:0 overruns:0 frame:0
            TX packets:3886 errors:0 dropped:0 overruns:0 carrier:0     collisions:0 txqueuelen:1000
      RX bytes:5363775 (5.1 MiB)TX bytes:385221 (376.1 KiB)
      Interrupt:67 Base address:0x2000
eth0:0      Link encap:EthernetHWaddr 00:0C:29:D7:6B:AE
            inet addr:192.168.1.6Bcast:192.168.1.255                          Mask:255.255.255.0
            UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
            Interrupt:67 Base address:0x2000
eth1  Link encap:EthernetHWaddr 00:0C:29:D7:6B:B8
            inet addr:172.16.29.121Bcast:172.16.29.255
            Mask:255.255.255.0
            UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1
            RX packets:26455 errors:0 dropped:0 overruns:0 frame:0
            TX packets:6003 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000
            RX bytes:13022728 (12.4 MiB)TX bytes:509634 (497.6 KiB)
            Interrupt:67 Base address:0x2080
lo          Link encap:Local Loopback
            inet addr:127.0.0.1Mask:255.0.0.0
            UP LOOPBACK RUNNINGMTU:16436Metric:1
            RX packets:4801 errors:0 dropped:0 overruns:0 frame:0
            TX packets:4801 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0
            RX bytes:5782608 (5.5 MiB)TX bytes:5782608 (5.5 MiB)
d)  Bước tiếp theo vào thư mục /etc/vsftpd, copy file vsftpd.conf ra môt tập tin mới có tên ftp_ao.conf bằng lệnh
#cd /etc/vsftpd
#cp vsftpd.confftp_ao.conf
e)   Cấu hình site 1 ftp.serverlinux.vn
-   Cấu hình tập tin /etc/vsftpd/vsftpd.conf như bên dưới:
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
anon_root=/ftproot
#
# Uncomment this to allow local users to log in.
local_enable=YES
#thêm vào các dòng sau ở cuối file (nếu dòng nào có rồi thì không cần phải thêm)
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
#local_root=public_html
use_localtime=YES
listen_address=192.168.1.3
-   Cấu hinh dns về tên miền ftp.serverlinux.vn
$TTL  86400
@INSOA dns1.serverlinux.vn. root.serverlinux.vn. (
                  2011022700 ; Serial
                  28800; Refresh
                  14400; Retry
                  3600000; Expire
                  86400 ); Minimum
            IN    NSdns1.serverlinux.vn.
            IN    MX    1     dns1.serverlinux.vn.
dns1  IN    A     192.168.1.3
www   IN    CNAME dns1.serverlinux.vn.
mail  IN    CNAME dns1.serverlinux.vn.
ftp   IN    CNAME dns1.serverlinux.vn.
proxy IN    CNAME dns1.serverlinux.vn.
f)    Cấu hình site vftp.serverlinux.vn
-   Cấu hình tập tin /etc/vsftpd/ftp_ao.conf
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
anon_root=/ftproot
#
# Uncomment this to allow local users to log in.
local_enable=YES
#thêm vào các dòng sau ở cuối file (nếu dòng nào có rồi thì không cần phải thêm)
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
#local_root=public_html
use_localtime=YES
listen_address=192.168.1.6
-   Cấu hình fns về tên miền vftp.serverlinux.vn
$TTL  86400
@INSOAdns1.serverlinux.vn. root.serverlinux.vn.(
                  2011022700 ; Serial
                  28800; Refresh
                  14400; Retry
                  3600000; Expire
                  86400 ); Minimum
            IN    NSdns1.serverlinux.vn.
            IN    MX          1     dns1.serverlinux.vn.
dns1  IN    A     192.168.1.3
www   IN    CNAME dns1.serverlinux.vn.
mail  IN    CNAME dns1.serverlinux.vn.
ftp   IN    CNAME dns1.serverlinux.vn.
proxy IN    CNAME dns1.serverlinux.vn.
vftp  IN    A     192.168.1.6
g)   Kiểm tra sự hoạt động
-   Khởi động named
root@localhost network-scripts]#/etc/init.d/named restart
Stopping named:                     [OK]
Starting named:                     [OK]
-   Khởi động vsftpd
root@localhost network-scripts]# /etc/init.d/vsftpd restart
Shutting down vsftpd:               [OK]
Starting vsftpd for ftp_ao:         [OK]
Starting vsftpd for vsftpd:         [OK]
root@localhost network-scripts]# pgrep vsftpd
7904
7909
root@localhost network-scripts]# host frp.serverlinux.vn
Host frp.serverlinux.vn not found: 3(NXDOMAIN)
root@localhost network-scripts]# host ftp.serverlinux.vn
ftp.serverlinux.vn is an alias for dns1.serverlinux.vn.
dns1.serverlinux.vn has address 192.168.1.3
[root@localhostnetwork-scripts]# host vftp.serverlinux.vn
vftp.serverlinux.vn has address 192.168.1.6

Bài đăng phổ biến