I have set up with qemu machines a virtual LAN that is made totally in user space via a TCP socket on port 1234. I needed this in order to test the changes I am working on for the ppp-udeb Debian installer module that supports (or should I say, should support) configuration of PPPoE connections.
These are the tools whose authors and maintainers deserve kudos:
- Debian Installer
- qemu (upstream page here)- for allowing me to create a server, a client machine and a Debian installer machine to test things
- qemu-launcher - for being such a good interface for qemu and allowing quick selection of virtual machines
- pppoe - because it contains the pppoe-server command
- the upstream/source package rp-pppoe because it contains the /etc/ppp/pppoe-server-options
- the pppd package because of the pppd, pon and plog commands
- last, but not least, zim, for allowing me to put some order into my thoughts
This is the tutorial I followed to configure the PPPoE server http://www.freeantennas.com/PPPoE-Server-HOWTO.html, but until then I had to make the network.
In case someone is interested, here's how I did it (these are Debian centric instructions, but I don't see anything that would stop someone to do the same even on a windows machine).
- create a i386 virtual machine in qemu-launcher; name it "Debian Test ppp-udeb server i386" or something like that - don't forget to save; is useful to add some comments about it; the configuration of the machine:
- small hard-drive - 1-2GB (use the qemu format, it will grow as needed) - this drive is about 903 MB while the client's (see below) is about 760MB
- user mode networking
- make it boot from CD (you will need at least a Debian Installer buisinesscard iso image and choose the D-I image to boot from) - I took an old daily I had since I already had it on my disk - if you have a real CD you can use that too.
- check the option to provide a control panel for the image, is really useful (don't forget to install qemuctl and set the path to in in qemu-launcher - not set by default, but I made small and trivial patch)
- install a basic Debian Etch system on the machine; optionally you could install ssh (both the server and the client) as they might prove useful later
- after installation, stop the machine properly and make a copy the hard disk image file - this will the the hard disk of a client machine and will help to make sure the server is working properly - I only needed this temporary, so I could erase that image now that I am sure the pppoe server machine works and is configured properly
- create another machine in qemu-launcher starting from the server machine configuration - will modify later the network interface type now to be TCP socket already opened - this would allow communicating with the server machine without root privileges; now change the hard disk image to point to the copy just made and start this machine; install pppoeconf on it and stop it when done
- start the server again and install pppoe package and get its source, too - will need some files from there which are not in the binary; stop it when done
- reconfigure both the server machine and the client machine to use TCP socket - "Open a listening TCP socket" and "Use an already open TCP socket", respectively
- start both machines (always start the client after the server) and configure each of the machine with a static IP (I used 10.0.2.10 and 10.0.2.20) and check the machines see each other - ping or ssh; if it doesn't work make sure to restart them so that the client is started after the server
- now you have two machines that are in a network and you can start to follow the PPPoE-Server-HOWTO