2007年11月6日火曜日

using lguest - 3

先日のネットワーク絵の設定。debian パッケージでは bridge-utils と vlan あたり。vlan パッケージ入れて vlan-interfaces (5) を見ると /etc/network/interfaces で vlan の設定ができるらしい。そうそう先日の絵で eth1.1 なんて書いていたが

/opt/lguest# vconfig add eth1 1
Added VLAN with VID == 1 to IF -:eth1:-
WARNING: VLAN 1 does not work with many switches,
consider another number if you have problems.
なんて言われるので eth1.10 と eth1.11 にしてしまった。肝心の /etc/network/interfaces は以下の通り
auto eth1.10
iface eth1.10 inet static
# vlan-raw-device eth1
address 172.27.129.1
broadcast 172.27.129.255
netmask 255.255.255.0
iface eth1.10 inet6 static
address fec0:0:0:1b81:201:8eff:feb3:84d8
netmask 64

auto br0
iface br0 inet static
pre-up brctl addbr $IFACE
address 192.168.0.3
netmask 255.255.255.0
post-down brctl delbr $IFACE

auto br1
iface br1 inet manual
pre-up brctl addbr $IFACE
post-up ip link set $IFACE up
pre-down ip link set $IFACE down
post-down brctl delbr $IFACE
auto br2
iface br2 inet manual
pre-up brctl addbr $IFACE
post-up ip link set $IFACE up
pre-down ip link set $IFACE down
post-down brctl delbr $IFACE

auto eth1.11
iface eth1.11 inet manual
post-up brctl addif br1 $IFACE
post-up ip link set $IFACE up
pre-down ip link set $IFACE down
pre-down brctl delif br1 $IFACE
まぁ IPv6 はご愛嬌。これで lguest を
./lguest 64m /usr/src/stable/vmlinux --block=FW1.img --block=FW1.swap root=/dev/lgba \
--tunnet=bridge:br0 --tunnet=bridge:br1 --tunnet=bridge:br2
と起動するとゲスト FW1 FW2 では eth0 eth1 eth2 が見える。こちらも以前書いたが、これらに対応するホスト側は (ユーザスペースコマンドの) lguest で tap# を作って、それぞれのブリッジインターフェースに addif してくれる。

通信できることはできるのだけど、とっても気になるのが eth1 での 802.1q。ホント喋っているのか tcpdump で確認できず。もう少々要確認ってトコ。

2007年11月1日木曜日

ネットワーク絵


目指すはっ。と構えるほど大それたものではないが、絵としては この辺り に近い構成を host と guest で作成して色々試そうかと。大きな四角がホストで中の小さな二つの四角がゲスト。赤太字がインターフェースで○はアドレスを持つ。実際の設定は....後日。

2007年10月31日水曜日

....

会ったことも無く当然私などを知っているはずは無いが、おこがましくも尊敬する itojun さんが亡くなられたとのおはなし。自身の語彙不足を今更ながら恨めしく....心からのご冥福をお祈りします。

2007年10月30日火曜日

using lguest - 2

ちょっと使えるようになるまで、また jot。
/opt/lguest# mount -t ext3 -o loop FW1.img tmp
/opt/lguest# chroot tmp
/# apt-get install udev iproute less
Reading package lists... Done
Building dependency tree... Done
....
/# cat >> /etc/fstab
proc /proc proc defaults 0 0
/dev/lgba / ext3 defaults,errors=remount-ro 0 1
/dev/lgbb none swap sw 0 0
/# cat > /etc/resolv.conf
nameserver 192.168.0.3
/# cat >> /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.3
/#
/# cat > /etc/hostname
fw1
/# exit
/opt/lguest# dd if=/dev/zero of=FW1.swap bs=1 count=1 seek=$((1024 * 1024 * 128 - 1))
1+0 records in
1+0 records out1+0 records in
1+0 records out
1 byte (1 B) copied, 0.000128516 seconds, 7.8 kB/s
/opt/lguest# mkswap FW1.swap
Setting up swapspace version 1, size = 134213 kB
no label, UUID=69713635-6d63-4cd9-b0da-96d1eb7fe561
/opt/lguest# brctl addbr br0
/opt/lguest# ip addr add 192.168.0.3/24 dev br0
/opt/lguest# ip link set br0 up
/opt/lguest# umount tmp
/opt/lguest# ./lguest 64m /usr/src/stable/vmlinux --block=FW1.img --block=FW1.swap root=/dev/lgba --tunnet=bridge:br0
....
Debian GNU/Linux lenny/sid fw1 /dev/hvc0

fw1 login: root
Last login: Tue Oct 30 14:08:48 UTC 2007 on hvc0
Linux fw1 2.6.23.1 #1 Wed Oct 17 13:58:03 JST 2007 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
fw1:~#
fw1:~# ping -c3 192.168.0.3
PING 192.168.0.3 (192.168.0.3) 56(84) bytes of data.
64 bytes from 192.168.0.3: icmp_seq=1 ttl=64 time=7.64 ms
64 bytes from 192.168.0.3: icmp_seq=2 ttl=64 time=0.266 ms
64 bytes from 192.168.0.3: icmp_seq=3 ttl=64 time=0.262 ms

--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.262/2.724/7.644/3.478 ms
fw1:~# mount
/dev/lgba on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
procbususb on /proc/bus/usb type usbfs (rw)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fw1:~# swapon -s
Filename Type Size Used Priority
/dev/lgbb partition 131064 0 -1
fw1:~# apt-get update
Get:1 http://ring.asahi-net.or.jp lenny Release.gpg [189B]
Hit http://ring.asahi-net.or.jp lenny Release
Get:2 http://ring.asahi-net.or.jp lenny/main Packages/DiffIndex [2038B]
Fetched 2227B in 2s (989B/s)
Reading package lists... Done
fw1:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
fw1:~# apt-get install ssh deborphan
....
fw1:~# useradd -d /home/chamaken -G users chamaken -m
fw1:~# passwd chamaken
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
fw1:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/lgba 2.0G 266M 1.7G 14% /
tmpfs 30M 0 30M 0% /lib/init/rw
udev 10M 20K 10M 1% /dev
tmpfs 30M 4.0K 30M 1% /dev/shm
fw1:~# shutdown -h now
Saving the system clock..
hwclock[1215] general protection eip:804aacb esp:bff53fc4 error:0
/etc/rc0.d/K25hwclock.sh: line 48: 1215 Segmentation fault /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR
....
lguest: CRASH: Power down
と、まぁまぁ使えるようになりましたっと。``さて'' という字は尻へんに長いと書く。と言っているおじさんがいました。

2007年10月22日月曜日

rtl8187 動作せず...

やっぱりダメらしい。
~# cat /sys/bus/usb/devices/2-2/product
NETGEAR WG111v3
Web 探してみると v2 で asic_rev = 1。更に rf_init = rtl8225z2_rf_init っぽかったのでベタで試してみたところ、ウンとは言うがスンとは言わず。といった感じ。 zd1211rw も bcm43xx も mac802.11 じゃないけど、この辺り使うしか無いのかしら....

madwifi も方向転換で HAL 使わなくなって、以前のものから仕切り直しっぽい。そうそう svn のリポジトリ が再構成 Repository restructured ¶ だそうだ。stable は svn switch http://svn.madwifi.org/madwifi/trunk だそうだ。

using lguest - 1

とりあえずの起動までを、ちょっと jot。
/opt/lguest# dd if=/dev/zero of=FW1.img bs=1 count=1 seek=$((1024 * 1024 * 1024 * 2 - 1))
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.000126002 seconds, 7.9 kB/s
/opt/lguest# ls -l
total 16
-rw-r--r-- 1 root root 2147483648 2007-10-22 20:28 FW1.img
/opt/lguest# mkfs.ext3 FW1.img
mke2fs 1.40-WIP (14-Nov-2006)
FW1.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
....snip....
This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
/opt/lguest# mkdir tmp
/opt/lguest# mount -t ext3 -o loop FW1.img tmp
/opt/lguest# debootstrap --arch i386 lenny tmp http://ring.asahi-net.or.jp/archives/linux/debian/debian
I: Retrieving Release
....snip....
I: Base system installed successfully.
/opt/lguest# chroot tmp
/# cp /etc/inittab oldtab
/# vi /etc/inittab
....
/# diff -ubB oldtab /etc/inittab
--- oldtab 2007-10-22 11:54:48.000000000 +0000
+++ /etc/inittab 2007-10-22 11:54:12.000000000 +0000
@@ -51,12 +51,12 @@
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
-1:2345:respawn:/sbin/getty 38400 tty1
-2:23:respawn:/sbin/getty 38400 tty2
-3:23:respawn:/sbin/getty 38400 tty3
-4:23:respawn:/sbin/getty 38400 tty4
-5:23:respawn:/sbin/getty 38400 tty5
-6:23:respawn:/sbin/getty 38400 tty6
+1:2345:respawn:/sbin/getty 38400 /dev/hvc0
+#2:23:respawn:/sbin/getty 38400 tty2
+#3:23:respawn:/sbin/getty 38400 tty3
+#4:23:respawn:/sbin/getty 38400 tty4
+#5:23:respawn:/sbin/getty 38400 tty5
+#6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
/# cat >> /etc/securetty

# lguest console
hvc0
/# mknod /dev/hvc0 c 229 0
/# exit
exit
/opt/lguest# umount tmp
/opt/lguest# cd /usr/src/stable/Documentation/lguest/
/usr/src/stable/Documentation/lguest# make
cc -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds -static lguest.c -lz -o lguest
/usr/src/stable/Documentation/lguest# cp lguest /opt/lguest/
/usr/src/stable/Documentation/lguest# cd !$
cd /opt/lguest/
/opt/lguest# modprobe lg
/opt/lguest# ./lguest 64m /usr/src/stable/vmlinux --block=FW1.img root=/dev/lgba
いや、実のところ、途中途中しくじっているけどね。

2007年10月15日月曜日

The Art of UNIX Programming

出版当初に原著を購入したのだが、難かしい英語 --- えぇ勿論私にとって --- だったので、ものの数ページで挫折したのだが.... The Art of UNIX Programming おぉ和訳。と早速購入。訳云々は全くわかっていないのだが、原著読める方はもちろん、どうも読んでおくべき本。もう一冊 Linux System Programming も購入。Robert Love さん著は以前の Linux Kernel Development が大変良くできた内容だった。にしても Programming って、してない気がする。