Commit 41d03949e198d4ac32cd42419e2b978fb89db461
1 parent
7c9d8e07
update
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1623 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
82 additions
and
38 deletions
Changelog
qemu-doc.texi
| ... | ... | @@ -247,29 +247,56 @@ Network options: |
| 247 | 247 | |
| 248 | 248 | @table @option |
| 249 | 249 | |
| 250 | -@item -n script | |
| 251 | -Set TUN/TAP network init script [default=/etc/qemu-ifup]. This script | |
| 252 | -is launched to configure the host network interface (usually tun0) | |
| 253 | -corresponding to the virtual NE2000 card. | |
| 250 | +@item -net nic[,vlan=n][,macaddr=addr] | |
| 251 | +Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n} | |
| 252 | += 0 is the default). The NIC is currently an NE2000 on the PC | |
| 253 | +target. Optionally, the MAC address can be changed. If no | |
| 254 | +@option{-net} option is specified, a single NIC is created. | |
| 255 | + | |
| 256 | +@item -net user[,vlan=n] | |
| 257 | +Use the user mode network stack which requires not administrator | |
| 258 | +priviledge to run. This is the default if no @option{-net} option is | |
| 259 | +specified. | |
| 260 | + | |
| 261 | +@item -net tap[,vlan=n][,fd=h][,ifname=name][,script=file] | |
| 262 | +Connect the host TAP network interface @var{name} to VLAN @var{n} and | |
| 263 | +use the network script @var{file} to configure it. The default | |
| 264 | +network script is @file{/etc/qemu-ifup}. If @var{name} is not | |
| 265 | +provided, the OS automatically provides one. @option{fd=h} can be | |
| 266 | +used to specify the handle of an already opened host TAP interface. Example: | |
| 254 | 267 | |
| 255 | -@item -nics n | |
| 268 | +@example | |
| 269 | +qemu linux.img -net nic -net tap | |
| 270 | +@end example | |
| 271 | + | |
| 272 | +More complicated example (two NICs, each one connected to a TAP device) | |
| 273 | +@example | |
| 274 | +qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \ | |
| 275 | + -net nic,vlan=1 -net tap,vlan=1,ifname=tap1 | |
| 276 | +@end example | |
| 256 | 277 | |
| 257 | -Simulate @var{n} network cards (the default is 1). | |
| 258 | 278 | |
| 259 | -@item -macaddr addr | |
| 279 | +@item -net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port] | |
| 260 | 280 | |
| 261 | -Set the mac address of the first interface (the format is | |
| 262 | -aa:bb:cc:dd:ee:ff in hexa). The mac address is incremented for each | |
| 263 | -new network interface. | |
| 281 | +Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual | |
| 282 | +machine using a TCP socket connection. If @option{listen} is | |
| 283 | +specified, QEMU waits for incoming connections on @var{port} | |
| 284 | +(@var{host} is optional). @option{connect} is used to connect to | |
| 285 | +another QEMU instance using the @option{listen} option. @option{fd=h} | |
| 286 | +specifies an already opened socket. | |
| 264 | 287 | |
| 265 | -@item -tun-fd fd | |
| 266 | -Assumes @var{fd} talks to a tap/tun host network interface and use | |
| 267 | -it. Read @url{http://bellard.org/qemu/tetrinet.html} to have an | |
| 268 | -example of its use. | |
| 288 | +Example: | |
| 289 | +@example | |
| 290 | +# launch a first QEMU instance | |
| 291 | +qemu linux.img -net nic -net socket,listen=:1234 | |
| 292 | +# connect the VLAN 0 of this instance to the VLAN 0 of the first instance | |
| 293 | +qemu linux.img -net nic -net socket,connect=127.0.0.1:1234 | |
| 294 | +@end example | |
| 269 | 295 | |
| 270 | -@item -user-net | |
| 271 | -Use the user mode network stack. This is the default if no tun/tap | |
| 272 | -network init script is found. | |
| 296 | +@item -net none | |
| 297 | +Indicate that no network devices should be configured. It is used to | |
| 298 | +override the default configuration which is activated if no | |
| 299 | +@option{-net} options are provided. | |
| 273 | 300 | |
| 274 | 301 | @item -tftp prefix |
| 275 | 302 | When using the user mode network stack, activate a built-in TFTP |
| ... | ... | @@ -327,13 +354,9 @@ telnet localhost 5555 |
| 327 | 354 | Then when you use on the host @code{telnet localhost 5555}, you |
| 328 | 355 | connect to the guest telnet server. |
| 329 | 356 | |
| 330 | -@item -dummy-net | |
| 331 | -Use the dummy network stack: no packet will be received by the network | |
| 332 | -cards. | |
| 333 | - | |
| 334 | 357 | @end table |
| 335 | 358 | |
| 336 | -Linux boot specific. When using this options, you can use a given | |
| 359 | +Linux boot specific: When using these options, you can use a given | |
| 337 | 360 | Linux kernel without installing it in the disk image. It can be useful |
| 338 | 361 | for easier testing of various kernels. |
| 339 | 362 | |
| ... | ... | @@ -521,7 +544,7 @@ show various information about the system state |
| 521 | 544 | |
| 522 | 545 | @table @option |
| 523 | 546 | @item info network |
| 524 | -show the network state | |
| 547 | +show the various VLANs and the associated devices | |
| 525 | 548 | @item info block |
| 526 | 549 | show the block devices |
| 527 | 550 | @item info registers |
| ... | ... | @@ -700,36 +723,49 @@ command (or @key{C-a s} in the serial console). |
| 700 | 723 | |
| 701 | 724 | @section Network emulation |
| 702 | 725 | |
| 703 | -QEMU simulates up to 6 networks cards (NE2000 boards). Each card can | |
| 704 | -be connected to a specific host network interface. | |
| 726 | +QEMU can simulate several networks cards (NE2000 boards on the PC | |
| 727 | +target) and can connect them to an arbitrary number of Virtual Local | |
| 728 | +Area Networks (VLANs). Host TAP devices can be connected to any QEMU | |
| 729 | +VLAN. VLAN can be connected between separate instances of QEMU to | |
| 730 | +simulate large networks. For simpler usage, a non priviledged user mode | |
| 731 | +network stack can replace the TAP device to have a basic network | |
| 732 | +connection. | |
| 733 | + | |
| 734 | +@subsection VLANs | |
| 705 | 735 | |
| 706 | -@subsection Using tun/tap network interface | |
| 736 | +QEMU simulates several VLANs. A VLAN can be symbolised as a virtual | |
| 737 | +connection between several network devices. These devices can be for | |
| 738 | +example QEMU virtual Ethernet cards or virtual Host ethernet devices | |
| 739 | +(TAP devices). | |
| 707 | 740 | |
| 708 | -This is the standard way to emulate network. QEMU adds a virtual | |
| 709 | -network device on your host (called @code{tun0}), and you can then | |
| 710 | -configure it as if it was a real ethernet card. | |
| 741 | +@subsection Using TAP network interfaces | |
| 742 | + | |
| 743 | +This is the standard way to connect QEMU to a real network. QEMU adds | |
| 744 | +a virtual network device on your host (called @code{tapN}), and you | |
| 745 | +can then configure it as if it was a real ethernet card. | |
| 711 | 746 | |
| 712 | 747 | As an example, you can download the @file{linux-test-xxx.tar.gz} |
| 713 | 748 | archive and copy the script @file{qemu-ifup} in @file{/etc} and |
| 714 | 749 | configure properly @code{sudo} so that the command @code{ifconfig} |
| 715 | 750 | contained in @file{qemu-ifup} can be executed as root. You must verify |
| 716 | -that your host kernel supports the TUN/TAP network interfaces: the | |
| 751 | +that your host kernel supports the TAP network interfaces: the | |
| 717 | 752 | device @file{/dev/net/tun} must be present. |
| 718 | 753 | |
| 719 | 754 | See @ref{direct_linux_boot} to have an example of network use with a |
| 720 | -Linux distribution. | |
| 755 | +Linux distribution and @ref{sec_invocation} to have examples of | |
| 756 | +command lines using the TAP network interfaces. | |
| 721 | 757 | |
| 722 | 758 | @subsection Using the user mode network stack |
| 723 | 759 | |
| 724 | -By using the option @option{-user-net} or if you have no tun/tap init | |
| 725 | -script, QEMU uses a completely user mode network stack (you don't need | |
| 726 | -root priviledge to use the virtual network). The virtual network | |
| 727 | -configuration is the following: | |
| 760 | +By using the option @option{-net user} (default configuration if no | |
| 761 | +@option{-net} option is specified), QEMU uses a completely user mode | |
| 762 | +network stack (you don't need root priviledge to use the virtual | |
| 763 | +network). The virtual network configuration is the following: | |
| 728 | 764 | |
| 729 | 765 | @example |
| 730 | 766 | |
| 731 | -QEMU Virtual Machine <------> Firewall/DHCP server <-----> Internet | |
| 732 | - (10.0.2.x) | (10.0.2.2) | |
| 767 | + QEMU VLAN <------> Firewall/DHCP server <-----> Internet | |
| 768 | + | (10.0.2.2) | |
| 733 | 769 | | |
| 734 | 770 | ----> DNS server (10.0.2.3) |
| 735 | 771 | | |
| ... | ... | @@ -738,7 +774,8 @@ QEMU Virtual Machine <------> Firewall/DHCP server <-----> Internet |
| 738 | 774 | |
| 739 | 775 | The QEMU VM behaves as if it was behind a firewall which blocks all |
| 740 | 776 | incoming connections. You can use a DHCP client to automatically |
| 741 | -configure the network in the QEMU VM. | |
| 777 | +configure the network in the QEMU VM. The DHCP server assign addresses | |
| 778 | +to the hosts starting from 10.0.2.15. | |
| 742 | 779 | |
| 743 | 780 | In order to check that the user mode network is working, you can ping |
| 744 | 781 | the address 10.0.2.2 and verify that you got an address in the range |
| ... | ... | @@ -755,6 +792,12 @@ When using the @option{-redir} option, TCP or UDP connections can be |
| 755 | 792 | redirected from the host to the guest. It allows for example to |
| 756 | 793 | redirect X11, telnet or SSH connections. |
| 757 | 794 | |
| 795 | +@subsection Connecting VLANs between QEMU instances | |
| 796 | + | |
| 797 | +Using the @option{-net socket} option, it is possible to make VLANs | |
| 798 | +that span several QEMU instances. See @ref{sec_invocation} to have a | |
| 799 | +basic example. | |
| 800 | + | |
| 758 | 801 | @node direct_linux_boot |
| 759 | 802 | @section Direct Linux Boot |
| 760 | 803 | ... | ... |