[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] lwip minimal example, echo server
From: |
Matthias Dübon |
Subject: |
Re: [lwip-users] lwip minimal example, echo server |
Date: |
Tue, 7 Oct 2014 12:39:49 +0200 |
Hello Sergio,
thanks for your support, I found my mistake, I changed the IP address
from 192.168.0.2 to 172.168.0.2 because the 192.168.0.2 is already
taken in my network. When using 192.168.5.2 everything is working
fine. Hence I think I have to read something more about tap devices
and default gateways.
best
Matthias
On Fri, Oct 3, 2014 at 3:27 PM, Sergio R. Caprile <address@hidden> wrote:
> OK, here I go...
> The UN*X examples use a tun/tap device, and there is a specific
> configuration parameter for different flavors of it. Check the Makefile
> for this, did you ?
> #To compile for linux: make ARCH=linux
> #To compile for cygwin: make ARCH=cygwin
> #To compile for openbsd: make ARCH=openbsd
> ARCH=linux
> Once you have the correct tun or tap device, it will show up in your
> ifconfig and you will be able to ping the lwIP stack as a new machine on
> a new network, which is what you should do first when debugging
> networking problems.
>
> In main.c:
> /* startup defaults (may be overridden by one or more opts) */
> IP4_ADDR(&gw, 192,168,0,1);
> IP4_ADDR(&ipaddr, 192,168,0,2);
> IP4_ADDR(&netmask, 255,255,255,0);
>
> So, 192.168.0.1 will be the address of the gateway in your machine to
> "the lwIP network", via a tun or tap interface. In Linux seems to be tap
>
> tap0 Link encap:Ethernet HWaddr 86:99:D8:CE:27:DC
> inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0
> inet6 addr: fe80::8499:d8ff:fece:27dc/64 Scope:Link
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:500
> RX bytes:0 (0.0 b) TX bytes:468 (468.0 b)
>
> The specifics to get the tap working are beyond my knowledge, I remember
> I just followed a tutorial. The interface will be up once the example is
> running, and will dissappear after that.
> Anyway, you should be able to ping that interface to check if the tap is
> working.
>
> And, 192.168.0.2 will be your "lwIP machine" address, you should be
> able to ping it
>
> address@hidden minimal]# ping 192.168.0.2
> PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
> 64 bytes from 192.168.0.2: icmp_seq=1 ttl=255 time=8.76 ms
> 64 bytes from 192.168.0.2: icmp_seq=2 ttl=255 time=9.66 ms
>
> --- 192.168.0.2 ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 999ms
> rtt min/avg/max/mdev = 8.766/9.214/9.663/0.458 ms
>
> and you should be able to telnet to it in port 7, cause no one knows if
> your
>
> SimpleEchoClient really works, although you probably will.
>
>
> address@hidden minimal]# telnet 192.168.0.2 7
> Trying 192.168.0.2...
> Connected to 192.168.0.2.
> Escape character is '^]'.
> hola
> hola
>
> You probably noticed I run this as root... there are some permissions
> associated to the tap interface, and I'm lazy enough to change them.
> Anyway, you should see something like this:
> tapif: tapif_init: open: Permission denied
> if that is the case.
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
ᐧ