详情请看 http://www.cublog.cn/u2/83905/showart_1889176.html
原文地址 http://www.xml.com/ldd/chapter/book/ch14.html
源码下载 http://www.cs.fsu.edu/~baker/devices/lxr/http/source/ldd-examples/snull/
附件中是我调试成功的代码,整个环境是在 Ubuntu 10.04下,无网络连接。
注意:
- 配置/etc/hosts, 在其中添加
192.168.0.1 local0 192.168.0.2 remote0 192.168.1.2 local1 192.168.1.1 remote1
- 配置/etc/networks, 在其中添加
snullnet0 192.168.0.0 snullnet1 192.168.1.0
- 通过dmesg查看运行结果
- 执行 ./run 即可