Showing posts with label Networking. Show all posts
Showing posts with label Networking. Show all posts

Saturday, September 6, 2008

NFS Behind a Firewall

Setting up NFS is very simple but since ports are dynamically assigned on the server this creates a major headache for firewall rules.

NFS v2 and v3 require these services to be running (use chkconfig --list to see if they are configured to start at boot time)

  • portmap - dynamically assigns ports for the NFS service
  • nfslock - allows NFS clients to create locks on the files on the server
  • nfs - the “umbrella” NFS daemon (this is not one daemon but rather several RPC processes: rpc.mountd, rpc.nfsd, rpc.statd, rpc.quotad, rpc.idmapd)

To make firewall rules we need to force NFS to use the same port numbers every time it is run. To do this, put the following into /etc/sysconfig/nfs (create this file if it doesn’t exist)

# NFS port numbers
STATD_PORT=10002
STATD_OUTGOING_PORT=10003
MOUNTD_PORT=10004
RQUOTAD_PORT=10005
LOCKD_UDPPORT=10006

Now we need to have the following ports open in the firewall

  • 111 TCP and UDP (portmapper)
  • 2049 TCP andUDP (NFS). By default CentOS clients will only use the TCP port but the Mac OS X default is to use UDP
  • 10002 - 10006 TCP and UDP. These are the static port numbers that NFS will now use every time it starts up

Aside: If performance from MAC OS X clients is slow when configured to use TCP, try setting the kernel paramater net.inet.tcp.delayed_ack equal to zero on the Mac clients (/usr/sbin/sysctl -w net.inet.tcp.delayed_ack=0).

Disabling IPV6 Networking on Redhat, CentOS and Fedora

Even though many OS's can now do IPv6 networking, most organisations don't yet have IPv6 networks so having this capability enabled in the OS (which it is by default on Redhat) can just be an annoyance. To completely disable IPv6 in your system do the following

1. echo "alias net-pf-10 off" >> /etc/modprobe.conf
2. Set NETWORKING_IPV6=no in /etc/sysconfig/network
3. For each interface (except loopback) set IPV6INIT=no in each configuration file. The configuration file for the eth0 interface is /etc/sysconfig/network-scripts/ifcfg-eth0. Others are similarly named.
4. Stop and permanently disable the IPv6 firewall/iptables
# service ip6tables stop
# chkconfig --level 12345 ip6tables off