大网数据广告活动
服务器运维问答

HTTPD listening in IPv6, according netstat, but reacheable in IPv4

· 52CE 我爱测

Using Openstack, I have a Web GUI (horizon) hosted on my server (HTTPS). When I do a netstat -lt | grep https , I have: tcp6 0 0 [::]:https [::]:* LISTEN With lsof -i :443 , I have: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE N…

问题原文

原帖链接 · Antonin M. · CC BY-SA 3.0

Using Openstack, I have a Web GUI (horizon) hosted on my server (HTTPS).

When I do a netstat -lt | grep https, I have:

tcp6       0      0 [::]:https              [::]:*                  LISTEN

With lsof -i :443, I have:

COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd    5250   root    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17675 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17676 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17677 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17678 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17679 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17680 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17681 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   17682 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)
httpd   27444 apache    6u  IPv6  27390      0t0  TCP *:https (LISTEN)

However the server is reachable in IPv4. It's ok for me but I wonder why there is not an entry with netstat like this:

tcp       0      0 0.0.0.0:https              0.0.0.0:*                  LISTEN

已采纳解答

原帖链接 · EightBitTony · CC BY-SA 3.0

I believe that on Linux, binding to [::] (IPv6) results in receiving both IPv6 and IPv4 traffic (by default). I believe these are referred to as IPv4-mapped IPv6 addresses. netstat simply shows the IPv6 entry only, because there's technically only a single bind, that happens to support both IPv4 and IPv6.

There's a bit of information on the Apache site.

It's possible for software to not use IPv4-mapped IPv6 addresses and bind to both 0.0.0.0 and [::] separately and hence show up twice in netstat, but it's a design choice on the part of the developers.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。