[Libwebsockets] Why is it necessary to set a route for libwebsocket even when server and client are on the same network

Thomas Spitz thomas.spitz at hestia-france.com
Wed Apr 15 10:38:48 CEST 2015

Hello everybody,

I am using libwebsocket to connect a client and a server that are on the
same subnetwork. (eg: and

Here is what I do to configure statically my server IP parameters:

>  # ip link set eth0 up
>  # ip addr add broadcast + dev eth0

If I check route at this stage, i see the following:

>  # ip route
> dev lo  scope link
> dev eth0  proto kernel  scope link  src

At this stage, if I try to connect to the server it hangs up.

 Then if I do

>  # ip route add default via 192.168.1.x with x between 0 and 255 OR ip
> route add default via

Now the server replies correctly but I don't see any change using ip route

>  # ip route
> dev lo  scope link
> dev eth0  proto kernel  scope link  src

I don't understand why libwebsocket need to know a route in order to reply
to a client on the same network?

Last question: if I give a gateway address that is not on the same
subnetwork as the server (customer wrong setting), eg:

> #ip route add default via

RTNETLINK answers: Network is unreachable

Again, the libwebsocket doesn't respond anymore.

Sorry if it is network basics questions....

Thanks in advance for your answers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150415/63e3a256/attachment.html>

More information about the Libwebsockets mailing list