Erlang behind firewall(s) (which ports do I need)

Klacke <>
Tue May 29 08:52:11 CEST 2001


On Mon, May 28, 2001 at 11:46:00PM +0300, Jouni Ryno wrote:
> Which ports need to be open for erlang nodes to talk with each other ?
> Just 4369 ?
> 
> I somehow taught it to be easier to make separate erlang-nodes as 
> repeaters, than making point-to-point tunnels over three different 
> networks combining ISDN, firewalled company network and home. But as 
> always, firewall hits me, so I need to be friends with sysadmins ...
> 
> 

This can't be done just now. The problem is that when a node starts,
it binds to a dynamically allocated port, get's the port num and
then tells epmd which portnum it got.
An extension is needed whereby it's possible to tell inet_tcp_dist.erl
(in the kernel app) that it should specifically listen() to an explicit
port as opposed to 0, which means "allocate dynamically"

Maybe something like:


listen(Name) ->
    case inet_tcp:listen(get_p_num(), [{active, false}, {packet,2}]) of
	{ok, Socket} ->
	    TcpAddress = get_tcp_address(Socket),
	    {_,Port} = TcpAddress#net_address.address,
	    {ok, Creation} = erl_epmd:register_node(Name, Port),
	    {ok, {Socket, TcpAddress, Creation}};
	Error ->
	    Error
    end.


get_p_num() ->
	case application:get_env(kernel, distport) of
		{ok, Pno} -> Pno;
		_ -> 0
	end.


and start as for example:

> erl -sname abc -kernel distport 7843


/klacke


-- 
Claes Wikstrom                        -- Caps lock is nowhere and
Alteon WebSystems                     -- everything is under control          
http://www.bluetail.com/~klacke       --




More information about the erlang-questions mailing list