第1条需要牵涉到背景知识,其实IPv6很早就被提出,也真正在互联网上使用有不短的时间了,尤其是那些大一些的骨干网络和机房;基于各种大家都隐约知道的原因,我朝网络还未部署,起码从未公布过(教育网不能算,教育网从未是对公众开放的);一般情况下我们使用的还是32位的IPv4地址通信,而IPv4地址的枯竭问题也是21世纪以来互联网的一大事件,IPv6如此缓慢的普及脚步看来还得再过上几年才会遇到历史的拐点吧。既然只能进行IPv4通信的网络无法通信,那么就需要利用各种隧道技术,在IPv4的节点间建立起IPv6的隧道,常见的有6in4等技术;也有很多网络服务提供商提供了这样的服务,例如 HE
, SixXS
等还向公众免费提供隧道服务,某就是使用的HE的免费服务
RPI 3.6.11 kernel for home router
Networking support --->
Networking options --->
[*] Network packet filtering framework (Netfilter) --->
Core Netfilter Configuration --->
<*> Netfilter connection tracking support
<*> FTP protocal support
<*> IRC protocal support
<*> Connection tracking netlink interface
-*- Netfilter Xtables support (required for ip_tables)
*** Xtables targets ***
<*> LOG target support
<*> "MARK" target support
*** Xtables matches ***
<*> "conntrack" connection tracking match support
<*> "iprange" address range match support
<*> "mac" address range match support
<*> "Multiport" Multiple port match support
<*> "state" match support
IP: Netfilter Configuration --->
<*> IPv4 connection tracking support (required for NAT)
<*> IP tables support (required for filtering/masq/NAT)
<*> Packet filtering
<*> REJECT target support
<*> Full NAT
<*> MASQUERADE target support
<*> REDIRECT target support
<*> Packet mangling
Device Drivers --->
<M> Connector - unified userspace <-> kernelspace linker
[*] Block Devices --->
<*> Loopback device support
[*] Network device support --->
[*] PPP (point-to-point protocal) support
<M> PPP BSD-Compress compression
<M> PPP Deflat compression
[*] PPP filtering
<M> PPP MPPE compression (encryption) (EXPERIMENTAL)
<M> PPP over Ethernet
<M> PPP support for async serial ports
<M> PPP support for sync tty ports
Cryptographic API --->
<M> SHA224 and SHA256 digest algorithm
<M> SHA384 and SHA512 digest algorithms
*** Compression ***
<M> Deflate compression algorithm
File systems --->
[*] Miscellaneous filsystems --->
<M> SquashFS 4.0 - Squashed file system support
[*] Squashfs XATTR support
[*] include support for ZLIB compressed file systems
[*] include support for LZO compressed file systems
[*] include support for XZ compressed file systems
** filter
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -j ACCEPT # 来自LAN
-A INPUT ! -i eth0 -p udp -m udp --dport 67 -j REJECT --reject-with icmp-port-unreachable # 举例 非LAN的 udp 67端口的请求
-A INPUT -i ppp0 -p tcp -m tcp --dport 22 -j ACCEPT # 允许来自WAN 的 ssh请求
-A INPUT -i ppp0 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT ! -i eth0 -p tcp -m tcp --dport 0:1023 -j DROP # 非LAN 的特殊权限端口
-A INPUT ! -i eth0 -p udp -m udp --dport 0:1023 -j DROP
-A INPUT -p tcp -m tcp --tcp-flags RST RST -j DROP # 忽略所有tcp reset
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT # 已经建立连接和相关的请求
-A FORWARD -s 10.0.0.0/24 -i tun0 -o ppp0 -m conntrack --ctstate NEW -j ACCEPT # 允许openvpn段访问公网
-A FORWARD -s 10.0.0.0/24 -d 192.168.5.0/24 -i tun0 -o eth0 -m conntrack --ctstate NEW -j ACCEPT # 允许openvpn段访问LAN
# NAT用
-A FORWARD -d 192.168.0.0/16 -i eth0 -j DROP
-A FORWARD -s 192.168.0.0/16 -i eth0 -j ACCEPT
-A FORWARD -d 192.168.0.0/16 -i ppp0 -j ACCEPT
-A OUTPUT -o eth0 -j ACCEPT
** nat
# 基本都和这条类似,将公网tcp 32038 映射到内网这台IP的端口上
-A PREROUTING -i ppp0 -p tcp -m tcp --dport 32038 -j DNAT --to-destination 192.168.5.15:32038
IPv6 大致含义和上面类似,默认来自he6这个隧道的通信都是拒绝的,选择性地开放
12345678910111213141516
-A INPUT -i he6 -p udp -j DROP
-A INPUT -i he6 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j DROP
-A INPUT -i lo -j ACCEPT
-A INPUT -i he6 -m state --state RELATED,ESTABLISHED -j ACCEPT # 允许已经连接和相关的请求
-A INPUT -i eth0 -j ACCEPT # 来自LAN的请求
-A INPUT -p ipv6-icmp -j ACCEPT # 允许ping6
-A FORWARD -i he6 -p udp -j DROP
-A FORWARD -i he6 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j DROP
-A FORWARD -s 2607:f8b0:400d:c04::/64 -i eth0 -o he6 -m state --state NEW -j ACCEPT # 允许出隧道的访问
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o he6 -j ACCEPT
-A OUTPUT -o eth0 -j ACCEPT
我来评几句
登录后评论已发表评论数()