NFS weigert vaste poorten te gebruiken

Pagina: 1
Acties:

Acties:
  • 0 Henk 'm!

  • TommyboyNL
  • Registratie: Januari 2006
  • Niet online
Update 21-02-2010, 0:22 : Net met een vriend van me zitten graven, en inmiddels werkt alles (pebkac). Dit topic mag dus lekker wegzakken.

-------------------------------------------------------

Ik probeer op mijn fileserver, welke Fedora 12 draait, NFS aan de praat te krijgen, en dan met name in combinatie met iptables.
Als ik iptables uitzet op de server, dan werkt het gewoon, en kan ik vanaf een andere linux machine de boel mounten. Als ik iptables op de server echter aanzet, werkt het uiteraard niet meer, omdat de poorten geblokkeerd worden.
Daarom probeer ik de verschillende daemons zo gek te krijgen om vaste poorten te gebruiken. Hiervoor heb ik /etc/sysconfig/nfs aangepast:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
# Define which protocol versions mountd
# will advertise. The values are "no" or "yes"
# with yes being the default
#MOUNTD_NFS_V1="no"
#MOUNTD_NFS_V2="no"
#MOUNTD_NFS_V3="no"
#
#
# Path to remote quota server. See rquotad(8)
#RQUOTAD="/usr/sbin/rpc.rquotad"
# Port rquotad should listen on.
#RQUOTAD_PORT=875
# Optinal options passed to rquotad
#RPCRQUOTADOPTS=""
#
#
# Optional arguments passed to in-kernel lockd
LOCKDARG=
# TCP port rpc.lockd should listen on.
LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
LOCKD_UDPPORT=32769
#
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
# Turn off v2 and v3 protocol support
#RPCNFSDARGS="-N 2 -N 3"
# Turn off v4 protocol support
#RPCNFSDARGS="-N 4"
# Number of nfs server processes to be started.
# The default is 8.
#RPCNFSDCOUNT=8
# Stop the nfsd module from being pre-loaded
#NFSD_MODULE="noload"
#
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
RPCMOUNTDOPTS=""
# Port rpc.mountd should listen on.
MOUNTD_PORT=892
#
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
STATDARG=""
# Port rpc.statd should listen on.
STATD_PORT=662
# Outgoing port statd should used. The default is port
# is random
STATD_OUTGOING_PORT=2020
# Specify callout program
#STATD_HA_CALLOUT="/usr/local/bin/foo"
#
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
#RPCIDMAPDARGS=""
#
# Set to turn on Secure NFS mounts.
#SECURE_NFS="yes"
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
#RPCGSSDARGS=""
# Optional arguments passed to rpc.svcgssd. See rpc.svcgssd(8)
#RPCSVCGSSDARGS=""
#


Als ik zo naar /etc/init.d/nfslock, lijkt alles ook te kloppen:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/sh
#
# nfslock       This shell script takes care of starting and stopping
#               the NFS file locking service.
#
# chkconfig: 345 14 86
# description: NFS is a popular protocol for file sharing across \
#              networks. This service provides NFS file locking \
#          functionality.
# probe: true

### BEGIN INIT INFO
# Provides: nfslock
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start up the NFS file locking sevice
# Description: NFS is a popular protocol for file sharing across \
#          networks. This service provides NFS file locking \
#          functionality.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
    exit 6
fi

# Check for and source configuration file
LOCKDARG=""
STATDARG=""
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs

[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

RETVAL=0
start() {
        # Check that networking is up.
        [ "${NETWORKING}" = "no" ] && exit 6

        [ -x /sbin/rpc.statd ] || exit 5

        # Make sure the rpc.statd is not already running.
        if status rpc.statd > /dev/null ; then
                exit 0
        fi
        rm -f /var/lock/subsys/nfslock

        # Make sure locks are recovered
        rm -f /var/run/sm-notify.pid

        # Start daemons.
        # See if the kernel lockd should start up
        # listening on a particular port
        #
        if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
                [ -x /sbin/modprobe ] && /sbin/modprobe lockd $LOCKDARG
                [ -n "$LOCKD_TCPPORT" ] && \
                        /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
                [ -n "$LOCKD_UDPPORT" ] && \
                        /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
        fi

        echo -n $"Starting NFS statd: "
        # Set statd's local hostname if defined
        [ -n "${STATD_HOSTNAME}" ] && STATDARG="$STATDARG -n ${STATD_HOSTNAME}"

        # See if a statd's ports has been defined
        [ -n "$STATD_PORT" ] && STATDARG="$STATDARG -p $STATD_PORT"
        [ -n "$STATD_OUTGOING_PORT" ] \
                && STATDARG="$STATDARG -o $STATD_OUTGOING_PORT"

        # See if we have an HA-callout program specified
        [ -n "$STATD_HA_CALLOUT" ] \
                && STATDARG="$STATDARG -H $STATD_HA_CALLOUT"
        daemon rpc.statd "$STATDARG"
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock
    return $RETVAL
}

stop() {
        # Stop daemons.
        if [ -n "`pidofproc lockd`" ]; then
                echo -n $"Stopping NFS locking: "
                killproc lockd -KILL
                echo
        fi

        echo -n $"Stopping NFS statd: "
        killproc rpc.statd
        RETVAL=$?
        echo
        rm -f /var/lock/subsys/nfslock
        rm -f /var/run/sm-notify.pid
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status rpc.statd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        ;;
  probe)
        if [ ! -f /var/lock/subsys/nfslock ] ; then
          echo $"start"; exit 0
        fi
        /sbin/pidof rpc.statd >/dev/null 2>&1
        if [ $? = 1 ] ; then
          echo $"restart"; exit 0
        fi
        ;;
  condrestart)
        [ -f /var/lock/subsys/nfslock ] && {
                stop
                start
                RETVAL=$?
        }
        ;;
  condstop)
        [ -f /var/lock/subsys/nfslock ] && {
                stop
                RETVAL=$?
        }
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|probe|condrestart|condstop}"
        RETVAL=3
        ;;
esac

exit $RETVAL


Als ik echter naar de output van lsof -i kijk, zie ik dat de daemons toch willekeurige poorten pakken:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
COMMAND    PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rpcbind   1128     rpc    6u  IPv4  10135      0t0  UDP *:sunrpc
rpcbind   1128     rpc    7u  IPv4  10139      0t0  UDP *:879
rpcbind   1128     rpc    8u  IPv4  10140      0t0  TCP *:sunrpc (LISTEN)
rpcbind   1128     rpc    9u  IPv6  10142      0t0  UDP *:sunrpc
rpcbind   1128     rpc   10u  IPv6  10144      0t0  UDP *:879
rpcbind   1128     rpc   11u  IPv6  10145      0t0  TCP *:sunrpc (LISTEN)
avahi-dae 1176   avahi   13u  IPv4  10313      0t0  UDP *:mdns
avahi-dae 1176   avahi   14u  IPv4  10314      0t0  UDP *:57022
rpc.statd 1198 rpcuser    5r  IPv4  10441      0t0  UDP *:950
rpc.statd 1198 rpcuser    7u  IPv4  10452      0t0  UDP *:pftp
rpc.statd 1198 rpcuser    8u  IPv4  10455      0t0  TCP *:pftp (LISTEN)
cupsd     1231    root    6u  IPv6  10588      0t0  TCP localhost:ipp (LISTEN)
cupsd     1231    root    7u  IPv4  10589      0t0  TCP localhost:ipp (LISTEN)
cupsd     1231    root    9u  IPv4  10592      0t0  UDP *:ipp
sshd      1429    root    3u  IPv4  11304      0t0  TCP *:ssh (LISTEN)
sshd      1429    root    4u  IPv6  11308      0t0  TCP *:ssh (LISTEN)
ntpd      1437     ntp   16u  IPv4  11332      0t0  UDP *:ntp
ntpd      1437     ntp   17u  IPv6  11333      0t0  UDP *:ntp
ntpd      1437     ntp   18u  IPv6  11337      0t0  UDP localhost:ntp
ntpd      1437     ntp   19u  IPv4  11338      0t0  UDP localhost:ntp
ntpd      1437     ntp   21u  IPv6  13279      0t0  UDP [fe80::21b:21ff:fe51:a484]:ntp
ntpd      1437     ntp   22u  IPv4  13280      0t0  UDP 192.168.1.5:ntp
sendmail  1626    root    4u  IPv4  12754      0t0  TCP localhost:smtp (LISTEN)
sshd      1664    root    3r  IPv4  13625      0t0  TCP 192.168.1.5:ssh->192.168.1.199:livestats (ESTABLISHED)
rpc.rquot 1723    root    3u  IPv4  13884      0t0  UDP *:rquotad
rpc.rquot 1723    root    4u  IPv4  13891      0t0  TCP *:rquotad (LISTEN)
rpc.mount 1738    root    6u  IPv4  13952      0t0  UDP *:892
rpc.mount 1738    root    7u  IPv4  13955      0t0  TCP *:892 (LISTEN)


Rebooten heb ik nu al tig keer geprobeerd, services herhaaldelijk herstart, enzovoort. Ik ben door mijn inspiratie heen...

Acties:
  • 0 Henk 'm!

  • Q
  • Registratie: November 1999
  • Laatst online: 17:12

Q

Au Contraire Mon Capitan!

Wat was de oplossing?

Acties:
  • 0 Henk 'm!

  • Sallin
  • Registratie: Mei 2004
  • Niet online
Inderdaad oplossing is wel handig. Ook als het toevallig iets stoms was. Vaak zat zelf bij de hand gehad.

This too shall pass
Debian | VirtualBox (W7), Flickr


Acties:
  • 0 Henk 'm!

  • TommyboyNL
  • Registratie: Januari 2006
  • Niet online
Sorry voor mijn late reactie, niet teruggekeken in dit topic.
NFS bleek wel de goede poorten te gebruiken, maar ik had de firewall verkeerd geconfigureerd. Bij het kopieren-plakken van bepaalde regels, was ik vergeten UDP in TCP te veranderen, of andersom, of had het heen- en terug veranderd.
Uiteindelijk bleek het dus een kwestie van twee letters veranderen in iptables...

Acties:
  • 0 Henk 'm!

  • Q
  • Registratie: November 1999
  • Laatst online: 17:12

Q

Au Contraire Mon Capitan!

Netjes dat je nog even laat weten wat de oorzaak was.