デモ用にLaptopにVirtualBoxをインストールしました。
CentOS7を3台いれたのですが、SLOGINは出来たのですがMySQLの接続がGestOS間で
出来なかったので少し調べました。以前までは、chkconfigでiptableをON/OFFでコントロール
していたのですが、CentOSでは少しだけ作法が変わったようです。
Host OS<-> Guest OS と Guest OS<-> Guest OS間の接続に利用するNIC
使用したイメージ:CentOS-7.0-1406-x86_64-Minimal.iso
ゲストOS
[admin@CentOS01 ~]$ uname -a Linux CentOS01 3.10.0-123.6.3.el7.x86_64 #1 SMP Wed Aug 6 21:12:36 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux [admin@CentOS01 ~]$
これまでのchkconfigでは無くて、systemctlでサービスのコントロールするのがお勧めのようです。
Last login: Thu Sep 18 23:25:52 2014 from 192.168.56.102 ================================= This is local virtual host #01 Host Name: CentOS01 This is Production Version ================================= [admin@CentOS01 ~]$ ls -l 合計 0 [admin@CentOS01 ~]$ sudo -s [sudo] password for admin: [root@CentOS01 admin]# chkconfig --list 注記: この出力は SysV サービスのみであり、ネイティブな systemd のサービスは含まれていません。 systemd services. SysV 設定のデータはネイティブな systemd の設定によって上書きされます。 systemd サービスを一覧表示するには 'systemctl list-unit-files' を使用してください。 特定のターゲットにおいて有効化されているサービスを確認するには、 'systemctl list-dependencies [target]' 。 iprdump 0:off 1:off 2:on 3:on 4:on 5:on 6:off iprinit 0:off 1:off 2:on 3:on 4:on 5:on 6:off iprupdate 0:off 1:off 2:on 3:on 4:on 5:on 6:off mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@CentOS01 admin]# systemctl list-dependencies default.target ├─auditd.service ├─avahi-daemon.service ├─brandbot.path ├─crond.service ├─dbus.service ├─iprdump.service ├─iprinit.service ├─iprupdate.service ├─irqbalance.service ├─kdump.service ├─mysql.service ├─network.service ├─NetworkManager.service ├─plymouth-quit-wait.service ├─plymouth-quit.service ├─postfix.service ├─rsyslog.service ├─sshd.service ├─systemd-ask-password-wall.path ├─systemd-logind.service ├─systemd-readahead-collect.service ├─systemd-readahead-replay.service ├─systemd-update-utmp-runlevel.service ├─systemd-user-sessions.service ├─tuned.service ├─basic.target │ ├─firewalld.service │ ├─microcode.service │ ├─rhel-autorelabel-mark.service │ ├─rhel-autorelabel.service │ ├─rhel-configure.service │ ├─rhel-dmesg.service │ ├─rhel-loadmodules.service │ ├─paths.target │ ├─slices.target │ │ ├─-.slice │ │ └─system.slice │ ├─sockets.target │ │ ├─avahi-daemon.socket │ │ ├─dbus.socket │ │ ├─dm-event.socket │ │ ├─lvm2-lvmetad.socket │ │ ├─systemd-initctl.socket │ │ ├─systemd-journald.socket │ │ ├─systemd-shutdownd.socket │ │ ├─systemd-udevd-control.socket │ │ └─systemd-udevd-kernel.socket │ ├─sysinit.target │ │ ├─dev-hugepages.mount │ │ ├─dev-mqueue.mount │ │ ├─kmod-static-nodes.service │ │ ├─lvm2-monitor.service │ │ ├─plymouth-read-write.service │ │ ├─plymouth-start.service │ │ ├─proc-sys-fs-binfmt_misc.automount │ │ ├─sys-fs-fuse-connections.mount │ │ ├─sys-kernel-config.mount │ │ ├─sys-kernel-debug.mount │ │ ├─systemd-ask-password-console.path │ │ ├─systemd-binfmt.service │ │ ├─systemd-journal-flush.service │ │ ├─systemd-journald.service │ │ ├─systemd-modules-load.service │ │ ├─systemd-random-seed.service │ │ ├─systemd-sysctl.service │ │ ├─systemd-tmpfiles-setup-dev.service │ │ ├─systemd-tmpfiles-setup.service │ │ ├─systemd-udev-trigger.service │ │ ├─systemd-udevd.service │ │ ├─systemd-update-utmp.service │ │ ├─systemd-vconsole-setup.service │ │ ├─cryptsetup.target │ │ ├─local-fs.target │ │ │ ├─-.mount │ │ │ ├─boot.mount │ │ │ ├─rhel-import-state.service │ │ │ ├─rhel-readonly.service │ │ │ ├─systemd-fsck-root.service │ │ │ └─systemd-remount-fs.service │ │ └─swap.target │ │ ├─dev-centos-swap.swap │ │ ├─dev-disk-by\x2did-dm\x2dname\x2dcentos\x2dswap.swap │ │ ├─dev-disk-by\x2did-dm\x2duuid\x2dLVM\x2dR7SS2xtc4zQBQxiooj302IH1q4hymAgk5Sf62cdRsrkw... │ │ ├─dev-disk-by\x2duuid-7a83fe51\x2dd701\x2d4f23\x2d8cd2\x2d835b5ef97c74.swap │ │ ├─dev-dm\x2d0.swap │ │ ├─dev-mapper-centos\x2dswap.swap │ │ └─dev-mapper-centos\x2dswap.swap │ └─timers.target │ └─systemd-tmpfiles-clean.timer ├─getty.target │ └─getty@tty1.service └─remote-fs.target [root@CentOS01 admin]# [root@CentOS01 admin]# systemctl list-unit-files | grep firewall firewalld.service enabled [root@CentOS01 admin]# systemctl disable firewalld.service rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@CentOS01 admin]# systemctl list-unit-files | grep firewall firewalld.service disabled [root@CentOS01 admin]#
Firewallサービスを無効にしたので、リブートかけました。
Reboot
/sbin/iptable -Lで確認すると全てが外れていました。
VirtualBox内なのでこれでOKです。本番環境で利用する場合は、
丁寧にIPTABLEを管理した方が良いかと思います。
無事VirtualBoxのゲストOS間でMySQLに接続出来るようになりました。
Last login: Fri Sep 19 18:16:22 2014 from 192.168.56.1 ============================================= This is local virtual host #02 Host Name: CentOS02 ============================================= [admin@CentOS02 ~]$ mysql -h 192.168.56.101 -u admin -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.20-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. admin@192.168.56.101 > show full processlist; +----+-------+----------------------+------+---------+------+-------+-----------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+-------+----------------------+------+---------+------+-------+-----------------------+ | 1 | admin | 192.168.56.102:47643 | NULL | Query | 0 | init | show full processlist | +----+-------+----------------------+------+---------+------+-------+-----------------------+ 1 row in set (0.01 sec) admin@192.168.56.101 >