VMで、RACやCoherenceクラスタなどのVM間での通信を行う場合に使います。
同一のネットワーク内のVM以外との通信はおこなえません。
設定
まずは、VMが内部ネットワークを使うようにVirtualBoxの設定をします。次に、VMのOSの設定をします。
IPやネットマスクは静的に割り当てます。
HWADDRはVM毎に変えてください。VBoxの設定画面から確認できます。
HWADDRはVM毎に変えてください。VBoxの設定画面から確認できます。
VM1の設定
/etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=08:00:27:78:81:5B ONBOOT=yes BOOTPROTO=static IPADDR=192.168.1.1 NETMASK=255.255.255.0 |
VM2の設定
/etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=08:00:27:C3:E0:7E ONBOOT=yes BOOTPROTO=static IPADDR=192.168.1.2 NETMASK=255.255.255.0 |
確認
ifdown eth0とifup eth0でNICを再起動させてから設定通りになっているか確認してみます。
■VM1
[root@localhost network-scripts]# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.045 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.040 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.047 ms ^C --- 192.168.1.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2350ms rtt min/avg/max/mdev = 0.040/0.044/0.047/0.003 ms [root@localhost network-scripts]# ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. 64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.312 ms 64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.284 ms 64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.262 ms ^C --- 192.168.1.2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2214ms rtt min/avg/max/mdev = 0.262/0.286/0.312/0.020 ms [root@localhost network-scripts]# ping 192.168.0.110 connect: ネットワークに届きません |
■VM2
[root@localhost network-scripts]# ping 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.930 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.812 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.393 ms ^C --- 192.168.1.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2546ms rtt min/avg/max/mdev = 0.393/0.711/0.930/0.232 ms [root@localhost network-scripts]# ping 192.168.1.2 PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data. 64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.035 ms 64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.038 ms 64 bytes from 192.168.1.2: icmp_seq=3 ttl=64 time=0.040 ms ^C --- 192.168.1.2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2686ms rtt min/avg/max/mdev = 0.035/0.037/0.040/0.007 ms [root@localhost network-scripts]# ping 192.168.0.110 connect: ネットワークに届きません |