Changes between Version 1 and Version 2 of NetworkBridging
- Timestamp:
- 2011-03-24T10:44:58Z (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NetworkBridging
v1 v2 3 3 This is a simple DIY checklist for running HelenOS in QEMU/KVM and connecting its TCP/IP networking stack to a real physical ethernet LAN and possibly to the public Internet via this LAN. Please note that the functionality of the HelenOS TCP/IP stack is still severely limited (especially concerning the actual usability of the UDP and TCP protocols), but the situation should improve soon. 4 4 5 This checklist should work reasonably well with any recent GNU/Linux (2.6) distribution and QEMU/KVM 0.13.x on a IA-32 or AMD64 host system with a physical ethernet network card. Without any special arrangements you also need to have a root access on the host machine. If you have a substantially different software or hardware configuration than expected, your mileage may vary. 5 This checklist should work reasonably well with any recent GNU/Linux (2.6) distribution and QEMU/KVM 0.13.x on a IA-32 or AMD64 host system with a physical ethernet network card. Without any special arrangements you also need to have a root access on the host machine. If you have a substantially different software or hardware configuration than assumed by this checklist, you have to do the proper adjustments to the checklist. 6 7 '''Warning:''' Your mileage may vary! This checklist should not just be followed blindly. If you don't have a reasonable knowledge of your system and networking configuration, if you lack the basic understanding of the essential network technologies (i.e. terms such as ''MAC'', ''IP'', ''ethernet'', ''bridge'', etc.), if you are unfamiliar with the command line or if you are unable to understand shell scripts, then you can easily render your machine or (in the worst case) even your entire local network non-functional. The script examples presented here are in no way fail-safe and won't adapt on your environment if it substantially different than expected. 8 9 Just try not to be ignorant. If you end up stuck in a dead end, ask somebody who knows your local network environment (perhaps your network or systems administrator) for assistance. 6 10 7 11 == Prerequisites == 8 12 9 This checklist assumes that you have an ethernet device called ''eth0'' up and configured with an IP address (the IP address can be static or configured by a DHCP). You also need the ''brctl'' tool for creating and configuring virtual ethernet bridges (it usually comes in a package called ''bridge-utils'' or similar) as well as the usual Linux network management utilities (e.g. ''ip'' and friends). The bridges are software-defined ethernet network interface layer interconnections implemented in the Linux kernel, but for any practical purposes you can think about them as theusual ethernet switches or hubs.13 This checklist assumes that you have an ethernet device called ''eth0'' up and configured with an IP address (the IP address can be statically assigned or configured by a DHCP). You also need the ''brctl'' tool for creating and configuring virtual ethernet bridges (it usually comes in a package called ''bridge-utils'' or similar) as well as the usual Linux network management utilities (e.g. ''ip'', ''route'' and friends). The bridges are software-defined ethernet network interface layer interconnections implemented in the Linux kernel, for most practical purposes you can think about them as usual ethernet switches or hubs. 10 14 11 15 == Creating a bridge == … … 130 134 }}} 131 135 132 To create a bridge, just run manually this script and use the name of your physical ethernet device (which you want to be connected initially to the bridge) as the argument, e.g. 136 To create a bridge, just run manually this script and use the name of your physical ethernet device (which you want to be connected initially to the bridge) as the argument, e.g.: 133 137 134 138 {{{ … … 136 140 }}} 137 141 138 The script basically renames your physical ethernet device ''eth0'' to ''peth0'', creates a bridge device called ''eth0'' and moves all the usual IP configuration from ''peth0'' to ''eth0''. By doing this your host system is still going to have IP connectivity via a network device with the original name, but the physical ethernet device is going to work just as one (network interface layer) port of the bridge.139 140 '''Note 1:''' The creation of the bridge is a manual process (since you probably don't want to have this around all the time) and its configuration won't be stored persistently during reboots (unless you have some crazy AI-driven Linux distribution). But typically the existence of the bridge should be transparent to any networking applications you run on your host. 142 The script renames your physical ethernet device ''eth0'' to ''peth0'', creates a bridge device called ''eth0'' and moves all the usual IP configuration from ''peth0'' to ''eth0''. By doing this your host system is still going to have IP connectivity via a network device with the original name, but the physical ethernet device is going to behave like one port of the bridge (on the network interface layer). 143 144 '''Note 1:''' The creation of the bridge is a manual process (since you probably don't want to have this around all the time) and its configuration won't be stored persistently during reboots (unless you have some crazy AI-driven Linux distribution). But typically the existence of the bridge should be transparent to any networking applications you run on your host. If your Linux distribution has a good support for configuring the bridges persistently, you can certainly use your distribution's means and avoid this one-time script. 141 145 142 146 '''Note 2:''' The script has been tested only on IPv4 networks. It should work similarly with IPv6 or any other network protocol, but the script might require some tweaking. … … 144 148 == Connecting QEMU/KVM networking to the bridge == 145 149 146 In order for QEMU/KVM to be able to connect network interface of the virtual machine to the virtual bridge, you again need some scripts, but this time the scriptwill be executed by QEMU/KVM itself. First, store the main script into a convenient path (e.g. ''/etc/kvm/scripts/ifup''):150 In order for QEMU/KVM to be able to connect the network interface of the virtual machine to the virtual bridge, you again need some shell scripts. But this time the scripts will be executed by QEMU/KVM itself. First, store the main script into a convenient path (e.g. ''/etc/kvm/scripts/ifup''): 147 151 148 152 {{{ … … 180 184 == Configuring HelenOS networking == 181 185 182 HelenOS does not support any dynamic network configuration (e.g. via DHCP) so far. Thus, you need to configure the IP parameters for HelenOS manually prior to running it in QEMU/KVM. Just go to the ''uspace/srv/net/cfg'' directory in the HelenOS source tree and edit the ''ne2k'' configuration file according to your network parameters (you need to reserve an IP address statically for your HelenOS virtual machine). For example in my case I have to changethe following values:186 HelenOS does not support dynamic network configuration (e.g. via DHCP) so far. Thus, you need to configure the IP parameters for HelenOS manually prior to running it in QEMU/KVM. Just go to the ''uspace/srv/net/cfg'' directory in the HelenOS source tree and edit the ''ne2k'' configuration file according to your network parameters (you need to reserve an IP address statically for your HelenOS virtual machine, perhaps by asking your network administration to do so). For example, in my case I have to change the configuration to the following values: 183 187 184 188 {{{ … … 189 193 }}} 190 194 191 Compile HelenOS for IA-32 in ausual way.195 Compile HelenOS for IA-32 in the usual way. 192 196 193 197 == Running HelenOS in QEMU/KVM == 194 198 195 Finally, after all has been successfully configured and HelenOS compiled, you can run it with a command line similar to this one:199 Finally, after all has been successfully configured and HelenOS is compiled, you can run it with a command line similar to this one: 196 200 197 201 {{{ … … 205 209 }}} 206 210 207 '''Note 1:''' Please modify any of the QEMU/KVM options for your specific configuration (paths, etc.). It is probably also a good idea to change the MAC address of the virtual NE2000 card to a different value (just for the case that accidentally more peoplestart playing with this on the same LAN).208 209 '''Note 2:''' The ''-device ne2k_isa,irq=5,vlan=0'' and ''-net tap'' options are naturally essential for the correct functionality of the networking, you probably should not mess with them. Also please take note that currently in SMP virtual machines (with more than one CPU) the networking won't work.211 '''Note 1:''' Please modify any of the QEMU/KVM options for your specific configuration (paths, etc.). It is probably also a good idea to change the MAC address of the virtual NE2000 card to a different value (just for the case that more people accidentally start playing with this on the same LAN). 212 213 '''Note 2:''' The ''-device ne2k_isa,irq=5,vlan=0'' and ''-net tap'' options are essential for the correct functionality of the networking, you probably should not mess with them. Also please take note that the networking won't currently work in SMP virtual machines (with more than one CPU). 210 214 211 215 == Starting up networking in HelenOS ==