coLinuxの起動

インストールディレクトリに存在する
 start-Fedora-7.bat
を、以下の通り編集する。

colinux-daemon.exe kernel=vmlinux initrd=initrd.gz mem=128 cobd0="C:/Program Files/coLinux/Fedora-7.img" cobd1="C:/Program Files/coLinux/swap.img" root=/dev/cobd0 eth0=slirp,,tcp:22:22/tcp:80:80/tcp:5901:5900 ro

※補足
eth0=slirp,,tcp:22:22/tcp:80:80/tcp:5901:5900

これは、ローカルの22 Port に接続すると、coLinuxの22 Port にフォワードさせる、また、ローカルの80 Port を、coLinuxの80 Port にフォワードさせるという設定。(後でTAPを利用したNAT接続に切り替えるため、一時的な設定と認識しておく)

変更した内容で、start-Fedora-7.bat を起動する。
ログインプロンプトが現れるので、"root" と入力して、Enter を押す。

起動後の設定

初期状態では、キーボートマップが英字配列になっているので、日本語配列に変更するため、次のコマンドを入力する。

# loadkeys jp106

通常使うユーザを登録する。

# /usr/sbin/adduser stormtrooper
# passwd stormtrooper
Changing password for user stormtrooper.
New UNIX password: ******
Retype new UNIX password: ******
passwd: all authentication tokens updated successfully.

TeraTermによるSSHログイン

TeraTermTTSSH)を利用し、SSHでログインする。

登録したユーザでSSHでログインすると、コンソールに以下の画面が表示される。

You can connect to this virtual machine using the vnc address:

  127.0.0.1:1

Once logged into an X11 session, you can add packages by running pirut.

[1]+  Terminated              $SHELL -c "echo > /dev/tcp/10.0.2.2/7000" 2>> /dev/null
[stormtrooper@colinux ~]$

TAP接続を行うためのネットワーク設定

※TAP(TAP-Win32ドライバ)は、coLinuxインストール時に同時にインストールされている。Windowsのネットワーク一覧に仮想のNICとして追加されていることを確認する。
TAP接続を利用することで、NAT接続でcoLinuxにアクセスできるようになる。

SSHでログインしている状態で、以下の操作を行う。

  • /etc/sysconfig/network-scripts/ifcfg-eth0を変更する。
[stormtrooper@colinux ~]$ su -
Password:
[root@colinux ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
TYPE=Ethernet
IPADDR=192.168.0.2
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
  • /etc/sysconfig/networkを変更する。
[root@colinux ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=colinux
  • /etc/hostsファイルも編集する
[root@colinux ~]# vi /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.0.2     colinux

Windows側のネットワーク設定

coLinuxはシャットダウンしないで起動したままにしておき、Windows側のネットワーク設定を行う

Windows 側では、 コントロールパネル → ネットワーク接続を開く
メニューの表示から、詳細を選び一覧表示にする

ローカル エリア接続 している、Ethernet adapter のプロパティ
「詳細設定」「インターネット接続の共有」チェックボックスを入れる
「ホーム ネットワーク接続」の選択があれば、「TAP-Win32 Adapter V8 (coLinux)」を選択する

Windowsの hosts ファイルに、coLinux を追加する。

C:\WINDOWS\system32\drivers\etc\hosts  (WindowsXP のPATH )
192.168.0.2     colinux coLinux

start-Fedora-7.bat の設定を変更する

eth0=slirp,,tcp:22:22/tcp:80:80/tcp:5901:5900
となっているところを、
eth0=tuntap
へ修正する。

colinux-daemon.exe kernel=vmlinux initrd=initrd.gz mem=128 cobd0="C:/Program Files/coLinux/Fedora-7.img" cobd1="C:/Program Files/coLinux/swap.img" root=/dev/cobd0 eth0=tuntap ro

再び、coLinux に戻り、ネットワーク設定の続きを行う。
coLinux の コンソールウインドウで、
init 0
を入力して、coLinux を シャットダウンさせる。
Power down.
と、最後に表示されたら、ウインドウを閉じる。

TAPを利用したSSHログイン

再び、start-Fedora-7.bat から、coLinux を起動する。
ログインプロンプトが現れたら、今度は192.168.0.2のアドレスでTeraTermcoLinuxにログインしてみる。

  • ホスト: 192.168.0.2
  • TCPポート: 22
  • SSHバージョン: SSH2

/etc/resolv.confの変更

nameserver を、WindowsのTAPのTCP/IPIPアドレスである、192.168.0.1 に 設定する。

[stormtrooper@colinux ~]$ su -
Password:
[root@colinux ~]# vi /etc/resolv.conf
nameserver 192.168.0.1

インターネット上のどこかのサイトにpingを飛ばしてみる

[root@colinux ~]# ping yahoo.jp
PING yahoo.jp (xxx.xxx.xxx.xxx) 56(84) bytes of data.
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=63 time=0.380 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=63 time=0.417 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=63 time=0.371 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=4 ttl=63 time=0.476 ms

--- yahoo.jp ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3012ms
rtt min/avg/max/mdev = 0.371/0.411/0.476/0.041 ms
[root@colinux ~]#

これでcoLinuxWindows → インターネット接続のネットワーク環境が構築完了。

Windowsのサービスへの登録

WindowsのサービスへcoLinuxを登録するためには、まずは"start-Fedora-7.bat"ファイルの内容をconfファイルで設定する必要がある。以下が設定例。

#
# This is an example for a configuration file that can
# be passed to colinux-daemon in this manner:
#
#    colinux-daemon @example.conf
#
# Note that you can still prepend or append configuration and 
# boot parameters before and after '@', or you can use more 
# that one '@ to load several settings one after another.
# 
#    colinux-daemon @example.conf @overrider.conf mem=32
#
# Full list of config params is listed in colinux-daemon.txt.

# The default kernel
kernel=vmlinux

# File contains the root file system.
# Download and extract preconfigured file from SF "Images for 2.6".
#cobd0="c:\coLinux\root_fs"
cobd0="C:\Program Files\coLinux\Fedora-7.img" 

# Swap device, should be an empty file with 128..512MB.
#cobd1="c:\coLinux\swap_device"
cobd1="C:\Program Files\coLinux\swap.img" 

# Tell kernel the name of root device (mostly /dev/cobd0,
# /dev/cobd/0 on Gentoo)
# This parameter will be forward to Linux kernel.
root=/dev/cobd0

# Additional kernel parameters (ro = rootfs mount read only)
ro

# Initrd installs modules into the root file system.
# Need only on first boot.
initrd=initrd.gz

# Maximal memory for linux guest
#mem=64
mem=128

# Slirp for internet connection (outgoing)
# Inside running coLinux configure eth0 with this static settings:
# ipaddress 10.0.2.15   broadcast  10.0.2.255   netmask 255.255.255.0
# gateway   10.0.2.2    nameserver 10.0.2.3
#eth0=slirp
eth0=tuntap

# Tuntap as private network between guest and host on second linux device
#eth1=tuntap

# Setup for serial device
#ttys0=COM1,"BAUD=115200 PARITY=n DATA=8 STOP=1 dtr=on rts=on"

# Run an application on colinux start (Sample Xming, a Xserver)
#exec0=C:\Programs\Xming\Xming.exe,":0 -clipboard -multiwindow -ac"

上記を、Fedora-7.conf という名前で、colinux-daemon.exe のあるディレクトリに保存する。

その後、Windowsコマンドプロンプトから以下を実行する。

C:\>cd "Program Files\coLinux"

C:\Program Files\coLinux>colinux-daemon.exe @Fedora-7.conf --install-service "coLinux"

これで特にエラーが出なければOK。
次にコントロールパネルから、管理ツールを開き、サービスアイコンを開く。サービス一覧に、 先ほどのコマンドで名前をつけた、"coLinux" と表示されているので、それのプロパティを開いて、スタートアップの種類を設定し自動起動させる。

後は好きなように遊ぶ。