How to set a static port for DFS Replication traffic

It’s easy: use the dfsrdiag staticRPC command. You can verify the static RPC port change by using the dfsrdiag dumpmachinecfg command. (Note: the default value of the StaticRPC parameter is 0. This indicates a dynamic port assignment.)

Will this setting last across reboots? You bet. According to DFS Replication guru Rob Post, when you specify a static port, the server-specific DFS Replication configuration file (stored in %SYSTEMDRIVE%System Volume InformationDFSRConfigDfsrMachineConfig.XML) is updated with the port information. This allows the setting to hold across reboots and service starts and stops.  If someone ever deleted the configuration file, the configuration file would be reset to defaults, though this should be extremely rare.  If it did occur, you will see event 6702 in the DFS Replication event log notifying you that the custom server configuration settings have been erased.