LoginSignup
24
25

More than 5 years have passed since last update.

【俺メモ】VMWare上のCentOSのIPアドレスを固定に設定する

Last updated at Posted at 2015-03-26

ホストOSはWindowsやで。

ホストOSの設定を確認

  • VMWareの仮想マシンの設定で、ネットワークアダプタがNATやんな。
  • ネットワークの設定でVMNet8のIPアドレスをゲットや。(→192.168.xxx.1)

CentOSの設定

ネットワークの設定ファイルを修正すんで。

# nano /etc/sysconfig/network-scripts/ifcfg-eth0

以下の内容で書き換えや。(無い場合は追加、書かれていない設定はそのまま)

  ONBOOT=yes #no⇒yes
  BOOTPROTO=static #dhcp⇒static
  IPADDR=192.168.xxx.yyy #add
  NETMASK=255.255.255.0 #add
  GATEWAY=192.168.xxx.2 #add
  DNS1=192.168.xxx.2 #add

ポイントや。試験にでるさかい、しっかりおぼえとき
* ホストOSのIPアドレスの部分xxxは仮想マシンのxxxと一緒やで
* yyyの部分は129以上なら好きな数字でええで
* GATEWAYのアドレスは最後は2固定やで
* GATEWAYとDNS1は一緒やって

確認

# service network restart
# ping -c 4 www.yahoo.co.jp
PING www.g.yahoo.co.jp (124.83.203.233) 56(84) bytes of data.
64 bytes from f8.top.vip.ogk.yahoo.co.jp (124.83.203.233): icmp_seq=1 ttl=128 time=13.0 ms
64 bytes from f8.top.vip.ogk.yahoo.co.jp (124.83.203.233): icmp_seq=2 ttl=128 time=11.4 ms
64 bytes from f8.top.vip.ogk.yahoo.co.jp (124.83.203.233): icmp_seq=3 ttl=128 time=27.3 ms
64 bytes from f8.top.vip.ogk.yahoo.co.jp (124.83.203.233): icmp_seq=4 ttl=128 time=11.5 ms

となればOKやで。

24
25
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
24
25