CentOS 7 连接问题

CentOS 7 连接问题

我有第二个 CentOS 7 盒子,连接时遇到很多问题。基本上,我们正在运行 WHMCS,但域查找一直失败。所以问题出在 IPv6 连接上。

[root@da01 ~]# yum install telnet -y -q -e 0
[root@da01 ~]# telnet whois.crsnic.net 43
Trying 2001:503:e8ef:1000::74...

它正在尝试通过 IPv6 进行连接。我们一直在移动我们的 colo 服务器,并获得了一个 IPv6 范围(10 个地址),但尚未在系统中设置 - 因此连接超时。

[root@da01 ~]# telnet whois.crsnic.net 43
Trying 2001:503:e8ef:1000::74...
telnet: connect to address 2001:503:e8ef:1000::74: Connection timed out

解决方案是暂时禁用整个系统的 IPv6 连接。因此,只需继续选择要禁用 IPv6 的网络接口即可:

[root@da01 ~]# vi /etc/sysconfig/network-scripts/ifcfg-em2 

然后将所有与 IPv6 相关的配置值更改为“否”,如下所示:

IPV6INIT="no"
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
IPV6_FAILURE_FATAL="no"
IPV6_PEERDNS="no"
IPV6_PEERROUTES="no"
IPV6_PRIVACY="no"

最后,重新启动网络相关服务。

[root@da01 ~]# service network restart

现在将尝试通过 IPv6 进行连接,然后在超时时重试 IPv4:

[root@da01 ~]# telnet whois.crsnic.net 43
Trying 199.7.74.74...
Connected to whois.crsnic.net.
Escape character is '^]'.
Connection closed by foreign host.

因此,我在系统配置中改变了这些值。

[root@da01 network-scripts]# sysctl -w net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
[root@da01 network-scripts]# sysctl -w     net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6 = 1
[root@da01 network-scripts]# sysctl -p /etc/sysctl.conf
[root@da01 network-scripts]# sysctl --system

然而,我现在遇到了网络问题。

无法 ping 通服务器

iMac-van-William-4:~ williamdavidedwards$ ping 
PING : 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1

来自服务器的跟踪路由很奇怪

[root@da01 domains]# traceroute google.nl
traceroute to google.nl (74.125.136.94), 30 hops max, 60 byte packets
 1  178.21.23.3 (178.21.23.3)  11.069 ms * *
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

除了服务器 IP 本身、网关、8.8.8.8 和 8.8.4.4 之外,无法 ping 任何内容

[root@da01 domains]# ping nu.nl
PING nu.nl (62.69.166.254) 56(84) bytes of data.
^C
--- nu.nl ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 999ms

路线-n

[root@da01 ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use     Iface
0.0.0.0         5.255.90.1      0.0.0.0         UG    100    0        0 em2
5.255.90.0      0.0.0.0         255.255.255.0   U     100    0        0 em2

/etc/resolv.conf

[root@da01 ~]# cat /etc/resolv.conf 
# Generated by NetworkManager
search -removed- -removed-
nameserver 8.8.8.8
nameserver 8.8.4.4

是否配置

[root@da01 ~]# ifconfig
em1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:21:9b:a7:c3:fd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

em2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet serveripv4  netmask 255.255.255.0  broadcast 5.255.90.255
        inet6 serveripv6  prefixlen 32  scopeid 0x0<global>
        inet6 ipv6  prefixlen 64  scopeid 0x20<link>
        inet6 ipv6  prefixlen 64  scopeid 0x0<global>
        ether ipv6  txqueuelen 1000  (Ethernet)
        RX packets 42827922  bytes 4801530409 (4.4 GiB)
        RX errors 0  dropped 30874  overruns 0  frame 0
        TX packets 2972081  bytes 1060556603 (1011.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

em3: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:21:9b:a7:c4:01  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

em4: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:21:9b:a7:c4:03  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        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
        loop  txqueuelen 0  (Local Loopback)
        RX packets 13560475  bytes 5100699012 (4.7 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 13560475  bytes 5100699012 (4.7 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

当我 ping 一个不存在的地址(dsjahdasjdsa.com)时,它会自动通过 ping dsjahdasjdsa.com.example.com 来 ping 我自己的服务器,其中 example.com 是我的网络接口的域。

不幸的是,这种情况仍在发生。我必须承认我陷入困境了……救命

答案1

该问题是由数据中心的 DDoS 保护软件引起的。它包含一个错误,导致 DNS 查找延迟很大。我重新安装了操作系统,禁用了 DDoS 保护(他们正在修复该错误),现在一切都正常了。

相关内容