Solaris has a build in clone device and knowledgeable users probably have already seen such "le0:1" pseudo devices.
Since modload is broken on SunOS 4.1.1 we'll plug VIF statically into the kernel. This is not too complicated.
Disadvantage: you cannot modunload the driver.
Advantage: you cannot modunload the driver while being in use, which surely crashes the machine.
gzcat vif-1.11.tar.gz | tar xvf - cd vif-1.11Edit the file if_vif.c
vi if_vif.cRight after the line reading
#include "vif.h"add the following:
#if NVIF > 0and add a corresponding
#endifat the very end of the file.
Copy the driver source to /sys/net
cp if_vif.c /sys/net/Next, add the following line to /sys/conf.common/files.cmn:
net/if_vif.c optional vifA good place would be right before the entry for net/if.c.
Edit /sys/sun/conf.c and add the stubb for the device. Add this after the definition for the graphics accellerator (NGAONE):
#include "vif.h" #if NVIF > 0 int vif_open(),vif_close(),vif_read(), vif_write(),vif_ioctl(),vif_select(); #else #define vif_open nodev #define vif_close nodev #define vif_read nodev #define vif_write nodev #define vif_ioctl nodev #define vif_select nodev #endifThen use entry #14 (formerly cgone) in the cdevsw-structure and modify it to:
{ vif_open, vif_close, vif_read, vif_write, /*14*/ vif_ioctl, nodev, vif_select, 0, /* was cgone */ 0, },The major device number of the virtual ethernet interfaces will be 14 now!
Last, but not least, add this line to your kernel config file:
pseudo-device vif8A good place would be behind the other pseudo devices and right before the comments for the "config vmunix" line.
You can change the number behind the "vif" as needed. I'd recommend not to use more than 10 virtual ethernet interfaces, since netstat is broken and will show these interfaces in a "funny" way.
Config your kernel, install it and reboot. Then create the devices:
cd /dev mknod vif0 c 14 0 mknod vif1 c 14 1 mknod vif2 c 14 2 mknod vif3 c 14 3 mknod vif4 c 14 4 mknod vif5 c 14 5 mknod vif6 c 14 6 mknod vif7 c 14 7 : : :
127.0.0.1 localhost 192.68.1.1 myhost # this is my host 192.68.1.2 othername # another name for my hostAdd an arp-entry:
arp -s othername 8:0:20:0:1b:a5 pubInit the devices (important!):
echo >/dev/vif0Config the device:
ifconfig vif0 othername upEnjoy!
ifconfig vif0 down arp ... ifconfig vif0 upIf you wanto to see if it's working, type:
netstat -ian netstat -rn ifconfig -a arp -aIf everything looks ok, try to ping and then telnet to the new address from another machine.
To find out the ethernet address of your machine, ping it from another machine and read its arp-table:
# ping myhost # arp -a : myhost (123.234.56.78) at 8:0:20:0:1b:a5 : ^^^^ here ^^^^