From 95b6ca606f766e8c46151c3468cf4e28cb7d74ab Mon Sep 17 00:00:00 2001 From: GNU Hurd wiki engine Date: Fri, 29 Aug 2008 18:47:14 +0000 Subject: web commit by zhengda --- community/howto.mdwn | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 community/howto.mdwn diff --git a/community/howto.mdwn b/community/howto.mdwn new file mode 100644 index 00000000..36b4bd01 --- /dev/null +++ b/community/howto.mdwn @@ -0,0 +1,83 @@ +[[meta copyright="Copyright © 2008 Free Software Foundation, Inc."]] + +[[meta license="""[[toggle id="license" text="GFDL 1.2+"]][[toggleable +id="license" text="Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with no Invariant +Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license +is included in the section entitled +[[GNU_Free_Documentation_License|/fdl]]."]]"""]] + + +This document briefly introduces how to set up the virtual network and connect the subhurd with the main hurd. + + +1. Set up the virtual network. + +1.1 Patch and install GNU Hurd, GNU Mach and the GNU C library. + +Step 1: Get the Hurd and compile it. + + cvs -z3 -d:ext:username@cvs.savannah.gnu.org:/sources/hurd co -r zhengda-soc2008-virt-branch + + +Step 2: apply the [patch](http://www.assembla.com/spaces/VNetHurd/documents/b0eLzUxHmr3ymXab7jnrAJ/download/A%20patch%20of%20gnumach) on the GNU Mach. +In order to connect the virtual network created in hurd with the external network, we need this patch. It enables the Hurd to set the Mach device into the promiscuous mode, so the real device can accept the packet that goes to the virtual device in hurd. + +This step is optional if we are only interested in creating a internal virtual network. + +Step 3: apply the [patch](http://www.assembla.com/spaces/VNetHurd/documents/aJidqKp6ur3z-Nab7jnrAJ/download/A%20patch%20of%20glibc) on glibc. +This patch enables the user to override the default socket server by using the environment variables SOCK_SERV_DIR or SOCK_SERV_%d (%d is the domain of the socket server). + + +1.2 Set up the Hurd components to build the virtual network. + +In this section, I show how to create two virtual interfaces and run three pfinet servers. I assume that the source code of Hurd is in /root/hurd. + +Step 4: create the network device file in /dev with devnode. +The network device file is used to help other translators open the device. + # settrans -acfg /dev/eth0 /root/hurd/devnode/devnode -d eth0 + +Step 5: create the virtual network device with eth-multiplexer. +eth-multiplexer is responsible to create the virtual network device and dispatch the packet to the right clients that connect to the virtual device. It also connects the virtual network and the external network. + # settrans -acfg /root/multiplexer /root/hurd/eth-multiplexer/eth-multiplexer -v 2 -i /dev/eth0 + +Step 6: create the network device files for the virtual network device with devnode. + # settrans -acfg /dev/veth0 /root/hurd/devnode/devnode -d veth0 -M /root/multiplexer + # settrans -acfg /dev/veth1 /root/hurd/devnode/devnode -d veth1 -M /root/multiplexer + +Step 7: setup the filter translator eth-filter on the network device. This step is optional. +eth-filter is used to set up the traffic policy on the network device. + # settrans -acfg /dev/fveth0 /root/hurd/eth-filter/eth-filter -i /dev/veth0 -S 192.168.8.0/24 -R 192.168.8.0/24 + # settrans -acfg /dev/fveth1 /root/hurd/eth-filter/eth-filter -i /dev/veth1 -S 192.168.8.0/24 -R 192.168.8.0/24 + +Step 8: setup the pfinet server on the virtual network device. + # settrans -afgc /root/socket0/2 /root/hurd/pfinet/pfinet -i /dev/fveth0 -a 192.168.8.10 -g 192.168.8.1 -m 255.255.255.0 + # settrans -afgc /root/socket1/2 /root/hurd/pfinet/pfinet -i /dev/fveth1 -a 192.168.8.11 -g 192.168.8.1 -m 255.255.255.0 + # settrans -afgc /root/socket2/2 /root/hurd/pfinet/pfinet -i /dev/fveth1 -a 192.168.8.12 -g 192.168.8.1 -m 255.255.255.0 + + +1.3 Run the command with the customized pfinet server. + +Step 9: Set environment variables to use the customized pfinet server. +The environment variable of SOCK_SERV_DIR is used to override all socket servers and SOCK_SERV_%d to override a specific socket server. %d after SOCK_SERV_ is the domain of the protocol that the socket server supports. The environment variable SOCK_SERV_%d has the higher priority than SOCK_SERV_DIR. + # export SOCK_SERV_2=/root/socket1/2 +If the modified glibc isn't installed as the system glibc, set LD_LIBRARY_PATH environment. + # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/the/path/of/glibc +We can run any command now, for example, ping. + +A SHELL script is provided to run all translators I mentioned automatically: http://www.assembla.com/spaces/VNetHurd/documents/c2W71ABser3AIxab7jnrAJ/download/runmultiplexer. To use this script, the user must specify the source of the hurd tree (the default value is /root/hurd) and the path of the servers (the default value is /root) where they should be created. This script is only used to test all translators I mentioned above and shows all steps to set up the virtual network. + + +2. Connect the subhurd with the main hurd. + +In the main hurd, we still need to do Step 1-9. +We run subhurd, + + # /root/hurd/boot/boot -f eth0=/dev/fveth0 -f eth1=/dev/fveth1 servers.boot /dev/hd1s1 + +In the subhurd, we do Step 1, 4, 8. +Step 4: # settrans -acfg /dev/veth0 /root/hurd/devnode/devnode -d veth0 +Step 8: # settrans -afgc /servers/socket/2 /root/hurd/pfinet/pfinet -i /dev/veth0 -a 192.168.8.20 -g 192.168.8.1 -m 255.255.255.0 + +Now we can communicate from the subhurd with any pfinet server of the main Hurd that runs in the virtual network. -- cgit v1.2.3