| 1 |
This directory contains an example of how a project using lwIP might |
| 2 |
look. It is also the development platform of lwIP, since it can be run |
| 3 |
as a user process under FreeBSD or Linux. There are also a number of |
| 4 |
example applications (including a simple web server) in the apps/ |
| 5 |
directory. |
| 6 |
|
| 7 |
Some short instructions on how to build and run lwIP on a FreeBSD or |
| 8 |
Linux host. For FreeBSD, the tap interface must be enabled in the |
| 9 |
kernel configuration and the kernel must be recompiled. The tap |
| 10 |
interface is enabled by adding the line "pseudo-device tap" in the |
| 11 |
kernel configuration. See Chapter 9 in the FreeBSD handbook for |
| 12 |
instructions on how to build a custom FreeBSD kernel. |
| 13 |
|
| 14 |
For Linux you might need to create a device node with |
| 15 |
|
| 16 |
> mknod /dev/net/tun c 10 200 |
| 17 |
|
| 18 |
* Compile the code. This must be done by using GNU Make. Under |
| 19 |
FreeBSD, GNU Make can be found in the ports collection under |
| 20 |
/usr/ports/devel/gmake (type "make install distclean" to |
| 21 |
install). Under Linux, GNU Make is the default "make". |
| 22 |
|
| 23 |
> gmake (FreeBSD) |
| 24 |
|
| 25 |
> make (Linux) |
| 26 |
|
| 27 |
* The compilation process produces the executable file "simhost". To |
| 28 |
run this, you have to be root. |
| 29 |
|
| 30 |
> su (Type password for the root account) |
| 31 |
# ./simhost |
| 32 |
|
| 33 |
* The lwIP TCP/IP stack is now running with IP address |
| 34 |
192.168.0.2. Some things that you can try: |
| 35 |
|
| 36 |
To see the packets that are going to and from the lwIP stack, run |
| 37 |
tcpdump: |
| 38 |
|
| 39 |
# tcpdump -l -n -i tap0 |
| 40 |
|
| 41 |
You can ping lwIP: |
| 42 |
|
| 43 |
> ping 192.168.0.2 |
| 44 |
|
| 45 |
For a telnet shell, run: |
| 46 |
|
| 47 |
> telnet 192.168.0.2 |
| 48 |
|
| 49 |
Finally, "simhost" also includes a simple web server; the URL is |
| 50 |
of course http://192.168.0.2/. |
| 51 |
|
| 52 |
* Simhost has some extra features that can be |
| 53 |
selected with command line options. |
| 54 |
|
| 55 |
To enable runtime debug output (project must be build with -DLWIP_DEBUG): |
| 56 |
|
| 57 |
# ./simhost -d |
| 58 |
|
| 59 |
To ping any host, e.g. the gateway: |
| 60 |
|
| 61 |
# ./simhost -p 192.168.0.1 |