主机通过网络访问虚拟机VirtualBox的WEB服务器

  • 目标

环境:WINDOWS+VirtualBox虚拟机(Debian)。

debian运行一个WEB服务器,端口是9001。

试图从WINDOWS浏览器中,访问这个WEB服务器。

  • 设置

网络,连接方式改为桥接网卡。如图:

  • 查看虚拟机IP
quantum6@debian:~$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a00:27ff:fe0a:f82b  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:0a:f8:2b  txqueuelen 1000  (Ethernet)
        RX packets 3472  bytes 4084577 (3.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2645  bytes 933777 (911.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 12  bytes 636 (636.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 12  bytes 636 (636.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • 访问

http://192.168.1.103:9001/p/test3

发布了2445 篇原创文章 · 获赞 299 · 访问量 173万+

猜你喜欢

转载自blog.csdn.net/quantum7/article/details/104258619