On our slave NIS server we have in /etc/sysconfig/network
I've set
YPSERV_ARGS="-p 944"
YPXFRD_ARGS="-p 945"
and OTHER_YPBIND_OPTS="-p 3000"
in /etc/ypbind.conf
and YPPASSWDD_ARGS="--port 946"
in /etc/sysconfig/yppasswdd
But on the master server when running make -C /var/yp
and debug enabled on firewalld the destination port (DPT) always changes. It's always UDP.
kernel: FINAL_REJECT: IN=eno3 OUT= MAC=00:0a:f7:e1:f8:6c:00:0a:f7:e1:d3:71:08:00 SRC=nis-slave DST=nis-master LEN=76 TOS=0x00 PREC=0x00 TTL=64 ID=59404 DF PROTO=UDP SPT=1003 DPT=676 LEN=56
Also in the new /etc/nfs.conf
we have:
[lockd]
port=4002
udp-port=4002
[mountd]
port=4003
[nfsd]
port=2049
port=4001
outgoing-port=4004
And the logs in the slave server show: ypxfr_callback call: RPC: Unable to receive; errno = No route to host
Stopping firewalld and all is well. So what service is using UDP?
The ancient YP/NIS stuff is not at all firewall friendly. It literally predates the wide use of host firewalls. As you've noticed, it expects to be able to communicate on arbitrary ports. Most protocols from the last 20 years or so no longer do this, and run on predictable (or at least configurable) ports.
As a workaround, if you only have one IP address, though, you can just add it to the
trusted
zone in firewalld, and all traffic from that IP address will be allowed. (Sources can also be given by CIDR range or MAC address.)agree with the NIS being ancient, don't use it if you do not have to.
For NFS here is an example I am taking from SLES 11.4
/etc/sysconfig/nfs
Be aware things may be slightly different given the NFS version and linux distribution you are using. But the port numbers you need to open in your firewall are at leastMOUNTD_PORT
andSM_NOTIFY_OPTIONS
andSTATD_PORT
andLOCKD_TCPPORT
andLOCKD_UDPPORT
in addition to the ports for the NFS service which is typically 111 and 2049 for both TCP and UDP.for
custom_number_1
tocustom_number_4
use something above 1024, anything below 1024 is reserved for privilege services. You don't want to choose a number that conflicts with some other service obviously, the range 1024..9999 you can use but as personal preference i have mine set above 10,000. The range >= 49152 is believe is the dynamic range which i don't think you should choose; what happens if you don't configure NFS (tell it what to use) then it choose them dynamically and it would be some port number >= 49152 and would be different each time because it's dynamic... and why you would have problems because the firewall would be blocking all those ports and you would never know what they would be because of the NFS choosing them dynamically.that dynamic choosing of port numbers, that you describe for NIS, same deal; the service was not fully configured so things that were left blank or default or chosen dynamically = different each time = no way to properly configure or use a firewall.