ipv6到ipv4代理搭建方法

NAT64/DNS64安装手册

NAT64采用tayga实现,DNS64采用bind9.8实现。

1平台搭建

平台为ubuntu12.04 Desktop版本。正常安装即可。

2NAT64(tayga)

2.1安装

在终端模式下输入

sudoapt-get install tayga

2.2配置

2.2.1相关设置

Sudo gedit /etc/tayga.conf

按照说明配置,目前实现方案不需要修改。

2.2.2创建、启动设备

tayga–mktun

iplink set nat64 up

2.2.3地址、路由配置

ip addr add192.168.0.1dev nat64(修改为本机IPv4地址)

ip addr add2001:db8:1::1dev nat64 (修改为本机IPv6地址)

ip route add 192.168.255.0/24 dev nat64(不需要修改)

ip route add 2001:db8:1:ffff::/96 dev nat64(不需要修改)

2.2.4启动IPv4、IPv6转发

sysctl -w net.ipv4.conf.all.forwarding=1

sysctl -w net.ipv6.conf.all.forwarding=1

2.2.5启动tayga

tayga

可使用tayga –d进入debug模式。

ping6 2001:db8:1:ffff::192.168.0.1((修改为本机IPv4地址))

2.2.6NAT44设置

iptables -t nat -A POSTROUTING -s192.168.255.0/24 -j SNAT --to-source192.168.0.1(修改为本机IPv4地址)

iptables-A FORWARD -s 192.168.255.0/24 -i nat64 -j ACCEPT

3DNS64 bind9

3.1安装

sudo apt-get install bind9

3.2配置

sudo gedit /etc/bind/named.conf.options

修改为如下:

options {

directory "/var/cache/bind";

// If there is a firewall between you and nameservers you want

// to talk to, you may need to fix the firewall to allow multiple

// ports to talk.Seehttp://www.kb.cert.org/vuls/id/800113

// If your ISP provided one or more IP addresses for stable

// nameservers, you probably want to use them as forwarders.

// Uncomment the following block, and insert the addressesreplacing

// the all-0's placeholder.

listen-on-v6 { any; };

allow-query { any; };

dns64 2001:db8:1:ffff::/96 {

clients { any; };

};

forwarders {

159.226.8.7;

};

//=================================================================

// If BIND logs error messages about the root key being expired,

// you will need to update your keys.See https://www.isc.org/bind-keys

//================================================================

dnssec-validation auto;

auth-nxdomain no;#conform to RFC1035

listen-on-v6 { any; };

};

修改完成后,输入named.conf查看修改是否成功。

3.3启动bind9

Bind9默认安装后开机启动。设置完成后,输入

/etc/init.d/bindrestart

4使用

4.1Windows

用管理员权限进入cmd,输入

netsh

>interfaceipv6

>add route 2001:db8:1:ffff::/96 "本地连接"2001:db8:1::1(修改为机器的ipv6地址)(为服务器的ipv6地址)

然后设置DNS服务器为NAT64地址即可

4.2Linux

添加路由

ip route add 2001:db8:1:ffff::/96 via2001:db8:1::1(修改为机器的ipv6地址)

然后设置DNS服务器为NAT64地址即可(为服务器的ipv6地址)

服务器地址:192.168.130.42

2400:dd01:1001:130:250:c2ff:fe23:f051/64

>�0:H�+

你可能感兴趣的:(ipv6到ipv4代理搭建方法)