Slirp is a software program that emulates a PPP, SLIP, or CSLIP connection to the Internet via a shell account. The original version has been written by Danny Gasparovski in 1995. It has been integrated in QEMU to provide user mode networking. Now a port of the QEMU Slirp implementation is available in Bochs.
Features and limitations:
Access to the internet and host network services without root/Administrator privileges or additional libraries.
Builtin DHCP and TFTP servers
Optional SMB support on Linux
ICMP traffic (ping) from guest to the host's network or the internet not supported
guest access from the host or external network disabled by default
This example shows how to use the 'slirp' module with the NE2000 adapter. The line is very similar for the E1000 or PCI Pseudo NIC.
ne2k: mac=52:54:00:12:34:56, ethmod=slirp, ethdev=/home/volker/tests/bochs, script=""The "ethdev" value specifies the TFTP root directory. All other options for Slirp must be set in a config file specified with "script" parameter. If no config file is set up, Bochs uses this "classic" Slirp configuration shown in the "Default" column below.
An example for a Slirp config file can be found in the Bochs sources and in binary packages (misc/slirp.conf).
Table 9-2. Slirp config file options
Option | Description | Default value |
---|---|---|
restricted | if set to 1, only built-in services are available | 0 |
net | base IP address of the virtual network | 10.0.2.0 |
mask | netmask of the virtual network | 255.255.255.0 |
host | IP address of the DHCP and TFTP server | 10.0.2.2 |
hostname | DHCP client hostname | undefined |
dhcpstart | start address of DHCP pool | 10.0.2.15 |
dns | IP address of the virtual DNS server | 10.0.2.3 |
bootfile | boot filename returned by DHCP | undefined |
dnssearch | comma-separated list of DNS suffixes to search (DHCP extension) | undefined |
smb_export | absolute path to the shared folder (non-Windows SMB support) | undefined |
smb_srv | alternative IP address of the SMB server | 10.0.2.4 |
hostfwd | map guest port to host port for host-to-guest access (see below for details) | undefined |
pktlog | specify log file to enable packet logging in text format | disabled |
With the config file option "hostfwd" you can map guest ports to ports on the host system. This is the format of the directive:
hostfwd = protocol:hostaddr:hostport-guestaddr:guestport
The host and guest IP addresses are optional. This example shows how to access
the guest SSH server using the host port 12345.
hostfwd = tcp::12345-:22Up to 5 port redirection rules are supported per slirp instance.