0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6.X系のオンプレをクラウドに移植する際の注意点

Posted at

そもそもんな事するな

いやー、今どきCentOS6.XとかCentOS5.X系を使うのやめましょうよー と言ったところで、やっちゃうのがお客さんです。
ま、やるっきゃないでしょう。

注意点

一番の注意点は、

/etc/udev/rules.d/70-persistent-net.rules

でございます。
これは、MACアドレスと、ethXを結びつける情報が書かれたファイルです。
もともとは「eth0に表面、eth1に裏面ネットワークを接続した」状態で再起動をかけると、時々「eth0に裏面、eth1に表面ネットワークが関連度けされてしまっている」という現象が発生する事から、それを解消するために生まれた仕組みです。
/etc/udev/rules.d/70-persistent-net.rules
には、MACアドレスとethXの組み合わせが記載されています。

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:50:56:95:46:45", ATTR{type}=="1", KERNEL=="eth", NAME="eth0"

# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:50:56:95:24:07", ATTR{type}=="1", KERNEL=="eth", NAME="eth1"

上記みたいな中身です。
これ、クラウド上で動く仮想マシンでは単なる邪魔者ですね。
何しろ、クラウドなんてMACアドレスなぞとっかえひっかえですので、固定する意味がありません。
という事で、この仕組ごと削除してしまいましょう。

(1)/etc/udev/rules.d/70-persistent-net.rulesを消す
mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.date "+%Y%m%d"
echo "" > /etc/udev/rules.d/70-persistent-net.rules

(2) /lib/udev/rules.d/75-persistent-net-generator.rulesを消す
mv /lib/udev/rules.d/75-persistent-net-generator.rules /lib/udev/rules.d/75-persistent-net-generator.rules.date "+%Y%m%d"
echo ## > /lib/udev/rules.d/75-persistent-net-generator.rules

(3)/lib/udev/write_net_ruleを無効化
vi /lib/udev/write_net_ruleで中身を見て、以下の行を修正します
旧:#RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
新:RULES_FILE='/dev/null'

これで、マシン再起動で大丈夫です。
念の為、70-persistent-net.rulesをcatしてみて、空ファイルになっている事を確認してみて下さい。
空ファイルになっていたら成功です。

上記、やっておかないと、そのマシンのクローンを作る際に大変に困ってしまう事になります。クラウド情でCentOS6.X系を動作させているのであれば、まず第一にやっておくべき事でしょう。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?