Книга: Linux Network Administrator Guide, Second Edition
The Dummy Interface
The Dummy Interface
The dummy interface is a little exotic, but rather useful nevertheless. Its main benefit is with standalone hosts and machines whose only IP network connection is a dialup link. In fact, the latter are standalone hosts most of the time, too.
The dilemma with standalone hosts is that they only have a single network device active, the loopback device, which is usually assigned the address 127.0.0.1. On some occasions, however, you must send data to the "official" IP address of the local host. For instance, consider the laptop vlite, which was disconnected from a network for the duration of this example. An application on vlite may now want to send data to another application on the same host. Looking up vlite in /etc/hosts yields an IP address of 172.16.1.65, so the application tries to send to this address. As the loopback interface is currently the only active interface on the machine, the kernel has no idea that 172.16.1.65 actually refers to itself! Consequently, the kernel discards the datagram and returns an error to the application.
This is where the dummy device steps in. It solves the dilemma by simply serving as the alter ego of the loopback interface. In the case of vlite, you simply give it the address 172.16.1.65 and add a host route pointing to it. Every datagram for 172.16.1.65 is then delivered locally. The proper invocation is:[35]
# ifconfig dummy vlite
# route add vlite
- The Loopback Interface
- The SLIP and PPP Interfaces
- 4.4.4 The Dispatcher
- DUMMY PACKET INTERVAL
- About the author
- Chapter 7. The state machine
- Chapter 15. Graphical User Interfaces for Iptables
- Appendix E. Other resources and links
- Example NAT machine in theory
- The final stage of our NAT machine
- Compiling the user-land applications
- The conntrack entries