mount.nfs: Connection timed out on ubuntu 14.04.1 LTS - ubuntu-14.04

I trying to create a nfs server for the first time. On trying to mount to the server I am getting an error "mount.nfs: Connection timed out". My server version is ubuntu 14.04.5 LTS while my client is ubuntu 14.04.1 LTS. Following are the step that I have performed.
On Server Side:
# vi /etc/exports
/home/nfs 192.168.13.81(rw,async,no_root_squash)
# sudo service nfs-kernel-server restart
# sudo exportfs -u
/home/nfs 192.168.13.81
On Client Side:
# sudo mount 192.168.13.80:/home/nfs /home/nfs
mount.nfs: Connection timed out
on trying,
#sudo mount -t nfs4 -o proto=tcp,port=2049 192.168.13.80:/home/nfs /home/nfs
mount.nfs4: mounting 192.168.13.80:/home/nfs failed, reason given by server: No such file or directory
"# rpcinfo -p" gives:
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
100024 1 udp 39340 status
100024 1 tcp 49970 status
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049
100227 3 tcp 2049
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
I am not sure what or how else to try. Please help. Any help would be highly appreciated. Thanks.

Not required restart nfs service. After you add below in /etc/exports
/home/nfs 192.168.13.81(rw,async,no_root_squash)
Just re-export the NFS directories:
exportfs -ra
Then use nfs4 to mount it.
mount -t nfs4 192.168.13.80:/home/nfs /home/nfs
You may also want to check if client has NFS access to server by the following command.
rpcinfo -p 192.168.13.80
You will get result if client has access, with lines as portmapper, nfs, mountd, nlockmgr, nfs_acl and rquotad.

Related

Tunnel Gre problem between two hosts (vps and dedicated server)

Hello guys i need to resolve this problem (all server have installed centos 7): i'm trying to create a gre tunnel through vps (in Italy - OpenVZ) and a dedicated server (in Germany), but they do not communicate internally (ping and ssh command tests). Next i create a gre tunnel trought vps (in Italy - OpenVZ) and vps (in France - KVM OpenStack) and their communicate, i next i had create a tunnel trought vps (in France - KVM OpenStack) and a dedicated server (in Germany) their communicate. I can not understand why the vps (in Italy - OpenVZ) and the dedicated server (in Germany) do not communicate, ideas on how I can fix (
I also tried with iptables disabled, firewalld is not enable)? Thanks
In other words:
In other attempts (by this i mean that i managed to successfully create the GRE Tunnel between these machines):
The VPS (in France) and VPS (in Italy) communicate internally (ping and ssh command tests)
The VPS (in France) and Dedicated Server (in Germany) communicate internally (ping and ssh command tests)
Problem (by this i mean that i could not successfully create the GRE Tunnel between these machines):
The VPS (in Italy) and Dedicated Server (in Germany) do not communicate internally (ping and ssh command tests). I also asked hosting services if they had any restrinzione but nothing.
My configuration:
VPS command for tunnel:
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
iptunnel add gre1 mode gre local VPS_IP remote DEDICATED_SERVER_IP ttl 255
ip addr add 192.168.168.1/30 dev gre1 ip link set gre1 up
Dedicated server command for tunnel:
iptunnel add gre1 mode gre local DEDICATED_SERVER_IP remote VPS_IP ttl 255
ip addr add 192.168.168.2/30 dev gre1
ip link set gre1 up
[root#VPS ~]# ping 192.168.168.2
PING 192.168.168.2 (192.168.168.2) 56(84) bytes of data.
^C
--- 192.168.168.2 ping statistics ---
89 packets transmitted, 0 received, 100% packet loss, time 87999ms
[root#DE ~]# ping 192.168.168.1
PING 192.168.168.1 (192.168.168.1) 56(84) bytes of data.
^C
--- 192.168.168.1 ping statistics ---
92 packets transmitted, 0 received, 100% packet loss, time 91001ms
[root#VPS ~]# tcpdump -i venet0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on venet0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes ^C 0 packets captured 1 packet received by filter 0 packets dropped by kernel
[root#DE ~]# tcpdump -i enp2s0 "proto gre" tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on enp2s0, link-type EN10MB (Ethernet), capture size 262144 bytes ^C 0 packets captured 0 packets received by filter 0 packets dropped by kernel
[root#VPS ~]# lsmod | grep gre
ip_gre 4242 -2
ip_tunnel 4242 -2 sit,ip_gre
gre 4242 -2 ip_gre
[root#DE ~]# lsmod | grep gre
ip_gre 22707 0
ip_tunnel 25163 1 ip_gre
gre 13144 1 ip_gre
Console image with full command output
If ip_forwarding is required for the tunnel to work, you need to do /sbin/sysctl -p
And what does the output of ip tunnel show and ip route show on both the ends

Why is a part of the connection disconnected when tcp connection number is up to 1000?

I write two program using socket. The server listens on a port. And it will open a thread for a connection. Client sends a connection.
When I run server and client locally, I can create 5000 connections. However, when I put the server program on the cloud server, I use watch ss -s to see the connection number of tcp. During the process of establishing 5000 connections, some of the connections will be closed automatically.
Even if I only set up 1300 connections, some tcp connections will also be closed. I have used the ulimit -n 65536 command to open the number of local and remote threads to 65536.
And this result is unstable, it is possible that out of the next 1300 connections, only 500 will succeed, while 800 will fail....
Why would this happen? Is this because of the speed of the Internet? Or is it because of too many threads? But my test on the local is no problem
The following is the result of the watch ss -s command:
TCP: 1310 (estab 953, closed 348, orphaned 0, synrecv 0, timewait 0/0),
ports
0
Transport Total IP IPv6
* 0 - -
RAW 0 0 0
UDP 10 7 3
TCP 962 959 3
INET 972 966 6
FRAG 0 0 0

Network port open, but no process attached?

When I check my server, I found some strange ports:
[root#server ~]# netstat -tulnp |grep "-"
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:33181 0.0.0.0:* LISTEN -
udp 0 0 0.0.0.0:2049 0.0.0.0:* -
udp 0 0 0.0.0.0:33252 0.0.0.0:* -
No program can be found in the output of netstat -tulnp(with root privilegeļ¼‰.
How could I find the usage of these ports? How could I judge it's safe or not?
OS: CentOS 5.6 x86_64
Kernel: 2.6.18-238.el5 #1 SMP Thu Jan 13 15:51:15 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
update:
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100011 1 udp 824 rquotad
100011 2 udp 824 rquotad
100011 1 tcp 827 rquotad
100011 2 tcp 827 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 33252 nlockmgr
100021 3 udp 33252 nlockmgr
100021 4 udp 33252 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 33181 nlockmgr
100021 3 tcp 33181 nlockmgr
100021 4 tcp 33181 nlockmgr
100005 1 udp 839 mountd
100005 1 tcp 842 mountd
100005 2 udp 839 mountd
100005 2 tcp 842 mountd
100005 3 udp 839 mountd
100005 3 tcp 842 mountd
These are likely to be RPC ports reserved by the portmapper. 2049 is a well known port used by NFS. Your other ports are probably other RPC services. To query the portmapper for a full list of services and their ports use rpcinfo -p.

can not ftp localhost but can ftp from remote server

I have installed vsftp to the server , the status is running now , but when use the command ftp localhost , it pops the 421 Service not available. , would advise what is wrong ? thanks
bash-3.2# /etc/rc.d/init.d/vsftpd status
vsftpd (pid 580) is running...
bash-3.2# ps -ef |grep vsftpd
root 580 1 0 15:44 ? 00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 607 467 0 15:45 pts/0 00:00:00 grep vsftpd
bash-3.2# ftp localhost
Connected to localhost (127.0.0.1).
421 Service not available.
the below is the output , would advise what can I do ? thanks
bash-3.2# netstat -tanp |grep ftp
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 3205/vsftpd
bash-3.2# ps -ef |grep ftp
root 3205 1 0 Feb02 ? 00:00:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
root 6075 5626 0 21:35 pts/0 00:00:00 grep ftp
bash-3.2# /sbin/iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
bash-3.2# /sbin/chkconfig --list |grep ip
all iptables are off
There is a parameter called tcp_wrappers=YES in vsftpd.conf. And it checks your hosts.deny file under /etc. You can change tcp_wrappers=NO or you can check your hosts.deny file under /etc
bash-3.2# ftp localhost
Connected to localhost (127.0.0.1).
421 Service not available.
It looks like you can connect, that is the server listens to this address (like you see with netstat too) and there are no iptables rules which block the connection.
Instead the server itself refuses to serve you. Therefore you need to look at the server logs and server configuration for help. Maybe you should look at the tcp_wrappers option and the related configuration in /etc/hosts.allow etc.

RPC: Unable to receive; errno = Connection refused

I am trying to do a simple Sun RPC program which is a phonebook. It sends and receives commands like adding or removing someone to server and server responds back with a message.
When I run the both programs(Server and Client) after the first command it closes unexpectedly and got this error
RPC: Unable to receive; errno = Connection refused
I already checked and rpcbind and portmap is installed.
And here is my rpcinfo output:
program version netid address service owner
100000 4 tcp6 ::.0.111 portmapper superuser
100000 3 tcp6 ::.0.111 portmapper superuser
100000 4 udp6 ::.0.111 portmapper superuser
100000 3 udp6 ::.0.111 portmapper superuser
100000 4 tcp 0.0.0.0.0.111 portmapper superuser
100000 3 tcp 0.0.0.0.0.111 portmapper superuser
100000 2 tcp 0.0.0.0.0.111 portmapper superuser
100000 4 udp 0.0.0.0.0.111 portmapper superuser
100000 3 udp 0.0.0.0.0.111 portmapper superuser
100000 2 udp 0.0.0.0.0.111 portmapper superuser
100000 4 local /run/rpcbind.sock portmapper superuser
100000 3 local /run/rpcbind.sock portmapper superuser
553523285 1 udp 0.0.0.0.3.222 - superuser
553523285 1 tcp 0.0.0.0.3.223 - superuser
The server procedures run normal, I put printf in server side and it shows the server is running but cannot send message back to the client!

Resources