省エネファイルサーバ構築 20 CentOS 5.6 Aterm WR8700で固定IP設定

CentOSが問題なく起動・終了・ネットワーク接続できるようになったので管理ツールを入れます。
sshだけでやるのは面倒だからです。

というかだいぶ前にwebminを入れて色々やった記憶はありますが、なんとまだブログ移行とか終わってないので記事が手元にありません。
移行前のデータはどこにあるかというとファイルサーバ上なのでファイルサーバ構築が終わらないと取り出せないという超ジレンマです。

そのだいぶ前の時はrpmをとってきて入れたような記憶がありますが、yumでも入れられるのでyumで入れます。

yumするまえに5.6にwebminが入っちゃってないか確認です。

# yum list installed
Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os error was
[Errno 4] IOError: <urlopen error (-3, '\xe5\x90\x8d\xe5\x89\x8d\xe8\xa7\xa3\xe6\xb1\xba\xe6\x99\x82\xe3\x81\xae\xe4\xb8\x80\xe6\x99\x82\xe7\x9a\x84\xe3\x81\xaa\xe5\xa4\xb1\xe6\x95\x97')>
Error: Cannot find a valid baseurl for repo: base

ネットに繋がらない時のエラーです。

Windows上からエラーになったURLは開けました。

http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os

http://ftp.jaist.ac.jp/pub/Linux/CentOS/5.6/os/x86_64/
http://ftp.tsukuba.wide.ad.jp/Linux/centos/5.6/os/x86_64/
http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos/5.6/os/x86_64/
http://ftp.nara.wide.ad.jp/pub/Linux/centos/5.6/os/x86_64/
http://www.ftp.ne.jp/Linux/packages/CentOS/5.6/os/x86_64/
http://ftp.riken.jp/Linux/centos/5.6/os/x86_64/
http://ftp.iij.ad.jp/pub/linux/centos/5.6/os/x86_64/
http://rsync.atworks.co.jp/centos/5.6/os/x86_64/
ftp://ftp.oss.eznetsols.org/linux/centos/5.6/os/x86_64/
http://mirror.averse.net/centos/5.6/os/x86_64/
http://mirror.neu.edu.cn/centos/5.6/os/x86_64/
http://mirrors.ta139.com/centos/5.6/os/x86_64/
http://mirrors.163.com/centos/5.6/os/x86_64/
http://mirror.khlug.org/centos/5.6/os/x86_64/
http://centos.tt.co.kr/5.6/os/x86_64/
http://data.nicehosting.co.kr/os/CentOS/5.6/os/x86_64/
http://ftp.daum.net/centos/5.6/os/x86_64/
http://centos.mirror.cdnetworks.com/5.6/os/x86_64/
http://ftp.tc.edu.tw/Linux/CentOS/5.6/os/x86_64/
http://mirror01.idc.hinet.net/CentOS/5.6/os/x86_64/


ではCentOSからwgetしてみると・・・?


# wget http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os
[1] 2396
[2] 2397
# -bash: wget: command not found
[1]-  Exit 127                wget http://mirrorlist.centos.org/?release=5
[2]+  Done                    arch=x86_64

wgetがないと怒られました。ひどい。
インストール時に何でもかんでも外したからか・・・。

じゃあ、このサーバにping打つと返ってくるのか?

# ping mirrorlist.centos.org
ping: unknown host mirrorlist.centos.org

とどきません。

なぜ・・・。

じゃあルータにpingは?


# ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=255 time=1.62 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=255 time=0.195 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=255 time=0.198 ms

--- 192.168.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.195/0.671/1.621/0.671 ms

返ってきました。

じゃあyahooは?

# ping yahoo.co.jp
ping: unknown host yahoo.co.jp

そとに出られていないのか???

直接yahoo.co.jpのIPにpingするために、windows上からやってみる

>ping yahoo.co.jp

yahoo.co.jp [124.83.187.140]に ping を送信しています 32 バイトのデータ:
124.83.187.140 からの応答: バイト数 =32 時間 =19ms TTL=42
124.83.187.140 からの応答: バイト数 =32 時間 =19ms TTL=42
124.83.187.140 からの応答: バイト数 =32 時間 =19ms TTL=42

124.83.187.140 の ping 統計:
パケット数: 送信 = 3、受信 = 3、損失 = 0 (0% の損失)、
ラウンド トリップの概算時間 (ミリ秒):
最小 = 19ms、最大 = 19ms、平均 = 19ms

IPは 124.83.187.140 のようです。

# ping 124.83.187.140
connect: Network is unreachable

外に出られてません。
ネットワークの情報を見てみる。

# ifconfig
eth0 Link encap:Ethernet HWaddr 70:71:BC:AD:6E:7B
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:865 errors:0 dropped:0 overruns:0 frame:0
TX packets:832 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:81123 (79.2 KiB) TX bytes:132024 (128.9 KiB)
Interrupt:58 Base address:0x6000

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:84 errors:0 dropped:0 overruns:0 frame:0
TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7200 (7.0 KiB) TX bytes:7200 (7.0 KiB)

とくにおかしくなさそう。
固定IPの設定を間違えたかな・・・?

そういえば、netgenesisの時と同じく固定IPの設定を普通にサーバ側で振っちゃったけど、ルータから触ればDHCPで普通に行けて面倒なことにならないのでは???

と思ったので設定をDHCPに戻す。

  1. BOOTPROTOをnoneからdhcpに変更
  2. IPADDRを追加して固定IPを設定 192.168.0.100

# Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller
DEVICE=eth0
BOOTPROTO=dhcp
#BOOTPROTO=none
HWADDR=70:71:BC:AD:6E:7B
ONBOOT=yes
#IPADDR=192.168.0.100

ルータ(WR8700N)にも設定して

ルータ(WR8700N)に静的IP設定

ネットワーク再起動

# service network restart
インターフェース eth0 を終了中:

ネットワークが寸断されるのでsshつなぎなおし。

しかし192.168.0.100につながらない。
ルータ側の設定が反映されてないのかと思い、ルータを再起動してもつながらない。
よく考えるとIP変わらないのであれば切断されないはず。

普通にIP振られちゃってるのかと思い192.168.0.7につなぎにいくとOK。

ルータの設定をよーく見てみるとDHCPの割当数が32になっていて、さらに?ボタンを押すと最大32!!

WR8700のDHCP割当数

そしておそらく固定IPもこの中に含めないといけないのだろうと予測して192.168.0.30を割り当ててみる。

DHCP固定割り当てエントリに 192.168.0.30 を割当

するとできました。

192.168.0.30 でssh接続

まあ、自宅の端末に30個もDHCPでIP振ることもないからいいかなと思うことにした。

うまくいったので、yahoo.co.jpにping打ってみる。

# ping yahoo.co.jp
PING yahoo.co.jp (203.216.243.240) 56(84) bytes of data.
64 bytes from f11.top.vip.tnz.yahoo.co.jp (203.216.243.240): icmp_seq=1 ttl=49 time=6.05 ms
64 bytes from f11.top.vip.tnz.yahoo.co.jp (203.216.243.240): icmp_seq=2 ttl=49 time=6.68 ms
64 bytes from f11.top.vip.tnz.yahoo.co.jp (203.216.243.240): icmp_seq=3 ttl=49 time=5.52 ms

--- yahoo.co.jp ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 5.529/6.091/6.688/0.473 ms

成功。
ではyumってみる。

# yum list installed
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
base                                                     | 2.1 kB     00:00
base/primary_db                                          | 2.2 MB     00:00
extras                                                   | 2.1 kB     00:00
extras/primary_db                                        | 260 kB     00:00
updates                                                  | 1.9 kB     00:00
updates/primary_db                                       | 725 kB     00:00
Installed Packages
Deployment_Guide-ja-JP.noarch         5.2-11.el5.centos                installed
MAKEDEV.x86_64                        3.23-1.2                         installed
SysVinit.x86_64                       2.86-15.el5                      installed
anthy.i386                            7900-4.el5                       installed
anthy.x86_64                          7900-4.el5                       installed
atk.i386                              1.12.2-1.fc6                     installed
atk.x86_64                            1.12.2-1.fc6                     installed
audit-libs.i386                       1.7.18-2.el5                     installed
audit-libs.x86_64                     1.7.18-2.el5                     installed

(略)

xorg-x11-filesystem.noarch            7.1-2.fc6                        installed
xorg-x11-font-utils.x86_64            1:7.1-2                          installed
xorg-x11-xfs.x86_64                   1:1.0.2-4                        installed
yum.noarch                            3.2.22-33.el5.centos             installed
yum-fastestmirror.noarch              1.1.16-14.el5.centos.1           installed
yum-metadata-parser.x86_64            1.1.2-3.el5.centos               installed
zlib.i386                             1.2.3-3                          installed
zlib.x86_64                           1.2.3-3                          installed

うまくいった!!!

忘れないうちにwgetを入れておく。

# yum list wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: rsync.atworks.co.jp
 * extras: rsync.atworks.co.jp
 * updates: rsync.atworks.co.jp
Available Packages
wget.x86_64                        1.11.4-2.el5_4.1                         base

# yum install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: rsync.atworks.co.jp
 * extras: rsync.atworks.co.jp
 * updates: rsync.atworks.co.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.11.4-2.el5_4.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package       Arch            Version                      Repository     Size
================================================================================
Installing:
 wget          x86_64          1.11.4-2.el5_4.1             base          582 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 582 k
Is this ok [y/N]: y
Downloading Packages:
wget-1.11.4-2.el5_4.1.x86_64.rpm                         | 582 kB     00:00
警告: rpmts_HdrFromFdno: ヘッダ V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey                                              | 1.5 kB     00:00
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : wget                                                     1/1

Installed:
  wget.x86_64 0:1.11.4-2.el5_4.1

Complete!

無事固定IP化完了です。

次回こそWebminを入れよう。

コメント