NGNET-Testing-HOWTO: Difference between revisions
(Restored content from Wayback Machine) |
(No difference)
|
Latest revision as of 22:18, 10 November 2025
THIS DOCUMENT IS A WORK IN PROGRESS
Goal[edit]
Setup Linux-Vserver to use the future Network virtualization for testing purpose. While this new code is higly experimental and not yet integrated in util-vserver, we will have to use some dirty tricks.
Requirements[edit]
- The latest 2.6 version of Linux kernel sources
- The iptables sources
- The latest Linux-Vserver devel patch (http://vserver.13thfloor.at/Experimental/)
- The latest NGNET patch (http://vserver.13thfloor.at/Experimental/NGNET/)
- The latest util-vserver tools (0.30.196 or higher)
- Some knowledge on how Linux-Vserver works
Prepare the host system[edit]
We assume here that you have a working platform running Linux-Vserver 1.9.x with alpha version of util-vserver.
- First we will compile the 2.6 kernel corresponding to the latest ngnet patch foundable here (http://vserver.13thfloor.at/Experimental/NGNET/). Try to use a kernel configuration as close as possible to the following kernel configuration (http://vserver.13thfloor.at/Experimental/NGNET/kernel-ng8.config), especially about network stuff.
- In the meantime we will compile iptables with the vnet patch (http://vserver.13thfloor.at/Experimental/NGNET/iptables-1.2.11-vnet.patch) and install it on the host system.
- Also compile the *vnet* command (vnet-x.xx.tar.gz in http://vserver.13thfloor.at/Experimental/NGNET/) and install in on the host system.
Once those things are done, you can try to boot your system with the newly compiled kernel. If you don't succeed here, try to get some help on the #vserver channel.
Configure util-vserver[edit]
We'll have to remove all the network handling of util-vserver and replace it by the vnet stuff. To do that, you will remove (or not add) the interfaces directory in each vserver configuration directory and add some new actions to the vshelper tool. Util-vserver is so kind that you can hook some code for vshelper directly in the configuration of your vserver. We will use this ability to bind some vnet device configuration. This for each vserver, put the following lines in /etc/vservers/<vserver_name>/apps/vshelper/startup:
vnet -x <xid> -n <vnid1> -d lo vnet -x <xid> -n <vnid2> -d eth0 -D en0 iptables -t vnet -A PREROUTING -d <vserver_ip> -j VNET --vnet <vnid2> iptables -t vnet -A OUTPUT -s <vserver_ip> -j VNET --vnet <vnid2>
And replace:
- xid*: by the context id of the vserver
- vnid1*: by a uniq 16 bits (0-65535) id of your choice
- vnid2*: a different vid still uniq across all vservers
- vserver_ip*: by the IP of the vserver
Set the executable bit on this flag:
chmod 755 /etc/vservers/<vserver_name>/apps/vshelper/startup
Feel free to enhance this script, it's really a first try. We could take some info in environment/args set by vshelper and compute some uniq ids and then put this script in /etc/vservers/.defaults/apps/vshelper/statup. I you do such a script, please edit this page!
The en0 device of the vserver is binded to eth0 of the host. This really depend on your setup. You may change eth0 by something else if eth0 isn't the network device used for your vservers.
TODO: clean vnids
TODO: add caps
Configure vserver image[edit]
Now, you vserver is started with to devices not configured: lo and en0. It's now the work of the vserver to setup network devices. So you can use scripts provided by the distribution to setup network devices and IPs. Iptables rules allow only some ips to talk to the network, but you can setup any IPs you want on your vserver devices.