## Configuring RMI for use through a Firewall

By default, the RMI protocol in JOnAS uses a random port at each startup, which implies that there is no way to configure a firewall as the port number changes each time the system restarts.

However, as of JOnAS version 4.4.1, you can easily configure the RMI port number by setting only one property per protocol in the `$JONAS_BASE/conf/carol.properties` file.

To configure the RMI exported-port number, edit the `$JONAS_BASE/conf/carol.properties` file to change the following protocols from 0 (choose a random port number) to the port number you want:

- For the RMI/JRMP protocol, change:

      carol.jrmp.server.port=0

- For the RMI/Jeremie protocol, change:

      carol.jeremie.server.port=0

- For the RMI/IIOP protocol, change:

      carol.iiop.server.port=0

Note: The `jonas.orb.port` property has been moved from the `$JONAS_BASE/conf/jonas.properties` file to the `$JONAS_BASE/conf/carol.properties` file, as the latter is the file in which the registry ports and protocols were already being set. In previous JOnAS versions the `jonas.orb.port` property was not useful in multi-protocols mode as it allowed only one port number to be set for a single protocol. Also, the `jonas.orb.port` property was working only for RMI/JRMP and for objects using the `PortableRemoteObject` class for their export.