Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

虚拟机 CentOS 不能访问 HTTPS 地址

访问 HTTP 是正常的:

[root@localhost ~]# wget http://www.baidu.com
--2020-10-28 18:00:30--  http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 180.101.49.12, 180.101.49.11
Connecting to www.baidu.com (www.baidu.com)|180.101.49.12|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://172.28.3.10/webAuth/index.htm?www.baidu.com/ [following]
--2020-10-28 18:00:30--  http://172.28.3.10/webAuth/index.htm?www.baidu.com/
Connecting to 172.28.3.10:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3995 (3.9K) [text/html]
Saving to: ‘index.html.1’

index.html.1                                    100%[==============>]   3.90K  --.-KB/s    in 0s      

2020-10-28 18:00:31 (419 MB/s) - ‘index.html.1’ saved [3995/3995]

访问 HTTPS 异常:

[root@localhost ~]# wget https://www.baidu.com
--2020-10-28 18:05:07--  https://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 180.101.49.11, 180.101.49.12
Connecting to www.baidu.com (www.baidu.com)|180.101.49.11|:443... failed: Connection timed out.
Connecting to www.baidu.com (www.baidu.com)|180.101.49.12|:443... 

防火墙和 iptables 都已经停了

[root@localhost ~]# systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@localhost ~]# systemctl status iptables.service 
● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

总感觉是网络策略的问题, 但是对 Linux 不精通, 不知道真正问题出在哪里


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

由于我是通过 WindowsHyper-v 虚拟机装的 CentOS8, 使用的是默认虚拟交换机(Default Switch), 不能访问 HTTPS, 具体原因我也不清楚....

(临时)解决办法

就是创建一个新的虚拟交换机(内部), 并共享网络给他, 虚拟机使用这个网络.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...