【问题标题】:remote connection to centos7 virtual machine (virtualbox)远程连接centos7虚拟机(virtualbox)
【发布时间】:2017-07-09 16:32:46
【问题描述】:

在virtualbox上安装了centos7系统。主机是 linux mint。我也安装了 centos7 httpd、mariadb、php 和 phpadmin 7。在centos7虚拟机上可以。 我想从主机(linux mint)连接到 phpadmin 和 mariadb,我有 IDE 来开发我的应用程序。

这是centos7的ip地址(ip地址命令):

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host valid_lft forever preferred_lft forever

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:0e:9b:d8 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 85621sec preferred_lft 85621sec
    inet6 fe80::db89:b43e:da69:530d/64 scope link
       valid_lft forever preferred_lft forever

3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 52:54:00:8d:17:89 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
    link/ether 52:54:00:8d:17:89 brd ff:ff:ff:ff:ff:ff

这是centos7上的phpmyadmin.conf:

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       Require all granted
 #      Require ip 127.0.0.1
       Require ip 192.168.122.1

#       Require ip 10.0.2.15    
       Require ip ::1
     </RequireAny>
   </IfModule>

   <IfModule !mod_authz_core.c>
     # Apache 2.2
 #    Order Deny,Allow
 #    Deny from All
 #    Allow from 127.0.0.1
 #    Allow from 192.168.122.1

     Order Allow,Deny
     Allow from All

#     Allow from 10.0.2.15
    Allow from 192.168.122.1
     Allow from ::1


   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
  #     Require ip 127.0.0.1
          Require ip 192.168.122.1    
  #      Require ip 10.0.2.15    
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
#     Deny from All

#     Allow from 127.0.0.1
     Allow from 192.168.122.1

#     Allow from 10.0.2.15
     Allow from ::1
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>


configuration on virtualbox: 

network
attached to: NAT

adapter type: Intel PRO 1000/MT Desktop 82540EM

promiscuosous: deny

Mac Address: 0800270E9BD8

cable connected: checked

port forwarding configuration: 
name:centos7
protocol:tcp
host ip: empty
host port:3022
guest ip: empty:
guest port:22

file-->preferences-->network
Tab NAT: NatNetwork
 port forwarding configuration: empty
Tab Only Host: ip address 192.168.122.1

我尝试从主机 linux mint 连接,但连接不正常。 我认为宿主机在虚拟机上看不到centos7....

你知道吗?

谢谢...

【问题讨论】:

  • 给你的问题一个真正的标题,不要使用全部大写(因为它被认为是大喊大叫和粗鲁)。

标签: phpmyadmin virtualbox centos7


【解决方案1】:

您是否为该应用程序启用了端口转发?

您正在使用 NAT 进行网络连接,如果没有端口转发,您将无法连接到客户操作系统

【讨论】:

  • virtualbox 上的网络配置:附加到:NAT 适配器类型:Intel PRO 1000/MT Desktop 82540EM 混杂:拒绝 Mac 地址:0800270E9BD8 电缆连接:检查端口转发配置:名称:centos7 协议:tcp 主机 ip :空主机端口:8080 访客 ip:空:访客端口:80
  • 抱歉耽搁了。每个应用程序都有单独的端口来连接。 maria DB 端口是 3306。对于所有端口,您应该添加端口转发规则。
猜你喜欢
  • 2012-05-05
  • 1970-01-01
  • 2016-06-17
  • 1970-01-01
  • 2015-02-08
  • 1970-01-01
  • 2012-08-26
  • 2015-05-25
相关资源
最近更新 更多