[root@server-rhel6 ~]# hostname
server-rhel6
[root@server-rhel6 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:B5:97:4A
inet addr:172.16.28.130 Bcast:172.16.28.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb5:974a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:19781 errors:0 dropped:0 overruns:0 frame:0
TX packets:10345 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28860434 (27.5 MiB) TX bytes:866320 (846.0 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@server-rhel6 ~]# yum install nfs* -y
[root@server-rhel6 ~]# yum install portmap -y
[root@server-rhel6 ~]# service portreserve status
portreserve is stopped
[root@server-rhel6 ~]# service portreserve start
Starting portreserve: [ OK ]
or
[root@server-rhel6 ~]# /etc/init.d/portreserve start
Starting portreserve: [ OK ]
[root@server-rhel6 ~]# service nfs status
rpc.svcgssd is stopped
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
[root@server-rhel6 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
[root@server-rhel6 ~]# /etc/init.d/nfs start
[root@server-rhel6 ~]# /etc/init.d/nfs status
rpc.svcgssd is stopped
rpc.mountd (pid 3041) is running…
nfsd (pid 3057 3056 3055 3054 3053 3052 3051 3050) is running…
rpc.rquotad (pid 3036) is running…
[root@server-rhel6 ~]# netstat -tlpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN –
tcp 0 0 0.0.0.0:58596 0.0.0.0:* LISTEN 3041/rpc.mountd
tcp 0 0 0.0.0.0:42822 0.0.0.0:* LISTEN 3041/rpc.mountd
tcp 0 0 0.0.0.0:875 0.0.0.0:* LISTEN 3036/rpc.rquotad
tcp 0 0 0.0.0.0:56623 0.0.0.0:* LISTEN 3041/rpc.mountd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2008/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2346/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2066/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2471/master
tcp 0 0 0.0.0.0:55162 0.0.0.0:* LISTEN –
tcp 0 0 :::57536 :::* LISTEN 3041/rpc.mountd
tcp 0 0 :::2049 :::* LISTEN –
tcp 0 0 :::54798 :::* LISTEN –
tcp 0 0 :::111 :::* LISTEN 2008/rpcbind
tcp 0 0 :::58578 :::* LISTEN 3041/rpc.mountd
tcp 0 0 :::22 :::* LISTEN 2346/sshd
tcp 0 0 :::38679 :::* LISTEN 3041/rpc.mountd
tcp 0 0 ::1:631 :::* LISTEN 2066/cupsd
tcp 0 0 ::1:25 :::* LISTEN 2471/master
[root@server-rhel6 ~]#mkdir /nfsshare
[root@server-rhel6 ~]# cat /etc/exports
/nfsshare 172.16.28.131(rw)
[root@server-rhel6 ~]# service nfs restart
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Shutting down RPC idmapd: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
[root@server-rhel6 ~]# exportfs
/nfsshare 172.16.28.131
or
[root@server-rhel6 ~]# showmount -e 172.16.28.130
Export list for 172.16.28.130:
/nfsshare 172.16.28.131
——————————————————————————————————
[root@rhel6-client1 ~]# hostname
rhel6-client1
[root@rhel6-client1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:72:8D:E9
inet addr:172.16.28.131 Bcast:172.16.28.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe72:8de9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5070 errors:0 dropped:0 overruns:0 frame:0
TX packets:3368 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6765625 (6.4 MiB) TX bytes:493397 (481.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@rhel6-client1 ~]# mkdir /mnt/clientmountpoint
[root@rhel6-client1 ~]# mount -t nfs 172.16.28.130:/nfsshare /mnt/clientmountpoint/
If u face any error related to nfs mount like
[root@rhel6-client1 ~]# mount -t nfs 172.16.28.130:/nfsshare /mnt/clientmountpoint/
mount: wrong fs type, bad option, bad superblock on 172.16.28.130:/nfsshare,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog – try
If u face any error related to nfs mount like
[root@rhel6-client1 ~]# mount -t nfs 172.16.28.130:/nfsshare /mnt/clientmountpoint/
mount: wrong fs type, bad option, bad superblock on 172.16.28.130:/nfsshare,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so
[root@rhel6-client1 ~]# yum install nfs-utils
[root@rhel6-client1 ~]#cat >> /etc/fstab
172.16.28.130:/nfsshare /mnt/clientmountpoint/ nfs defaults 0 0
[root@rhel6-client1 ~]# yum install telnet
[root@rhel6-client1 ~]# telnet 172.16.28.130 2049
Trying 172.16.28.130…
telnet: connect to address 172.16.28.130: No route to host
At server side
[root@server-rhel6 ~]# iptables -L
[root@server-rhel6 ~]# iptables -I INPUT -p tcp –dport 2049 -j ACCEPT
[root@server-rhel6 ~]# service iptables save
[root@server-rhel6 ~]# service iptables reload
[root@rhel6-client1 ~]# telnet 172.16.28.130 2049
Trying 172.16.28.130…
Connected to 172.16.28.130.
Escape character is ‘^]’.
Trying 172.16.28.130…
Connected to 172.16.28.130.
Escape character is ‘^]’.
^CConnection closed by foreign host.
[root@rhel6-client1 ~]# mount -t nfs 172.16.28.130:/nfsshare /mnt/clientmountpoint/
mount.nfs: /mnt/clientmountpoint is busy or already mounted
[root@server-rhel6 ~]# cd /nfsshare/
[root@server-rhel6 nfsshare]# touch one two three
[root@server-rhel6 nfsshare]# ls -l
total 0
-rw-r–r–. 1 root root 0 Feb 23 05:37 one
-rw-r–r–. 1 root root 0 Feb 23 05:37 three
-rw-r–r–. 1 root root 0 Feb 23 05:37 two
[root@rhel6-client1 ~]# ls -l /mnt/clientmountpoint/
total 0
-rw-r–r–. 1 root root 0 Feb 23 05:37 one
-rw-r–r–. 1 root root 0 Feb 23 05:37 three
-rw-r–r–. 1 root root 0 Feb 23 05:37 two
total 0
-rw-r–r–. 1 root root 0 Feb 23 05:37 one
-rw-r–r–. 1 root root 0 Feb 23 05:37 three
-rw-r–r–. 1 root root 0 Feb 23 05:37 two
