
How to use networking with Ski in kernel mode
Copyright (c) 2000, 2003 Hewlett-Packard Company
Stéphane Eranian
I. Introduction
The goal of this document is to explain how to enable networking when
running the Linux/ia64 kernel on top of Ski.
Ski allows a Linux/ia64 kernel to get access to real-world
networking. The kernel run by Ski is given its own IP address and can
therefore be clearly distinguished from the IP address of the host
machine. We use Ethernet as the low-level interface. Using a special
Ethernet driver in the simulated kernel we are able to read/write raw
Ethernet frames from/to the real host interface. With this in place,
ftp, rlogin, NFS and web traffic are possible and provided with full
transparency at the user level, i.e., we don't need to modify any
network applications.
II. Requirements
Here is a short list of the components needed:
- Ski simulator (/usr/bin/ski).
- a Linux/ia64 kernel image compiled for use with the HP-simulator
- a sample diskimage containing a mini root file system
- a host machine running linux-2.1.xx or greater
- a host machine with at least one Ethernet network interface
III. How does this work ?
Just like Ski simulates a serial console using an xterm
and a SCSI disk using a disk file, it simulates networking by
providing raw access to the host Ethernet interface.
We provide a distinct IP address for the simulated kernel. So you
have two IP addresses bound to the same link-level address. Now, the
host machine's kernel needs to dispatch frames to either the simulated
kernel (via Ski) or to itself. For this purposes, Ski installs a
Berkeley Packet Filter into the kernel. This filter will direct all
broadcast frames (such as ARP requests) to both the simulated kernel
and host kernel. Frames with a specific destination address are
dispatched either to the host kernel or to the simulated kernel, as
indicated by the IP address.
The simulated kernel has a special Ethernet driver, called
simeth, which is designed to interface with Ski to read/write
raw Ethernet frames. This driver is interrupt driven like a normal
Ethernet driver. Ski uses SIGIO to get asynchronous
notifications when an Ethernet frame is available. To get raw frames
in the simulator, Ski uses the SOCK_PACKET type supported by
Linux. The interface is also put in promiscuous mode to get all the
traffic. The following figure summarizes the complete architecture:
|---------------------------------------------------
| |
| |--------------------| |
| | Linux/ia64 process | |
| |--------------------| |
| |----------------------------------------------| |
| | net intr | |
| | Linux/ia64 kernel |------------| ^ | |
| | | simeth | |eth0(IP2) | |
| |-----------------------------------|----------| |
| | interrupt |
|-- --- --- -- -- -- -- -- -- | -- -- -- |
| | |
| Ski simulator /->RR[x] |
| / |
|----------------------------------\---------------|
/ SIGIO
|----------------------------------|---------------|
| <-----\ / |
| host Linux kernel IP1|BCAST\ / IP2|BCAST |
| |eth0(IP1/promisc)|
|--------------------------------|-----------------|
|
| Ethernet network
-------------------------------|---------------
IV. Configuring the host system
Most of the time you won't need to configure anything on your host
system because most distributors ship their kernel with the correct
set of options enabled by default.
To get networking support with ski in kernel mode, your host kernel
must have been compiled with the following options:
- CONFIG_FILTER: support for packet filters
- CONFIG_PACKET: support for raw sockets
The CONFIG_FILTER option is either built-in or not, i.e., there is no
module option. Most of the time it is compiled in by default.
The CONFIG_PACKET option is usually a module. So before running Ski
with networking, make sure you either have built-in support or the
module is loaded into the kernel via insmod or modprobe.
Of course you must have at least one Ethernet interface on your
system.
V. How to launch the simulator with networking
Networking is enabled in Ski by default. However, if for some
reason you want to disable networking support, you can launch Ski with
option -nonet.
Because Ski needs access to raw sockets, the simulator must
be run as root. For security reasons, we do not recommended to
install the simulator setuid root (it is not shipped this
way). Instead, we recommend using a command like sudo or
equivalent to run with networking enabled.
Here is how root would typically start the kernel with networking
enabled:
# ski bootloader vmlinux simeth=eth0
The simulated Ethernet driver (simeth) accepts one option:
simeth=. This informs the driver which host interface to
use. The default is eth0. On system with more than one
interface, one can imagine using the second card, eth1, for
Ski. A good reason for doing this is to address performance
concerns. Remember that the interface is put in promiscuous mode which
can be a CPU hog on busy networks. So if you have an alternative
interface on a quieter network, you can use this option. The option is
also useful if the host Ethernet interface name is different from
ethX, like for instance with Wavelan cards which use
wvlanX instead of ethX.
VI. How to configure the simulated kernel ?
First of all, the simulated kernel must be configured to run on
the HP simulator. You do this this as follows (shown with a 2.4.1
kernel):
$ make config
rm -f include/asm
( cd include ; ln -sf asm-ia64 asm)
/bin/sh scripts/Configure arch/ia64/config.in
#
# Using defaults found in .config
#
*
* Code maturity level options
*
Prompt for development and/or incomplete code/drivers (CONFIG_EXPERIMENTAL) [Y/n/?]
*
* Loadable module support
*
Enable loadable module support (CONFIG_MODULES) [N/y/?]
*
* General setup
*
IA-64 system type (generic, DIG-compliant, HP-simulator, SGI-SN1) [HP-simulator]
Next, you need to enable the simulated devices: simulated serial
console, simulated scsi disk and, optionally, the simulated ethernet
driver.
Of course to get networking, you must also have TCP/IP stack enabled.
...
*
* Simulated drivers
*
Simulated Ethernet (CONFIG_SIMETH) [Y/n/?]
Simulated serial driver support (CONFIG_SIM_SERIAL) [Y/n/?]
Simulated SCSI disk (CONFIG_SCSI_SIM) [Y/n/?]
....
You don't need any PCI, ISA nor EISA support enabled to get a
working kernel.
VII. How to configure the simulated interface ?
If you launch the simulator as described above, you should get
a "console" output similar to what follows (shown with linux-2.4.1):
loading vmlinux...
starting kernel...
On node 0 totalpages: 8448
zone(0): 8448 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: simscsi=./sd
fpswa interface at 0
CPU 0: base freq=200.000MHz, ITC ratio=1/100, ITC freq=2.000MHz
Calibrating delay loop... 1.30 BogoMIPS
Memory: 61584k/67584k available (2054k code, 3952k reserved, 530k data, 72k init)
Dentry-cache hash table entries: 8192 (order: 4, 131072 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 8192 bytes)
Page-cache hash table entries: 8192 (order: 3, 65536 bytes)
Inode-cache hash table entries: 4096 (order: 3, 65536 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
PAL Information Facility v0.3
Starting kswapd v1.8
pty: 256 Unix98 ptys configured
block: queued sectors max/low 40576kB/13525kB, 128 slots per queue
SimSerial driver version 0.6 with no serial options enabled
ttyS00 at 0x03f8 (irq = 48) is a 16550
EFI Time Services Driver v0.2
simeth: v0.2 alpha
eth0: hosteth=eth0 simfd=4, HwAddr 00 10 a4 0a 6c d1, IRQ 49
SCSI subsystem driver Revision: 1.00
scsi0 : simulated SCSI host adapter
Vendor: HP Model: SIMULATED DISK Rev: 0.00
Type: Direct-Access ANSI SCSI revision: 02
Detected scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 2097152 512-byte hdwr sectors (1074 MB)
Partition check:
sda: sda1
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 8Kbytes
TCP: Hash tables configured (established 4096 bind 4096)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 72kB freed
From now on, it's just like a normal Ethernet interface. You can
use ifconfig, route and all the usual tools to configure networking.
Ftp, rlogin, telnet in and out are working. They may need some
slight configuration, though. NFS client is known to be working.
VIII. Current limitations
- You can have only one Ski per network interface.
- The simeth driver and Ski do not support more than one
network interface.
- The simeth driver cannot be built as a module.
- In case you interrupt the execution of the simulator, you may
still have the Ethernet interface left in promiscuous mode.
To turn this off, simply issue:
# ifconfig -promisc ethX
where X is the interface number you were using.
|