dhcp   nfs


[root@dhcpser ~]# rpm -q dhcp //

放入RHEL5.9 iso鏡像

[root@dhcpser ~]# cd /misc/cd/Server //

[root@dhcpser Server]# ls *dhcp*

[root@dhcpser Server]# rpm -ivh dhcp-3(tab)

[root@dhcpser Server]# rpm -q dhcp

dhcp-3.0.5-31.el5_8.1

3. 修改配置文件

[root@dhcpser ~]# cat -n /etc/dhcpd.conf 

  1 ddns-update-style none;

  2         default-lease-time 21600;

  3         max-lease-time 43200;

  4         option subnet-mask              255.255.255.0;

  5         option domain-name              "ta.com";

  6         option domain-name-servers      202.106.0.20;

  7 subnet 192.168.10.0 netmask 255.255.255.0 {

  8         option routers                  192.168.10.254;

  9         range dynamic-bootp 192.168.10.10 192.168.10.20;

 10         host win7 {

 11                 hardware ethernet 00:0C:29:E1:F6:25;

 12                 fixed-address 192.168.10.80;

 13         }

 14 }

4. 啓動服務

[root@dhcpser ~]# rpm -ql dhcp | grep init.d

/etc/rc.d/init.d/dhcpd

/etc/rc.d/init.d/dhcrelay

[root@dhcpser ~]# service dhcpd restart

[root@dhcpser ~]# chkconfig dhcpd on

注:如果啓動失敗,可以檢測主配置文件語法

[root@dhcpser ~]# service dhcpd configtest

5. 驗證

Linux:

# dhclient -d eth0 臨時獲取

# dhclient -r eth0 釋放

Windows:

cmd>ipconfig /release 釋放ip

cmd>ipconfig /renew 重新獲取ip






---------------RHEL5.9_A----(vmnet1)----RHEL5.9_B----------- 


RHEL5.9_A: 192.168.10.253/24

RHEL5.9_B: 192.168.10.20/24



實驗一:

將/root 共享給192.168.10.20,可寫、同步,允許客戶機以root權限訪問

NFS服務端操作:

[root@dhcpser ~]# cat /etc/exports 

/root   192.168.10.20(rw,sync,no_root_squash)

[root@dhcpser ~]# service portmap restart

[root@dhcpser ~]# service nfs restart

[root@dhcpser ~]# chkconfig portmap on

[root@dhcpser ~]# chkconfig nfs on

NFS客戶端操作:

[root@localhost ~]# service portmap restart

[root@localhost ~]# showmount -e 192.168.10.253

Export list for 192.168.10.253:

/root    192.168.10.20

[root@localhost ~]# mkdir -p /data/root/

[root@localhost ~]# mount 192.168.10.253:/root/ /data/root/

[root@localhost ~]# df -hT | grep nfs

               nfs     19G  2.7G   16G  15% /data/root

[root@localhost ~]# cd /data/root/

[root@localhost root]# touch file1.txt

[root@localhost root]# ls -l file1.txt 

-rw-r--r-- 1 root root 0 06-12 17:18 file1.txt


實驗二:

將/usr/src 共享給192.168.10.0/24網段,可寫、異步

NFS服務端操作:

[root@dhcpser ~]# cat /etc/exports 

/root   192.168.10.20(rw,sync,no_root_squash)

/usr/src        192.168.10.0/24(rw,async)

[root@dhcpser ~]# exportfs -rv //...

[root@dhcpser ~]# setfacl -m u:nfsnobody:rwx /usr/src/

NFS客戶端操作:

[root@localhost ~]# mkdir /data/src/

[root@localhost ~]# showmount -e 192.168.10.253

Export list for 192.168.10.253:

/root    192.168.10.20

/usr/src 192.168.10.0/24

[root@localhost ~]# mount 192.168.10.253:/usr/src/ /data/src/

[root@localhost ~]# cd /data/src/

[root@localhost src]# touch file1.txt

[root@localhost src]# ls -l file1.txt 

-rw-r--r-- 1 nfsnobody nfsnobody 0 06-12 17:23 file1.txt


實驗三:

在上一個實驗基礎上實現客戶端上面所有用戶身份都映射成nfsnobody

NFS服務端操作:

[root@dhcpser ~]# chmod o+w /usr/src/

NFS客戶端操作:

[root@localhost ~]# useradd tom

[root@localhost ~]# su - tom

[tom@localhost ~]$ cd /data/src/

[tom@localhost src]$ touch tom1.txt

[tom@localhost src]$ ls -l tom1.txt 

-rw-rw-r-- 1 tom tom 0 06-12 17:29 tom1.txt

再來修改NFS主配置文件

[root@dhcpser ~]# cat /etc/exports 

/root   192.168.10.20(rw,sync,no_root_squash)

/usr/src        192.168.10.0/24(rw,async,all_squash)

[root@dhcpser ~]# exportfs -rv

NFS客戶端操作:

[tom@localhost src]$ touch tom2.txt

[tom@localhost src]$ ls -l tom2.txt 

-rw-rw-r-- 1 nfsnobody nfsnobody 0 06-12 17:31 tom2.txt


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章