You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在VMware中开放8100端口?如何访问Linux虚拟机的8100端口?

Hey there! Let's work through those two port-related issues you're hitting with Lubuntu on VMware—especially since you already messed with iptables and still got that annoying "Connection refused" error. Let's break this down step by step.

1. 如何在VMware中开放8100端口?

The setup depends on which network mode your VMware virtual machine is using—let's cover the two most common ones:

NAT模式(默认常用)

  • Open VMware, right-click your Lubuntu VM and select Settings.
  • Go to the Network Adapter tab, make sure NAT is selected, then click NAT Settings.
  • In the NAT Settings window, hit Add to create a port forwarding rule:
    • Host Port: 8100
    • Virtual Machine Port: 8100
    • Virtual Machine IP Address: Enter your Lubuntu VM's internal IP (you can get this by running ip a in the VM's terminal—look for the inet line under your active network interface, like enp0s3).
  • Save the rule and restart your VM to apply changes.

桥接模式(虚拟机和主机在同一局域网)

If you're using Bridged mode, you don't need extra port forwarding in VMware—just make sure your VM and host are on the same network segment. The key here is ensuring your VM has a valid IP on your local network (check with ip a again).

2. 如何访问Linux虚拟机上的8100端口?(解决Connection Refused问题)

Since you already configured iptables and still have issues, let's rule out the most common culprits:

Step 1: Verify your service is actually listening on 8100

The #1 reason for "Connection refused" is that no service is running on that port. In your Lubuntu terminal, run:

ss -tulpn | grep 8100
  • If you get no output: Your service isn't started, or it's configured to only listen on 127.0.0.1 (localhost, which can't be accessed from outside the VM). Check your service's config to make sure it binds to 0.0.0.0 (all interfaces) instead of just localhost.
  • If you see output like LISTEN 0 100 0.0.0.0:8100 0.0.0.0:* users:(("your-service",pid=1234,fd=5)), then the service is listening correctly—move to the next step.

Step 2: Double-check your firewall rules

Even if you set iptables, sometimes rules don't stick or there's another firewall (like ufw) overriding them:

  • First, confirm iptables allows 8100:
    sudo iptables -L -n | grep 8100
    
    If you don't see a line allowing tcp dpt:8100, re-add the rule:
    sudo iptables -A INPUT -p tcp --dport 8100 -j ACCEPT
    
    Save the rules so they persist after reboot:
    sudo iptables-save > /etc/iptables/rules.v4
    
  • If you have ufw enabled (Lubuntu might have this by default), allow the port there too:
    sudo ufw allow 8100/tcp
    sudo ufw reload
    

Step 3: Test access based on your VMware network mode

  • NAT Mode: From your host machine (the one running VMware), open Safari and go to http://localhost:8100 or http://[your-host-ip]:8100 (your host's IP is the one on your local network, e.g., 192.168.1.100).
  • Bridged Mode: Use your Lubuntu VM's IP address directly, like http://[vm-ip]:8100 (you got this from ip a earlier).

Step 4: Check network connectivity

If you still can't connect, make sure your host and VM can ping each other:

  • From the VM, ping your host's IP: ping [host-ip]
  • From the host, ping the VM's IP: ping [vm-ip]
    If pings fail, your VMware network setup is broken—go back to the Network Adapter settings and double-check the mode, or reset VMware's network configuration.

内容的提问来源于stack exchange,提问作者Whitecat

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 06:23:35