[erlang-questions] inet_res:getbyname/2 and udp:connect/3

Dmitry Belyaev <>
Wed Jun 16 16:02:06 CEST 2010


Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] 
[hipe] [kernel-poll:false]

Eshell V5.7.5  (abort with ^G)
1> inet_res:resolve("www.rogvall.se", in, a, 
[{nameservers,[{{127,0,0,1},53},{{95,108,198,5},53}]},verbose], 1000).
Query: {msg,[{header,{header,[{id,1},
                               {qr,0},
                               {opcode,'query'},
                               {aa,0},
                               {tc,0},
                               {rd,true},
                               {ra,0},
                               {pr,0},
                               {rcode,0}]}},
              {qdlist,[{dns_query,[{domain,"www.rogvall.se"},
                                   {type,a},
                                   {class,in}]}]},
              {anlist,[]},
              {nslist,[]},
              {arlist,[]}]}
Try UDP server : {127,0,0,1}:53 (timeout=666)
UDP server error: {error,econnrefused}
Try UDP server : {95,108,198,5}:53 (timeout=666)
UDP server error: {error,timeout}
Try UDP server : {95,108,198,5}:53 (timeout=326)
UDP server error: {error,timeout}
Try UDP server : {95,108,198,5}:53 (timeout=0)
UDP server timeout
{error,timeout}
2>

Probably it depends on OS:
Linux rumata-nb 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 
2010 i686 GNU/Linux

Dmitry Belyaev


On 06/16/2010 05:17 PM, Tony Rogvall wrote:
>
> On 16 jun 2010, at 14.47, Dmitry Belyaev wrote:
>
>    
>> Try to add one working nameserver after 127.0.0.1 like this (like for my router):
>>
>> inet_res:resolve("www.rogvall.se", in, a, [{nameservers,[{{127,0,0,1},53}, {{192,168,0,1},53}]},verbose], 5000).
>>
>> Even if second server is working, the result will be the same.
>>
>> Dmitry Belyaev
>>
>>      
> In may case it works, are you sure your router is on 192.168.0.1, mine is on 192.168.0.254
> Also the router must support DNS forwarding.
>
> My output:
>
> inet_res:resolve("www.rogvall.se", in, a, [{nameservers,[{{127,0,0,1},53},{{192,168,0,254},53}]},verbose], 1000).
> Query: {msg,[{header,{header,[{id,14},
>                                {qr,0},
>                                {opcode,'query'},
>                                {aa,0},
>                                {tc,0},
>                                {rd,true},
>                                {ra,0},
>                                {pr,0},
>                                {rcode,0}]}},
>               {qdlist,[{dns_query,[{domain,"www.rogvall.se"},
>                                    {type,a},
>                                    {class,in}]}]},
>               {anlist,[]},
>               {nslist,[]},
>               {arlist,[]}]}
> Try UDP server : {127,0,0,1}:53 (timeout=666)
> UDP server error: {error,econnrefused}
> Try UDP server : {192,168,0,254}:53 (timeout=666)
> Got reply: {msg,[{header,{header,[{id,14},
>                                    {qr,true},
>                                    {opcode,'query'},
>                                    {aa,false},
>                                    {tc,false},
>                                    {rd,true},
>                                    {ra,true},
>                                    {pr,false},
>                                    {rcode,0}]}},
>                   {qdlist,[{dns_query,[{domain,"www.rogvall.se"},
>                                        {type,a},
>                                        {class,in}]}]},
>                   {anlist,[{rr,[{domain,"www.rogvall.se"},
>                                 {type,cname},
>                                 {class,in},
>                                 {ttl,20410},
>                                 {data,"rogvall.se"}]},
>                            {rr,[{domain,"rogvall.se"},
>                                 {type,a},
>                                 {class,in},
>                                 {ttl,20410},
>                                 {data,{85,112,160,12}}]}]},
>                   {nslist,[{rr,[{domain,"rogvall.se"},
>                                 {type,ns},
>                                 {class,in},
>                                 {ttl,85210},
>                                 {data,"ns02.netcamp.se"}]},
>                            {rr,[{domain,"rogvall.se"},
>                                 {type,ns},
>                                 {class,in},
>                                 {ttl,85210},
>                                 {data,"ns01.netcamp.se"}]},
>                            {rr,[{domain,"rogvall.se"},
>                                 {type,ns},
>                                 {class,in},
>                                 {ttl,85210},
>                                 {data,"ns03.netcamp.se"}]}]},
>                   {arlist,[{rr,[{domain,"ns01.netcamp.se"},
>                                 {type,a},
>                                 {class,in},
>                                 {ttl,1343},
>                                 {data,{85,112,160,6}}]},
>                            {rr,[{domain,"ns03.netcamp.se"},
>                                 {type,a},
>                                 {class,in},
>                                 {ttl,1343},
>                                 {data,{85,112,162,6}}]}]}]}
> {ok,{dns_rec,{dns_header,14,true,'query',false,false,true,
>                           true,false,0},
>               [{dns_query,"www.rogvall.se",a,in}],
>               [{dns_rr,"www.rogvall.se",cname,in,0,20410,"rogvall.se",
>                        undefined,[],false},
>                {dns_rr,"rogvall.se",a,in,0,20410,
>                        {85,112,160,12},
>                        undefined,[],false}],
>               [{dns_rr,"rogvall.se",ns,in,0,85210,"ns02.netcamp.se",
>                        undefined,[],false},
>                {dns_rr,"rogvall.se",ns,in,0,85210,"ns01.netcamp.se",
>                        undefined,[],false},
>                {dns_rr,"rogvall.se",ns,in,0,85210,"ns03.netcamp.se",
>                        undefined,[],false}],
>               [{dns_rr,"ns01.netcamp.se",a,in,0,1343,
>                        {85,112,160,6},
>                        undefined,[],false},
>                {dns_rr,"ns03.netcamp.se",a,in,0,1343,
>                        {85,112,162,6},
>                        undefined,[],false}]}}
>
> /Tony
>
>
>
>
>    


More information about the erlang-questions mailing list