Jul 31, 2003
onlsbc1, Red Hat 8.0 の整備
--- インストール #9
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(http://www-online.kek.jp/~inoue/para-CAMAC/
Work/SBC-Linux13.html)
高エネルギー加速器研究機構
素粒子原子核研究所
物理、オンライングループ
井上 栄二
目的
CC/NET上のRed Hat Linux 8.0 を使用する上でネットワーク設定スクリプト
が使用できる環境があるべきだとの声があった。 設定スクリプトの設置に
ついて検討する。
(1). setupコマンドの検討
(2). setupユティリティの整備
(3). setupコマンドを実行してネットワークの設定をする
(4). 参考: ホスト名の変更
--------------------------------------------------------------------
(1). setupコマンドの検討
512MBコンパクトフラッシュ上のRedHat Linux8.0 のシステムの setupコマンド
を実行してみる。
[root@onlsbc1 inoue]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdc1 484602 442427 17153 97% /
none 152188 0 152188 0% /dev/shm
[root@onlsbc1 inoue]# find / -name setup -print
[root@onlsbc1 inoue]#
[root@onlsbc1 inoue]# ls /usr/sbin
adduser iconvconfig ping6 suexec
alternatives kbdrate pmap_dump sys-unconfig
apachectl kudzu pmap_set tracepath
arping lchage pwck tracepath6
authconfig lgroupadd pwconv traceroute6
build-locale-archive lgroupdel pwunconv tunelp
chpasswd lgroupmod ramsize update-alternatives
chroot lid rdev updfstab
clockdiff lnewusers rdisc useradd
dbconverter-2 lpasswd readprofile userdel
glibc_post_upgrade luseradd rootflags userhelper
groupadd luserdel rotatelogs usermod
groupdel lusermod rpcinfo usernetctl
groupmod mkdict rtacct vidmode
grpck mklost+found saslauthd vigr
grpconv mksock sasldblistusers vipw
grpunconv module_upgrade sasldblistusers2 visudo
hotplugctl mouseconfig saslpasswd zdump
httpd newusers saslpasswd2 zic
hwclock packer sshd
[root@onlsbc1 inoue]#
512MBコンパクトフラッシュ上の Linuxシステムには setupコマンドはインス
トールされていない。 2.5"IDEハードディスク上のRedHat Linux8.0 のシステ
ムからコピーする。
[root@onlsbc1 inoue]# mount /dev/hda3 /mnt
[root@onlsbc1 inoue]# ls -l /mnt/sbin/setup
-rwxr-xr-x 1 root root 9457 Sep 3 2002 /mnt/sbin/setup
[root@onlsbc1 inoue]#
[root@onlsbc1 inoue]# cp /mnt/sbin/setup /usr/sbin
[root@onlsbc1 inoue]# ls -l /usr/sbin/setup
-rwxr-xr-x 1 root root 9457 Jul 29 15:11 /usr/sbin/setup
[root@onlsbc1 inoue]#
setupコマンドを実行してみる。
[root@onlsbc1 inoue]# /usr/sbin/setup
Text Mode Setup Utility 1.10 (c) 1999-2002 Red Hat, Inc.
lqqqqqqqqu Choose a Tool tqqqqqqqqqk
x x
x Authentication configuration x
x Mouse configuration x
x x
x x
x x
x x
x x
x x
x x
x x
x x
x lqqqqqqqqqqk lqqqqqqk x
x x Run Tool x x Quit x x
x mqqqqqqqqqqj mqqqqqqj x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
/ between elements | Use to edit a selection
現在の状態ではAuthenticationとマウスの設定しかできない。 他の設定もでき
るようにする。 setupコマンドで使用しているファイルを調べる。
[inoue@harry inoue]$ scp onlsbc1:/usr/sbin/setup .
inoue@onlsbc1's password:
setup 100% |*****************************| 9457 00:00
[inoue@harry inoue]$
[inoue@harry inoue]$ hexedit setup
:
00001160 03 00 00 00 01 00 02 00 2F 75 73 72 2F 73 62 69 ......../usr/sbi
00001170 6E 2F 61 75 74 68 63 6F 6E 66 69 67 00 2F 75 73 n/authconfig./us
00001180 72 2F 73 62 69 6E 2F 6C 6F 6B 6B 69 74 00 20 46 r/sbin/lokkit. F
00001190 69 72 65 77 61 6C 6C 20 63 6F 6E 66 69 67 75 72 irewall configur
000011A0 61 74 69 6F 6E 20 00 20 4B 65 79 62 6F 61 72 64 ation . Keyboard
000011B0 20 63 6F 6E 66 69 67 75 72 61 74 69 6F 6E 20 00 configuration .
000011C0 2F 75 73 72 2F 73 62 69 6E 2F 6B 62 64 63 6F 6E /usr/sbin/kbdcon
000011D0 66 69 67 00 20 4D 6F 75 73 65 20 63 6F 6E 66 69 fig. Mouse confi
000011E0 67 75 72 61 74 69 6F 6E 20 00 2F 75 73 72 2F 73 guration ./usr/s
000011F0 62 69 6E 2F 6D 6F 75 73 65 63 6F 6E 66 69 67 00 bin/mouseconfig.
00001200 20 4E 65 74 77 6F 72 6B 20 63 6F 6E 66 69 67 75 Network configu
00001210 72 61 74 69 6F 6E 20 00 2F 75 73 72 2F 73 62 69 ration ./usr/sbi
00001220 6E 2F 6E 65 74 63 6F 6E 66 69 67 00 20 50 72 69 n/netconfig. Pri
00001230 6E 74 65 72 20 63 6F 6E 66 69 67 75 72 61 74 69 nter configurati
00001240 6F 6E 20 00 2F 75 73 72 2F 73 62 69 6E 2F 70 72 on ./usr/sbin/pr
00001250 69 6E 74 63 6F 6E 66 2D 74 75 69 00 20 53 79 73 intconf-tui. Sys
00001260 74 65 6D 20 73 65 72 76 69 63 65 73 20 00 2F 75 tem services ./u
00001270 73 72 2F 73 62 69 6E 2F 6E 74 73 79 73 76 00 20 sr/sbin/ntsysv.
00001280 53 6F 75 6E 64 20 63 61 72 64 20 63 6F 6E 66 69 Sound card confi
00001290 67 75 72 61 74 69 6F 6E 20 00 2F 75 73 72 2F 73 guration ./usr/s
000012A0 62 69 6E 2F 73 6E 64 63 6F 6E 66 69 67 00 20 54 bin/sndconfig. T
000012B0 69 6D 65 7A 6F 6E 65 20 63 6F 6E 66 69 67 75 72 imezone configur
000012C0 61 74 69 6F 6E 20 00 2F 75 73 72 2F 73 62 69 6E ation ./usr/sbin
000012D0 2F 74 69 6D 65 63 6F 6E 66 69 67 00 20 58 20 63 /timeconfig. X c
000012E0 6F 6E 66 69 67 75 72 61 74 69 6F 6E 20 00 2F 75 onfiguration ./u
000012F0 73 72 2F 58 31 31 52 36 2F 62 69 6E 2F 58 63 6F sr/X11R6/bin/Xco
00001300 6E 66 69 67 75 72 61 74 6F 72 00 00 2F 75 73 72 nfigurator../usr
00001310 2F 73 68 61 72 65 2F 6C 6F 63 61 6C 65 00 73 65 /share/locale.se
00001320 74 75 70 74 6F 6F 6C 00 31 2E 31 30 00 52 75 6E tuptool.1.10.Run
00001330 20 54 6F 6F 6C 00 51 75 69 74 00 43 68 6F 6F 73 Tool.Quit.Choos
00001340 65 20 61 20 54 6F 6F 6C 00 00 00 00 00 00 00 00 e a Tool........
00001350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00001360 20 41 75 74 68 65 6E 74 69 63 61 74 69 6F 6E 20 Authentication
00001370 63 6F 6E 66 69 67 75 72 61 74 69 6F 6E 20 00 00 configuration ..
00001380 20 20 20 20 3C 54 61 62 3E 2F 3C 41 6C 74 2D 54 / between elem
000013A0 65 6E 74 73 20 20 7C 20 20 20 20 55 73 65 20 3C ents | Use <
000013B0 45 6E 74 65 72 3E 20 74 6F 20 65 64 69 74 20 61 Enter> to edit a
000013C0 20 73 65 6C 65 63 74 69 6F 6E 00 00 00 00 00 00 selection......
000013D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000013E0 54 65 78 74 20 4D 6F 64 65 20 53 65 74 75 70 20 Text Mode Setup
000013F0 55 74 69 6C 69 74 79 20 25 2D 32 38 73 20 28 63 Utility %-28s (c
00001400 29 20 31 39 39 39 2D 32 30 30 32 20 52 65 64 20 ) 1999-2002 Red
00001410 48 61 74 2C 20 49 6E 63 2E 00 00 00 00 00 00 00 Hat, Inc........
:
[inoue@harry inoue]$
/usr/sbin/kbdconfig --- Keyboard configuration
/usr/sbin/mouseconfig --- Mouse configuration
/usr/sbin/netconfig --- Network configuration
/usr/sbin/timeconfig --- Timezone configuration
(2). setupユティリティの整備
kbdconfig、netconfig、timeconfigの各ファイルを 2.5"IDEハードディスク上の
RedHat Linux 8.0 のシステムから、コンパクトフラッシュ上のLinuxシステムに
コピーする。
[root@onlsbc1 sbin]# ls -l /mnt/sbin/kbdconfig
-rwxr-xr-x 1 root root 14688 Sep 3 2002 /mnt/sbin/kbdconfig
[root@onlsbc1 sbin]# ls -l /mnt/sbin/netconfig
-rwxr-xr-x 1 root root 56073 Aug 16 2002 /mnt/sbin/netconfig
[root@onlsbc1 sbin]# ls -l /mnt/sbin/timeconfig
-rwxr-xr-x 1 root root 16392 Sep 3 2002 /mnt/sbin/timeconfig
[root@onlsbc1 sbin]#
[root@onlsbc1 sbin]# pwd
/usr/sbin
[root@onlsbc1 sbin]# cp /mnt/sbin/kbdconfig .
[root@onlsbc1 sbin]# cp /mnt/sbin/netconfig .
[root@onlsbc1 sbin]# cp /mnt/sbin/timeconfig .
[root@onlsbc1 sbin]# ls -l kbdconfig netconfig timeconfig mouseconfig
-rwxr-xr-x 1 root root 14688 Jul 29 15:47 kbdconfig
-rwxr-xr-x 1 root root 140336 Sep 3 2002 mouseconfig
-rwxr-xr-x 1 root root 56073 Jul 29 15:47 netconfig
-rwxr-xr-x 1 root root 16392 Jul 29 15:47 timeconfig
[root@onlsbc1 sbin]#
setupコマンドを再実行してみる。
[root@onlsbc1 sbin]# /usr/sbin/setup
Text Mode Setup Utility 1.10 (c) 1999-2002 Red Hat, Inc.
lqqqqqqqqu Choose a Tool tqqqqqqqqqk
x x
x Authentication configuration x
x Keyboard configuration x
x Mouse configuration x
x Network configuration x
x Timezone configuration x
x x
x x
x x
x x
x x
x x
x lqqqqqqqqqqk lqqqqqqk x
x x Run Tool x x Quit x x
x mqqqqqqqqqqj mqqqqqqj x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
/ between elements | Use to edit a selection
ok. Authentication、キーボード、マウス、ネットワーク、タイムゾーンの
設定が可能になった。
(3). setupコマンドを実行してネットワークの設定をする
[root@onlsbc1 sbin]# /sbin/ifdown eth0
[root@onlsbc1 sbin]# /usr/sbin/setup
Text Mode Setup Utility 1.10 (c) 1999-2002 Red Hat, Inc.
lqqqqqqqqu Choose a Tool tqqqqqqqqqk
x x
x Authentication configuration x
x Keyboard configuration x
x Mouse configuration x
x Network configuration x
x Timezone configuration x
x x
x x
x x
x x
x x
x x
x lqqqqqqqqqqk lqqqqqqk x
x x Run Tool x x Quit x x
x mqqqqqqqqqqj mqqqqqqj x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
/ between elements | Use to edit a selection
↑キー、↓キーを使ってカーソルを移動して、"Network configuration" を選択
する。 その後、TABキーを使って "Run Tool"を選択して、Enterキーを押す。
そうすると次の画面が表示される。
netconfig 0.8.12 (C) 1999 Red Hat, Inc.
lqqqqqqqu Network configuration tqqqqqqqk
x x
x Would you like to set up networking? x
x x
x lqqqqqk lqqqqk x
x x Yes x x No x x
x mqqqqqj mqqqqj x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
/ between elements | selects | next screen
ここで、"Yes" を選択して、Enterキーを押す。
netconfig 0.8.12 (C) 1999 Red Hat, Inc.
lqqqqqqqqqqqqqqqqqqqqu Configure TCP/IP tqqqqqqqqqqqqqqqqqqqqqk
x x
x Please enter the IP configuration for this machine. Each x
x item should be entered as an IP address in dotted-decimal x
x notation (for example, 1.2.3.4). x
x x
x [ ] Use dynamic IP configuration (BOOTP/DHCP) x
x x
x IP address: _130.**.**.**__ x
x Netmask: _255.255.***.***_ x
x Default gateway (IP): _130.**.**.**__ x
x Primary nameserver: _130.**.**.**__ x
x x
x lqqqqk lqqqqqqk x
x x OK x x Back x x
x mqqqqj mqqqqqqj x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
/ between elements | selects | next screen
IP configuration 画面が表示されるので、自分の環境に設定する。
Text Mode Setup Utility 1.10 (c) 1999-2002 Red Hat, Inc.
lqqqqqqqqu Choose a Tool tqqqqqqqqqk
x x
x Authentication configuration x
x Keyboard configuration x
x Mouse configuration x
x Network configuration x
x Timezone configuration x
x x
x x
x x
x x
x x
x x
x lqqqqqqqqqqk lqqqqqqk x
x x Run Tool x x Quit x x
x mqqqqqqqqqqj mqqqqqqj x
x x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
/ between elements | Use to edit a selection
"Quit" を選択して setupコマンドを終了する。 この後、ifupコマンドを実行
して、ネットワークインターフェースを立ち上げる。
[root@onlsbc1 sbin]# /sbin/ifup eth0
[root@onlsbc1 sbin]#
[root@onlsbc1 sbin]# /sbin/ifconfig -a
eth0 Link encap:Ethernet HWaddr **:**:**:**:**:**
inet addr:130.**.**.** Bcast:130.**.**.** Mask:255.**.**.**
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13830 errors:0 dropped:0 overruns:0 frame:0
TX packets:1487 errors:0 dropped:0 overruns:0 carrier:0
collisions:9 txqueuelen:100
RX bytes:1286401 (1.2 Mb) TX bytes:322246 (314.6 Kb)
Interrupt:11 Base address:0x8000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@onlsbc1 sbin]#
ok. 正常に動作している。
(4). 参考: ホスト名の変更
(4-1). 固定IPを使用する場合
/etc/hosts、/etc/sysconfig/neworkの2つのファイルを修正する。
[root@onlsbc1 inoue]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
130.87.153.3 onlsbc1.kek.jp
[root@onlsbc1 inoue]#
[root@onlsbc1 inoue]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=onlsbc1.kek.jp
GATEWAY=130.87.152.1
[root@onlsbc1 inoue]#
ファイルを修正した後、システムをリブートすればホスト名を変更できる。
(4-2). DHCPを使用する場合
/etc/hosts、/etc/sysconfig/neworkの2つのファイルを修正する。
DHCPを使用する場合には、/etc/hostsの指定は 127.0.0.1の行のみ指定する。
DHCPクライアントを手動で設定するには、/etc/sysconfig/networkファイルを
修正してネットワークを有効にし、/etc/sysconfig/network-scriptsディレク
トリにある各ネットワークデバイスの設定ファイルを修正する必要がある。
このディレクトリには、デバイスごとに設定ファイルifcfg-eth0(eth0はネット
ワークデバイス名)がある。
/etc/sysconfig/networkファイルには、次の行が必要である。
NETWORKING=yes
このファイルにはより多くの情報が記述されている可能性があるが、ブート時に
ネットワークを起動するには、NETWORKING変数をyesに設定する必要がある。
/etc/sysconfig/network-scripts/ifcfg-eth0ファイルには、次の行が必要で
ある。
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
---xxxx