N3vlr-rootfs

Installation
Download N3VLR image from http://www.n3network.ch/resources/n3vlr/n3vlr-0.11-uml.tar.bz2

Extract the rootfs image: tar xvfj n3vlr-0.11-uml.tar.bz2

Copy the original rootfs image to a new file and mount it :

cp n3vlr-0.11-uml.img n3vlr-0.11-vnuml.img mount -o loop n3vlr-0.11-vnuml.img /mnt/

Create vnuml directories and umlboot link: mkdir /mnt/mnt/vnuml mkdir /mnt/mnt/hostfs ln -s /mnt/vnuml/umlboot /mnt/etc/init.d/S40bootuml echo "/dev/ubdb    /mnt/vnuml iso9660     defaults    0 0" >> /mnt/etc/fstab

Change the content of /mnt/etc/inittab to:

tty0::respawn:/sbin/getty 38400 tty0 tty1::respawn:/sbin/getty 38400 tty1 tty2::respawn:/sbin/getty 38400 tty2 ::ctrlaltdel:/sbin/halt

Create the /dev/ubd[a-h] nodes using the makeUBDdev.sh script (see the complete script below taken from http://www.theshore.net/~caker/uml/)

cd /mnt/dev makeUBDdev.sh

Change root password:

chroot /mnt /bin/ash passwd root (set password to xxxx) exit

Edit the file /mnt/etc/ssh/sshd_config in order to make it work with ssh v1: Port 22 Protocol 2,1 HostKey /etc/ssh/ssh_host_key HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key UsePrivilegeSeparation yes KeyRegenerationInterval 3600 ServerKeyBits 768 SyslogFacility AUTH LogLevel INFO LoginGraceTime 120 PermitRootLogin yes StrictModes yes RSAAuthentication yes PubkeyAuthentication yes IgnoreRhosts yes RhostsRSAAuthentication no HostbasedAuthentication no PermitEmptyPasswords no ChallengeResponseAuthentication no X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server UsePAM yes
 * 1) What ports, IPs and protocols we listen for
 * 1) HostKeys for protocol version 1
 * 1) HostKeys for protocol version 2
 * 1) Privilege Separation is turned on for security
 * 1) Lifetime and size of ephemeral version 1 server key
 * 1) Logging
 * 1) Authentication:
 * 1) Don't read the user's ~/.rhosts and ~/.shosts files
 * 1) For this to work you will also need host keys in /etc/ssh_known_hosts
 * 1) similar for protocol version 2
 * 1) To enable empty passwords, change to yes (NOT RECOMMENDED)
 * 1) Change to yes to enable challenge-response passwords (beware issues with
 * 2) some PAM modules and threads)
 * 1) UseLogin no
 * 2) Allow client to pass locale environment variables

Install bash shell in mini rootfs: chroot ~/tmp /bin/ash ipkg install bash_3.2-1_i386.ipk exit cp ~/tmp/bin/bash /mnt/bin/ cp ~/tmp/lib/libgcc_s.so.1 /mnt/lib umount ~/tmp Change the content of /mnt/etc/passwd to:
 * 1) Download from http://downloads.openwrt.org/kamikaze/7.09/x86-2.6/ the file openwrt-x86-2.6-ext2.fs and mount in ~/tmp ,for example.
 * 2) Download from http://downloads.openwrt.org/kamikaze/packages/i386/ the package bash_3.2-1_i386.ipk
 * Do

root:$1$Yq7hudHO$r1rNwGNrK1470rWb5Qwu51:0:0:root:/tmp:/bin/bash nobody:*:65534:65534:nobody:/var:/bin/false sshd:x:99:99:sshd:/var/empty/.sshd:/bin/false quagga:x:100:100:quagga:/var/empty/.quagga:/bin/false

Create symbolic links to have quagga daemons accesible through the same path than root_fs_tutorial:

cd usr/lib/ mkdir quagga cd quagga/ ln -s /usr/sbin/zebra ln -s /usr/sbin/ospfd ln -s /usr/sbin/ospf6d ln -s /usr/sbin/ripd ln -s /usr/sbin/ripngd ln -s /usr/sbin/bgpd

Create /etc/root_fs-version with content:

n3vlr-0.11-vnuml-v0.1

Unmount the filesystem:

umount /mnt

Notes:


 * 1) In order to use this mini rootfs, you must apply the patch that includes the  following changes:
 * 2) Replacement of the command line in shell scripts because lots of filesystem don't include that command.
 * 3) Replacement of the uml_console command cad because it doesn't work with this mini rootfs.
 * 4) Shell. You have to force the shell to be used by vnuml in the virtual machine to /bin/bash with:  /bin/bash 
 * 5) The directory of demons is usr/sbin/. You can try this mini rootfs with these examples:
 * 6) Example-OSPF (ospf_lab.xml, ospf_lab_tiny.xml, ospf_lab_conf.tar)
 * 7) Example-BGP (bgp.xml, bgp.tar)

makeUBDdev.sh script
device=ubd major=98 minor=0 for u in a b c d e f g h        do dev=$device$u mknod $dev b $major $minor chmod 660 $dev chgrp disk $dev for i in $(seq 1 15) do                 mknod $dev$i b $major $(($minor + $i)) chmod 660 $dev$i chgrp disk $dev$i done minor=$(($minor + 16)) done
 * 1) !/bin/bash