gpt4 book ai didi

linux - Ubuntu本地IP地址无法解析

转载 作者:行者123 更新时间:2023-12-04 19:26:02 26 4
gpt4 key购买 nike

我设置了一个 Hugo 网络服务器,它监听 localhost:30000。
ubuntu 机器的地址是 192.168.2.137。
当我做:

curl http://localhost:30000/ -> OK
curl http://127.0.0.1:30000/ -> OK
但,
curl http://192.168.2.137:30000/ -> curl: (7) Failed to connect to 192.168.2.131 port 30000: Connection refused
这可能是什么原因?
我的/etc/netplan/00-installer-config.yaml 看起来像:
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s3:
dhcp4: false
addresses: [192.168.2.137/24]
gateway4: 192.168.2.1
nameservers:
addresses:
- 8.8.8.8
lo:
renderer: networkd
match:
name: lo
addresses:
- 192.168.2.137/24
我还在/etc/hosts 中添加了一个条目:
192.168.2.137 localhost

最佳答案

你说它是在 localhost 上监听的,所以如果你使用其他接口(interface)它不会工作,这是正常的。您应该监听所有接口(interface)或监听 enp0s3 接口(interface)。

关于linux - Ubuntu本地IP地址无法解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70970772/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com