You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Certus Technology <in...@certus-tech.com> on 2011/04/21 17:51:17 UTC

Bind rmi registry to specific IP address

Hi,

I am trying to get rmiRegistry in karaf to bind to a specific IP, rather 
than all IPs. This can be done for the SSH by setting sshPort and 
sshHost in org.apache.karaf.shell.cfg, but I cannot see how we can  do 
the same thing for rmiRegistryPort in org.apache.karaf.management.cfg. I 
really want to be able to set rmiRegistryHost but this does not work.

This question relates to this topic, but I wish to go down a different 
route.

http://karaf.922171.n3.nabble.com/Multiple-instances-of-Karaf-on-same 
host-td1997807.html

Any suggestions welcome

Regards

Rob


-- 
Certus Technology Associates Limited.
http://www.certus-tech.com


Re: Bind rmi registry to specific IP address

Posted by Andreas Pieber <an...@gmail.com>.
Hey Certus,

I've just given the code a look. I'm not so sure if the -b option is
exactly what you like in this case. BUT we can add another parameter,
a rmiRegisteryHost (this have to be done in
org.apache.karaf.management.RmiRegistryFactory. In addition the
blueprint and config have to be updated. I assume that the felix
webclient also have to be updated for this. Can you please create a
feature request JIRA issue?

Kind regards,
Andreas

On Thu, Apr 21, 2011 at 6:36 PM, Certus Technology <in...@certus-tech.com> wrote:
> Achim,
>
> Thanks for the suggestion. I have tried a couple of things:
>
> Setting -b 10.0.0.1 as a jvm argument prevents the jvm from starting.
> Unrecognized option: -b
>
> Passing -b 10.0.0.1 to the karaf main (org.apache.karaf.main.Main) has no
> effect on which IP addresses the rmiRegistryPort binds to.
>
> Can you clarify what you mean?
>
> Regards
>
> Rob
>
> On 21/04/11 16:58, Achim Nierbeck wrote:
>>
>> There is just one thing that comes to my mind, when staring the jvm
>> you can tell wich ip address to bind on through the -b param
>> e.g. -b0.0.0.0 does bind on all interfaces on the server. it might be
>> possible by configuring this through the system.properties or you
>> might
>> need to change the startup skript for that.
>>
>> regards, Achim
>
>
> --
> Certus Technology Associates Limited.
> http://www.certus-tech.com
>
>
>

Re: Bind rmi registry to specific IP address

Posted by Andreas Pieber <an...@gmail.com>.
As already discussed in IRC this is a good "quick and dirty" solution.
Though the "longer lasting" method would be to add the rmiHost
parameter to Karafs management kernel
(https://issues.apache.org/jira/browse/KARAF-581)

Kind regards,
Andreas

On Fri, Apr 22, 2011 at 9:08 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> -b is a specific parameter used by JBoss. JBoss populates several args with
> that in the jboss-service.xml.
>
> To set the IP address used by the RMI server (in any system), you have to
> use the following Java arg:
>
> -Djava.rmi.server.hostname=
>
> If you use 0.0.0.0 it will be bound to all IP address:
>
> -Djava.rmi.server.hostname=0.0.0.0
>
> You can bind to a specific IP address or hostname:
>
> -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx
>
> You have to set that in the karaf startup script.
>
> You have the detail of the RMI properties here:
> http://download.oracle.com/javase/1.4.2/docs/guide/rmi/javarmiproperties.html
>
> Regards
> JB
>
> On 04/21/2011 06:36 PM, Certus Technology wrote:
>>
>> Achim,
>>
>> Thanks for the suggestion. I have tried a couple of things:
>>
>> Setting -b 10.0.0.1 as a jvm argument prevents the jvm from starting.
>> Unrecognized option: -b
>>
>> Passing -b 10.0.0.1 to the karaf main (org.apache.karaf.main.Main) has
>> no effect on which IP addresses the rmiRegistryPort binds to.
>>
>> Can you clarify what you mean?
>>
>> Regards
>>
>> Rob
>>
>> On 21/04/11 16:58, Achim Nierbeck wrote:
>>>
>>> There is just one thing that comes to my mind, when staring the jvm
>>> you can tell wich ip address to bind on through the -b param
>>> e.g. -b0.0.0.0 does bind on all interfaces on the server. it might be
>>> possible by configuring this through the system.properties or you
>>> might
>>> need to change the startup skript for that.
>>>
>>> regards, Achim
>>
>>
>

Re: Bind rmi registry to specific IP address

Posted by Andreas Pieber <an...@gmail.com>.
Hey Certus,

Future ideas for Karaf are always welcomed :)

I'm not sure if it is enough to set the RMI host to another IP. This
have to be validated first. Though, please feel free to create a JIRA
for this that we can collect the ideas, requirements and experiences
to this topic. TBH I've never made any real use for the -b option of
JBoss (except for -b 0.0.0.0 of cause :)), but I think it's a valid
option and a good idea to include into Karaf.

Kind regards,
Andreas

On Fri, Apr 22, 2011 at 9:56 PM, Certus Technology <in...@certus-tech.com> wrote:
> Not sure I am in a position to ask for enhancements ;) but the -b IPAddress
> feature of JBoss is something we make great use of, and it makes running
> multiple instances of JBoss on a single machine very simple. A similar
> feature in karaf would be great, so we have a single point to configure the
> bind address of all listening sockets.
>
> Regards
>
> Rob
>
> On 22/04/11 08:08, Jean-Baptiste Onofré wrote:
>>
>> -b is a specific parameter used by JBoss. JBoss populates several args
>> with that in the jboss-service.xml.
>>
>> To set the IP address used by the RMI server (in any system), you have to
>> use the following Java arg:
>>
>> -Djava.rmi.server.hostname=
>>
>> If you use 0.0.0.0 it will be bound to all IP address:
>>
>> -Djava.rmi.server.hostname=0.0.0.0
>>
>> You can bind to a specific IP address or hostname:
>>
>> -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx
>>
>> You have to set that in the karaf startup script.
>>
>> You have the detail of the RMI properties here:
>>
>> http://download.oracle.com/javase/1.4.2/docs/guide/rmi/javarmiproperties.html
>>
>> Regards
>> JB
>>
>
>

Re: Bind rmi registry to specific IP address

Posted by Certus Technology <in...@certus-tech.com>.
Not sure I am in a position to ask for enhancements ;) but the -b 
IPAddress feature of JBoss is something we make great use of, and it 
makes running multiple instances of JBoss on a single machine very 
simple. A similar feature in karaf would be great, so we have a single 
point to configure the bind address of all listening sockets.

Regards

Rob

On 22/04/11 08:08, Jean-Baptiste Onofré wrote:
> -b is a specific parameter used by JBoss. JBoss populates several args 
> with that in the jboss-service.xml.
>
> To set the IP address used by the RMI server (in any system), you have 
> to use the following Java arg:
>
> -Djava.rmi.server.hostname=
>
> If you use 0.0.0.0 it will be bound to all IP address:
>
> -Djava.rmi.server.hostname=0.0.0.0
>
> You can bind to a specific IP address or hostname:
>
> -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx
>
> You have to set that in the karaf startup script.
>
> You have the detail of the RMI properties here:
> http://download.oracle.com/javase/1.4.2/docs/guide/rmi/javarmiproperties.html 
>
>
> Regards
> JB
>


Re: Bind rmi registry to specific IP address

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
-b is a specific parameter used by JBoss. JBoss populates several args 
with that in the jboss-service.xml.

To set the IP address used by the RMI server (in any system), you have 
to use the following Java arg:

-Djava.rmi.server.hostname=

If you use 0.0.0.0 it will be bound to all IP address:

-Djava.rmi.server.hostname=0.0.0.0

You can bind to a specific IP address or hostname:

-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx

You have to set that in the karaf startup script.

You have the detail of the RMI properties here:
http://download.oracle.com/javase/1.4.2/docs/guide/rmi/javarmiproperties.html

Regards
JB

On 04/21/2011 06:36 PM, Certus Technology wrote:
> Achim,
>
> Thanks for the suggestion. I have tried a couple of things:
>
> Setting -b 10.0.0.1 as a jvm argument prevents the jvm from starting.
> Unrecognized option: -b
>
> Passing -b 10.0.0.1 to the karaf main (org.apache.karaf.main.Main) has
> no effect on which IP addresses the rmiRegistryPort binds to.
>
> Can you clarify what you mean?
>
> Regards
>
> Rob
>
> On 21/04/11 16:58, Achim Nierbeck wrote:
>> There is just one thing that comes to my mind, when staring the jvm
>> you can tell wich ip address to bind on through the -b param
>> e.g. -b0.0.0.0 does bind on all interfaces on the server. it might be
>> possible by configuring this through the system.properties or you
>> might
>> need to change the startup skript for that.
>>
>> regards, Achim
>
>

Re: Bind rmi registry to specific IP address

Posted by Certus Technology <in...@certus-tech.com>.
Achim,

Thanks for the suggestion. I have tried a couple of things:

Setting -b 10.0.0.1 as a jvm argument prevents the jvm from starting. 
Unrecognized option: -b

Passing -b 10.0.0.1 to the karaf main (org.apache.karaf.main.Main) has 
no effect on which IP addresses the rmiRegistryPort binds to.

Can you clarify what you mean?

Regards

Rob

On 21/04/11 16:58, Achim Nierbeck wrote:
> There is just one thing that comes to my mind, when staring the jvm
> you can tell wich ip address to bind on through the -b param
> e.g. -b0.0.0.0 does bind on all interfaces on the server. it might be
> possible by configuring this through the system.properties or you
> might
> need to change the startup skript for that.
>
> regards, Achim


-- 
Certus Technology Associates Limited.
http://www.certus-tech.com



Re: Bind rmi registry to specific IP address

Posted by Achim Nierbeck <bc...@googlemail.com>.
There is just one thing that comes to my mind, when staring the jvm
you can tell wich ip address to bind on through the -b param
e.g. -b0.0.0.0 does bind on all interfaces on the server. it might be
possible by configuring this through the system.properties or you
might
need to change the startup skript for that.

regards, Achim

2011/4/21 Certus Technology <in...@certus-tech.com>:
> Hi,
>
> I am trying to get rmiRegistry in karaf to bind to a specific IP, rather
> than all IPs. This can be done for the SSH by setting sshPort and sshHost in
> org.apache.karaf.shell.cfg, but I cannot see how we can  do the same thing
> for rmiRegistryPort in org.apache.karaf.management.cfg. I really want to be
> able to set rmiRegistryHost but this does not work.
>
> This question relates to this topic, but I wish to go down a different
> route.
>
> http://karaf.922171.n3.nabble.com/Multiple-instances-of-Karaf-on-same
> host-td1997807.html
>
> Any suggestions welcome
>
> Regards
>
> Rob
>
>
> --
> Certus Technology Associates Limited.
> http://www.certus-tech.com
>
>