Thursday, November 11, 2010

TFTP and NFS server set up

[1] http://rpm.pbone.net/index.php3/stat/4/idpl/13694850/dir/fedora_9/com/tftp-server-0.48-6.fc9.i386.rpm.html
[2] https://help.ubuntu.com/community/SettingUpNFSHowTo ---- NFS setting under UBUNTU
[3] https://help.ubuntu.com/8.04/serverguide/C/network-file-system.html --- NFS Setting
[4] Fail to put file to TFTP server answer

Ip address range should be listed in format below:

192.168.1.0/28                  192.168.1.0   - 192.168.1.15
192.168.1.16/28                 192.168.1.16  - 192.168.1.31
192.168.1.32/27                 192.168.1.32  - 192.168.1.63
192.168.1.64/26                 192.168.1.64  - 192.168.1.127
192.168.1.128/25                192.168.1.128 - 192.168.1.255


###########################
#TFTP Server Set UP.
###########################

CHECK WHETHER TFTP PACKAGE IS INSTALLED
-------------------------------------------
[q.yang@localhost ~]$ rpm -q tftp-server
tftp-server-0.48-6.fc9.i386

INSTALL TFTP FROM RPM
------------------------------
Download it from [1]
Download Tftp dependancy xinetd-2.3.14-20.fc9.i386 from [1]

[root@localhost q.yang]# rpm -ivh Download/xinetd-2.3.14-20.fc9.i386.rpm
warning: Download/xinetd-2.3.14-20.fc9.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6df2196f
Preparing... ########################################### [100%]
1:xinetd ########################################### [100%]
[root@localhost q.yang]# rpm -ivh Download/tftp-server-0.48-6.fc9.i386.rpm
warning: Download/tftp-server-0.48-6.fc9.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6df2196f
Preparing... ########################################### [100%]
1:tftp-server ########################################### [100%]

[root@localhost q.yang]# rpm -q tftp-server
tftp-server-0.48-6.fc9.i386
[root@localhost q.yang]# chkconfig tftp on






[root@localhost ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@localhost ~]# service iptables restart

Alternatively using GUI to manage firmwall:





[root@localhost ~]# chkconfig tftp on
[root@localhost ltib-qs]# service xinetd restart
#show whether tftp is running.
[root@localhost ltib-qs]# netstat -a | grep udp
[root@localhost ~]# chown q.yang /var/lib/tftpboot
[root@localhost ~]# chgrp users /var/lib/tftpboot
alternatively:
[root@localhost q.yang]# chown q.yang:developer /var/lib/tftpboot/
[root@localhost q.yang]# chmod g+w /var/lib/tftpboot/
drwxrwxr-x 2 q.yang developer 4096 2008-05-22 07:55 tftpboot


VARIFY TFTP SERVER IS WORKING FROM WINDOWS
--------------------------------------------
Using Tftp command under windows console





PERMISSION ERROR WHEN WRITE FILE INTO TFTP SERVER
--------------------------------------
#chmod 777 /var/lib/tftpboot


RESTART TFTP SERVER
---------------------
[root@localhost ltib-qs]# service xinetd restart


FAIL TO PUT FILE TO TFTP SERVER [4]
----------------------------------
check the /etc/xinetd.d/tftp file..

change:
server_args = -s /tftpboot

to:
server_args = -c -s /tftpboot

“-c” allows the creation of new file





##################################
# NFS Server set up under UBUNTU
###################################
[3] [2]
quentin@ubuntu:~/CodeSourcery/arm-2010q1$ sudo apt-get install nfs-kernel-server
............
............
quentin@ubuntu:~/CodeSourcery/arm-2010q1$ sudo vi /etc/exports

quentin@ubuntu:~/CodeSourcery/arm-2010q1$ sudo /etc/init.d/nfs-kernel-server start
* Exporting directories for NFS kernel daemon... [ OK ]
* Starting NFS kernel daemon [ OK ]

$ sudo service nfs-kernel-server start
 * Exporting directories for NFS kernel daemon...                                                                                                                 [ OK ]
 * Starting NFS kernel daemon                                                                                                                                     [ OK ]



#########################
# NFS Server set up
#######################
INSTALL NFS-UTILS RPCBIND RPM PACKAGE IF NOT INSTALLED
--------------------------------------------------------
#rpm -q nfs-utils To check whether nfs-utils installed.

INSTALL NFS-UTILS AND RPCBIND VIA YUM
-------------------------------------
Note:Not latest rpm is detected by yum due to yum package is old.
[root@localhost q.yang]# yum install nfs-utils rpcbind
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i386 0:0.1.4-14.fc9 set to be updated
---> Package nfs-utils.i386 1:1.1.2-2.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
nfs-utils i386 1:1.1.2-2.fc9 fedora 291 k
rpcbind i386 0.1.4-14.fc9 fedora 48 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 339 k
Is this ok [y/N]: y
.....................
.....................

CREATE NFS SHARE
-----------------------
-- Option 1: --
You can edit /etc/exports file as follows:
[root@localhost ~]# vi /etc/exports
[q.yang@localhost ~]$ cat /etc/exports
/home/q.yang/Desktop 10.10.20.70(rw,insecure,sync,no_root_squash)
/home/q.yang/lpc3250/ltib-qs/rootfs 10.10.20.88(rw,no_root_squash,no_subtree_check,sync)
/home/q.yang/lpc3250/rootfs4Luke 10.10.20.90(rw,no_root_squash,no_subtree_check,sync)

-- Option 2: --
Using NFS GUI (need install yp-tools.i386 0:2.9-3 ypbind.i386 3:1.20.4-6.fc9 two packages)

START NFS, RPCBIND SERVICE
------------------------------
[root@localhost eclipse]# service rpcbind start
Starting rpcbind: [ OK ]
[root@localhost eclipse]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]

CHECK WHETHER NFS IS RUNNING
-----------------------------------
You should see portmapper and nfs running as below. If not try
#service nfs restart

[root@localhost ~]# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100000 4 0 111 portmapper
100000 3 0 111 portmapper
100000 2 0 111 portmapper
100011 1 udp 1016 rquotad
100011 2 udp 1016 rquotad
100011 1 tcp 1019 rquotad
100011 2 tcp 1019 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 56276 nlockmgr
100021 3 udp 56276 nlockmgr
100021 4 udp 56276 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 39972 nlockmgr
100021 3 tcp 39972 nlockmgr
100021 4 tcp 39972 nlockmgr
100005 1 udp 54842 mountd
100005 1 tcp 59798 mountd
100005 2 udp 54842 mountd
100005 2 tcp 59798 mountd
100005 3 udp 54842 mountd
100005 3 tcp 59798 mountd


CHECK WHETHER NFS IS RUNNING FROM ANOTHER LINUX PC
--------------------------------------------------
On Linux PC B(10.10.20.70):
[root@localhost q.yang]# mount -t nfs 10.10.20.35:/home/q.yang/Desktop /mnt/nfstest/
[root@localhost q.yang]# ll /mnt/nfstest/
total 12
-rw-r--r-- 1 q.yang 500 5559 2010-06-03 17:23 gnome-terminal.desktop

On Linux PC A (10.10.20.35)
[q.yang@localhost ~]$ cat /etc/exports
/home/q.yang/Desktop 10.10.20.70(rw,insecure,sync,no_root_squash)


NFS TROUBLE SHOOTING
-------------------------------------
Fail to connect NFS due to firewall
-----------------------------------
1. Upgrade system-config-firewall/system-config-firewall-tui rpm package so that
correct /etc/sysconfig/iptables, /etc/sysconfig/iptables-config can be generated.
2. Disable firewall.

UPGRADE FIREWALL RPM PACKAGE MANUALLY
----------------------------------------
The files modified and generated as a result of system-config-firewall (system-config-firewall-1.2.16-3.fc9.noarch.rpm)
[root@localhost eclipse]# ll /etc/sysconfig/ |grep ip
-rw------- 1 root root 1753 2011-02-25 14:32 ip6tables-config
-rw------- 1 root root 1740 2011-02-25 14:32 iptables-config
-rw------- 1 root root 1776 2011-02-24 15:25 ip6tables-config.old
-rw------- 1 root root 1876 2011-02-24 15:10 ip6tables.old
-rw------- 1 root root 1763 2011-02-24 15:25 iptables-config.old
-rw------- 1 root root 1871 2011-02-24 15:10 iptables.old


YUM COULDN'T FIND LATEST FIREWALL RPM PACKAGE
[root@localhost eclipse]# yum install system-config-firewall
Loaded plugins: refresh-packagekit
updates | 2.6 kB 00:00
fedora | 2.4 kB 00:00
Setting up Install Process
Parsing package install arguments
Package system-config-firewall-1.2.7-1.fc9.noarch already installed and latest version
Nothing to do


[root@localhost eclipse]# rpm -U /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
error: Failed dependencies:
system-config-firewall-tui = 1.2.16-3.fc9 is needed by system-config-firewall-1.2.16-3.fc9.noarch
[root@localhost eclipse]# rpm -U /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
error: Failed dependencies:
system-config-firewall-tui = 1.2.7-1.fc9 is needed by (installed) system-config-firewall-1.2.7-1.fc9.noarch
[root@localhost eclipse]# rpm -q system-config-firewall-tui
system-config-firewall-tui-1.2.7-1.fc9.noarch

REMOVE EXISTING FIREWALL RPM PACKAGE
[root@localhost eclipse]# rpm -e system-config-firewall-tui
error: Failed dependencies:
system-config-firewall-tui = 1.2.7-1.fc9 is needed by (installed) system-config-firewall-1.2.7-1.fc9.noarch
[root@localhost eclipse]# rpm -e system-config-firewall
[root@localhost eclipse]# rpm -e system-config-firewall-tui

MANUALLY INSTALL FIREWALL RPM PACKAGE
[root@localhost eclipse]# rpm -ivh /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
error: Failed dependencies:
system-config-firewall-tui = 1.2.16-3.fc9 is needed by system-config-firewall-1.2.16-3.fc9.noarch
[root@localhost eclipse]# rpm -ivh /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
Preparing... ########################################### [100%]
1:system-config-firewall-########################################### [100%]
[root@localhost eclipse]# rpm -ivh /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
Preparing... ########################################### [100%]
1:system-config-firewall ########################################### [100%]


CHECK FIREWALL FROM COMMAND LINE
-------------------------------------
[root@localhost eclipse]# iptables -L |more
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nfs
ACCEPT udp -- anywhere anywhere state NEW udp dpt:nfs
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:netbios-ssn
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:microsoft-ds
...................
..................


IF NFS FAILURE IS DUE TO OLD NFS-UTILS RPCBIND RPM PACKAGE
----------------------------------------------------------

REMOVE AND INSTALL NEW PACKAGE VIA YUM
-----------------------------------------

[root@localhost eclipse]# yum erase rpcbind
Loaded plugins: refresh-packagekit
Setting up Remove Process
updates | 2.6 kB 00:00
fedora | 2.4 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i386 0:0.1.7-1.fc9 set to be erased
--> Processing Dependency: rpcbind for package: nfs-utils
--> Processing Dependency: rpcbind for package: ypbind
--> Running transaction check
---> Package nfs-utils.i386 1:1.1.2-2.fc9 set to be erased
---> Package ypbind.i386 3:1.20.4-6.fc9 set to be erased
--> Processing Dependency: ypbind for package: yp-tools
--> Running transaction check
---> Package yp-tools.i386 0:2.9-3 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Removing:
rpcbind i386 0.1.7-1.fc9 installed 90 k
Removing for dependencies:
nfs-utils i386 1:1.1.2-2.fc9 installed 555 k
yp-tools i386 2.9-3 installed 151 k
ypbind i386 3:1.20.4-6.fc9 installed 64 k

Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 4 Package(s)

Is this ok [y/N]:
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
Erasing : nfs-utils ######################### [1/4]
warning: /var/lib/nfs/state saved as /var/lib/nfs/state.rpmsave
warning: /var/lib/nfs/etab saved as /var/lib/nfs/etab.rpmsave
Erasing : rpcbind ######################### [2/4]
Erasing : yp-tools ######################### [3/4]
Erasing : ypbind ######################### [4/4]

Removed: rpcbind.i386 0:0.1.7-1.fc9
Dependency Removed: nfs-utils.i386 1:1.1.2-2.fc9 yp-tools.i386 0:2.9-3 ypbind.i386 3:1.20.4-6.fc9
Complete!



[root@localhost eclipse]# rpm -q rpcbind
package rpcbind is not installed
[root@localhost eclipse]# yum install nfs-utils rpcbind
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i386 0:0.1.4-14.fc9 set to be updated
---> Package nfs-utils.i386 1:1.1.2-2.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
nfs-utils i386 1:1.1.2-2.fc9 fedora 291 k
rpcbind i386 0.1.4-14.fc9 fedora 48 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 339 k
Is this ok [y/N]: y

No comments: