我具有以下网络配置:
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:e0:1c:73:02:09
inet addr:10.1.4.41 Bcast:10.1.255.255 Mask:255.255.0.0
inet6 addr: fe80::2e0:4cff:fe75:309/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:858600 errors:0 dropped:0 overruns:0 frame:0
TX packets:1069549 errors:0 dropped:0 overruns:5 carrier:0
collisions:0 txqueuelen:1000
RX bytes:142871181 (136.2 MiB) TX bytes:717982640 (684.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:37952 errors:0 dropped:0 overruns:0 frame:0
TX packets:37952 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3396918 (3.2 MiB) TX bytes:3396918 (3.2 MiB)
我的网络中有DHCP服务器,可以获得以下租约:
lease {
interface "eth0";
fixed-address 10.1.4.41;
option subnet-mask 255.255.0.0;
option routers 10.1.255.253;
option dhcp-lease-time 120;
option dhcp-message-type 5;
option domain-name-servers 82.160.125.52,213.199.198.248,82.160.1.1;
option dhcp-server-identifier 192.168.22.22;
renew 3 2014/01/01 18:34:41;
rebind 3 2014/01/01 18:35:30;
expire 3 2014/01/01 18:35:45;
}
我可以ping 127.0.0.1
,::1
,10.1.4.41
:
$ ping 10.1.4.41
PING 10.1.4.41 (10.1.4.41) 56(84) bytes of data.
64 bytes from 10.1.4.41: icmp_seq=1 ttl=64 time=0.065 ms
64 bytes from 10.1.4.41: icmp_seq=2 ttl=64 time=0.075 ms
64 bytes from 10.1.4.41: icmp_seq=3 ttl=64 time=0.085 ms
^C
--- 10.1.4.41 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.065/0.075/0.085/0.008 ms
$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.066 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.056 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.055 ms
^C
--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.055/0.059/0.066/0.005 ms
$ ping6 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.052 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.049 ms
64 bytes from ::1: icmp_seq=3 ttl=64 time=0.037 ms
^C
--- ::1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.037/0.046/0.052/0.006 ms
我无法ping ipv6地址fe80::2e0:4cff:fe75:309
:
$ ping6 fe80::2e0:4cff:fe75:309
connect: Invalid argument
我已经设置了一些iptables规则(ipv4):
# iptables -S
-P INPUT DROP
-P FORWARD DROP
-P OUTPUT ACCEPT
-N TCP
-N UDP
-A INPUT -i eth0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i tun0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -p udp -m conntrack --ctstate NEW -j UDP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
-A OUTPUT -m conntrack --ctstate INVALID -j DROP
并且它可以为ipv4正常工作。但是当我检查ip6tables时,我看到那里有一些数据包:
# ip6tables -nvL
Chain INPUT (policy ACCEPT 381 packets, 27624 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 390 packets, 26296 bytes)
pkts bytes target prot opt in out source destination
我遵循了本指南,他们说我应该复制iptables(ipv4)配置并将其粘贴到ip6tables(ipv6)中。但是,当我这样做时,没有数据包可以通过RELATED,ESTABLISHED
ipv6表中的规则。由于INPUT链策略(DROP
),所有它们都被删除。
# ip6tables -nvL
Chain INPUT (policy DROP 5 packets, 360 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all eth0 * ::/0 ::/0 ctstate RELATED,ESTABLISHED
0 0 ACCEPT all lo * ::/0 ::/0
0 0 ACCEPT all tun0 * ::/0 ::/0 ctstate RELATED,ESTABLISHED
0 0 DROP all * * ::/0 ::/0 ctstate INVALID
0 0 UDP udp * * ::/0 ::/0 ctstate NEW
0 0 TCP tcp * * ::/0 ::/0 tcp flags:0x17/0x02 ctstate NEW
0 0 REJECT tcp * * ::/0 ::/0 reject-with tcp-reset
0 0 REJECT udp * * ::/0 ::/0 reject-with icmp6-port-unreachable
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all * * ::/0 ::/0 ctstate INVALID
Chain TCP (1 references)
pkts bytes target prot opt in out source destination
Chain UDP (1 references)
pkts bytes target prot opt in out source destination
如您所见,没有输出数据包,那么为什么Google和Stack Exchange尝试连接到我的机器?而且,即使我无法ping我的ipv6地址,他们也该怎么做?
他们还说,如果我的ISP没有ipv6(在租约中,没有ipv6条目),我应该禁用ipv6,并在使用之前做过此操作ipv6.disable=1
。我在提出了类似的问题meta.stackoverflow.com
,但得到的答案是我不应该禁用ipv6。
我不知道该怎么做。我有一些连接问题,我的意思是有时我无法在堆栈交换或Google上访问页面,pastebin.com也有问题。在每种情况下,都有相同的症状-在浏览器中输入地址后,有时我必须等待几分钟才能访问该网站,然后重新加载2-3次后,我可以自由浏览它,至少一定的时间。
icmpv6
规则,但限制为20 / min,我可以看到数据包在那里。ping6 -I eth0 fe80::2e0:4cff:fe75:309
也可以。