[Mirage-skeleton] dns example failed with socket network

mirageos
#1

when building the dns example in the Mirage-Skeleton, like this:

mirage configure -t unix --net=socket

it fails at runtime:

Warning (<string> line 47): Converting MD to MX
Warning (<string> line 48): Converting MF to MX
Fatal error: exception Unix.Unix_error(Unix.EACCES, "bind", "")
Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 1613, characters 52-74
Called from file "src/stack-unix/udpv4_socket.ml", line 37, characters 4-59
Called from file "src/stack-unix/tcpip_stack_socket.ml", line 73, characters 6-47
Called from file "src/core/lwt.ml", line 2462, characters 16-20

and when i run the examplie with a tap interface, like this:

mirage configure -t unix --net=direct

i got another problem:

Warning (<string> line 47): Converting MD to MX
Warning (<string> line 48): Converting MF to MX
2019-03-22 14:19:45 +08:00: INF [server] DNS server listening on UDP port 53
2019-03-22 14:19:48 +08:00: INF [client] Starting client resolver
2019-03-22 14:19:57 +08:00: INF [ARP] ARP timeout after 5 retries for 10.0.0.1
2019-03-22 14:19:57 +08:00: INF [ipv4] IP.output: could not send to 8.8.8.8: failed to contact gateway 10.0.0.1
2019-03-22 14:19:57 +08:00: WRN [ipv4] Write to 8.8.8.8 requires an external route, and the provided 10.0.0.1 was not reachable
2019-03-22 14:19:57 +08:00: ERR [udp] IP module couldn't send UDP packet to 8.8.8.8: no route to destination: no route to default gateway to outside world

i have tried my best to figure it out. Can anyone help me?

0 Likes

#2

The default port (let listening_port = 53) is a privileged port. Linux won’t allow non-root programs to listen on that port. This is why the README uses sudo to launch it.

0 Likes