diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-06-24 14:42:28 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-29 08:52:44 -0500 |
commit | ad196a9d0c14f681f010bb4b979030ec125ba976 (patch) | |
tree | 0655e9af27aee23adec993cdb971a8b8294bd27e /qemu-options.hx | |
parent | 5db4af8bc8eb99333b0d2be1f88c943353361e50 (diff) | |
download | qemu-ad196a9d0c14f681f010bb4b979030ec125ba976.zip |
slirp: Move smb, redir, tftp and bootp parameters and -net channel
So far a couple of slirp-related parameters were expressed via
stand-alone command line options. This it inconsistent and unintuitive.
Moreover, it prevents both dynamically reconfigured (host_net_add/
delete) and multi-instance slirp.
This patch refactors the configuration by turning -smb, -redir, -tftp
and -bootp as well as -net channel into options of "-net user". The old
stand-alone command line options are still processed, but no longer
advertised. This allows smooth migration of management applications to
to the new syntax and also the extension of that syntax later in this
series.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-options.hx')
-rw-r--r-- | qemu-options.hx | 209 |
1 files changed, 111 insertions, 98 deletions
diff --git a/qemu-options.hx b/qemu-options.hx index fb1e7a65e1..d1c1539e21 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -735,13 +735,27 @@ STEXI @table @option ETEXI +HXCOMM Legacy slirp options (now moved to -net user): +#ifdef CONFIG_SLIRP +DEF("tftp", HAS_ARG, QEMU_OPTION_tftp, "") +DEF("bootp", HAS_ARG, QEMU_OPTION_bootp, "") +DEF("redir", HAS_ARG, QEMU_OPTION_redir, "") +#ifndef _WIN32 +DEF("smb", HAS_ARG, QEMU_OPTION_smb, "") +#endif +#endif + DEF("net", HAS_ARG, QEMU_OPTION_net, "-net nic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]\n" " create a new Network Interface Card and connect it to VLAN 'n'\n" #ifdef CONFIG_SLIRP - "-net user[,vlan=n][,name=str][,hostname=host]\n" - " connect the user mode network stack to VLAN 'n' and send\n" - " hostname 'host' to DHCP clients\n" + "-net user[,vlan=n][,name=str][ip=netaddr][,restrict=y|n][,hostname=host]\n" + " [,tftp=dir][,bootfile=f][,redir=rule][,channel=rule]" +#ifndef _WIN32 + "[,smb=dir]\n" +#endif + " connect the user mode network stack to VLAN 'n', configure its\n" + " DHCP server and enabled optional services\n" #endif #ifdef _WIN32 "-net tap[,vlan=n][,name=str],ifname=name\n" @@ -794,13 +808,102 @@ Valid values for @var{type} are Not all devices are supported on all targets. Use -net nic,model=? for a list of available devices for your target. -@item -net user[,vlan=@var{n}][,hostname=@var{name}][,name=@var{name}] +@item -net user[,@var{option}][,@var{option}][,...] Use the user mode network stack which requires no administrator -privilege to run. @option{hostname=name} can be used to specify the client -hostname reported by the builtin DHCP server. +privilege to run. Valid options are: + +@table @code +@item vlan=@var{n} +Connect user mode stack to VLAN @var{n} (@var{n} = 0 is the default). + +@item name=@var{name} +Assign symbolic name for use in monitor commands. + +@item ip=@var{netaddr} +Set IP network address the guest will see (default: 10.0.2.x). + +@item restrict=y|yes|n|no +If this options is enabled, the guest will be isolated, i.e. it will not be +able to contact the host and no guest IP packets will be routed over the host +to the outside. This option does not affect explicitly set forwarding rule. + +@item hostname=@var{name} +Specifies the client hostname reported by the builtin DHCP server. + +@item tftp=@var{dir} +When using the user mode network stack, activate a built-in TFTP +server. The files in @var{dir} will be exposed as the root of a TFTP server. +The TFTP client on the guest must be configured in binary mode (use the command +@code{bin} of the Unix TFTP client). The host IP address on the guest is +10.0.2.2 by default. + +@item bootfile=@var{file} +When using the user mode network stack, broadcast @var{file} as the BOOTP +filename. In conjunction with @option{tftp}, this can be used to network boot +a guest from a local directory. + +Example (using pxelinux): +@example +qemu -hda linux.img -boot n -net user,tftp=/path/to/tftp/files,bootfile=/pxelinux.0 +@end example + +@item smb=@var{dir} +When using the user mode network stack, activate a built-in SMB +server so that Windows OSes can access to the host files in @file{@var{dir}} +transparently. + +In the guest Windows OS, the line: +@example +10.0.2.4 smbserver +@end example +must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me) +or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000). + +Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}. + +Note that a SAMBA server must be installed on the host OS in +@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd versions from +Red Hat 9, Fedora Core 3 and OpenSUSE 11.x. + +@item redir=[tcp|udp]:@var{host-port}:[@var{guest-host}]:@var{guest-port} +Redirect incoming TCP or UDP connections to the host port @var{host-port} to +the guest @var{guest-host} on guest port @var{guest-port}. If @var{guest-host} +is not specified, its value is 10.0.2.15 (default address given by the built-in +DHCP server). If no connection type is specified, TCP is used. This option can +be given multiple times. + +For example, to redirect host X11 connection from screen 1 to guest +screen 0, use the following: + +@example +# on the host +qemu -net user,redir=tcp:6001::6000 [...] +# this host xterm should open in the guest X11 server +xterm -display :1 +@end example + +To redirect telnet connections from host port 5555 to telnet port on +the guest, use the following: + +@example +# on the host +qemu -net user,redir=tcp:5555::23 [...] +telnet localhost 5555 +@end example + +Then when you use on the host @code{telnet localhost 5555}, you +connect to the guest telnet server. -@item -net channel,@var{port}:@var{dev} -Forward @option{user} TCP connection to port @var{port} to character device @var{dev} +@item channel=@var{port}:@var{dev} +Forward guest TCP connections to port @var{port} on the host to character +device @var{dev}. This option can be given multiple times. + +@end table + +Note: Legacy stand-alone options -tftp, -bootp, -smb and -redir are still +processed and applied to -net user. Mixing them with the new configuration +syntax gives undefined results. Their use for new applications is discouraged +as they will be removed from future versions. @item -net tap[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}] Connect the host TAP network interface @var{name} to VLAN @var{n}, use @@ -906,96 +1009,6 @@ libpcap, so it can be analyzed with tools such as tcpdump or Wireshark. Indicate that no network devices should be configured. It is used to override the default configuration (@option{-net nic -net user}) which is activated if no @option{-net} options are provided. -ETEXI - -#ifdef CONFIG_SLIRP -DEF("tftp", HAS_ARG, QEMU_OPTION_tftp, \ - "-tftp dir allow tftp access to files in dir [-net user]\n") -#endif -STEXI -@item -tftp @var{dir} -When using the user mode network stack, activate a built-in TFTP -server. The files in @var{dir} will be exposed as the root of a TFTP server. -The TFTP client on the guest must be configured in binary mode (use the command -@code{bin} of the Unix TFTP client). The host IP address on the guest is as -usual 10.0.2.2. -ETEXI - -#ifdef CONFIG_SLIRP -DEF("bootp", HAS_ARG, QEMU_OPTION_bootp, \ - "-bootp file advertise file in BOOTP replies\n") -#endif -STEXI -@item -bootp @var{file} -When using the user mode network stack, broadcast @var{file} as the BOOTP -filename. In conjunction with @option{-tftp}, this can be used to network boot -a guest from a local directory. - -Example (using pxelinux): -@example -qemu -hda linux.img -boot n -tftp /path/to/tftp/files -bootp /pxelinux.0 -@end example -ETEXI - -#ifndef _WIN32 -DEF("smb", HAS_ARG, QEMU_OPTION_smb, \ - "-smb dir allow SMB access to files in 'dir' [-net user]\n") -#endif -STEXI -@item -smb @var{dir} -When using the user mode network stack, activate a built-in SMB -server so that Windows OSes can access to the host files in @file{@var{dir}} -transparently. - -In the guest Windows OS, the line: -@example -10.0.2.4 smbserver -@end example -must be added in the file @file{C:\WINDOWS\LMHOSTS} (for windows 9x/Me) -or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windows NT/2000). - -Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}. - -Note that a SAMBA server must be installed on the host OS in -@file{/usr/sbin/smbd}. QEMU was tested successfully with smbd version -2.2.7a from the Red Hat 9 and version 3.0.10-1.fc3 from Fedora Core 3. -ETEXI - -#ifdef CONFIG_SLIRP -DEF("redir", HAS_ARG, QEMU_OPTION_redir, \ - "-redir [tcp|udp]:host-port:[guest-host]:guest-port\n" \ - " redirect TCP or UDP connections from host to guest [-net user]\n") -#endif -STEXI -@item -redir [tcp|udp]:@var{host-port}:[@var{guest-host}]:@var{guest-port} - -When using the user mode network stack, redirect incoming TCP or UDP -connections to the host port @var{host-port} to the guest -@var{guest-host} on guest port @var{guest-port}. If @var{guest-host} -is not specified, its value is 10.0.2.15 (default address given by the -built-in DHCP server). If no connection type is specified, TCP is used. - -For example, to redirect host X11 connection from screen 1 to guest -screen 0, use the following: - -@example -# on the host -qemu -redir tcp:6001::6000 [...] -# this host xterm should open in the guest X11 server -xterm -display :1 -@end example - -To redirect telnet connections from host port 5555 to telnet port on -the guest, use the following: - -@example -# on the host -qemu -redir tcp:5555::23 [...] -telnet localhost 5555 -@end example - -Then when you use on the host @code{telnet localhost 5555}, you -connect to the guest telnet server. @end table ETEXI |