注册 登陆

FreeBSD缺省支持ipv6

FreeBSD缺省支持ipv6。

如果不支持请在内核配置文件中打开如下选项,重新编译。
options         INET6                   #IPv6 communications protocols

可以先ping6自身,说明ipv6已经打开了。

su-2.05a$ ping6 localhost
PING6(56=40+8+8 bytes) ::1 --> ::1
16 bytes from ::1, icmp_seq=0 hlim=64 time=0.522 ms
16 bytes from ::1, icmp_seq=1 hlim=64 time=0.339 ms
^C
--- localhost ping6 statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/std-dev = 0.339/0.430/0.522/0.091 ms

这时缺省网络配置为:
su-2.05a$ ifconfig 
de0: flags=8843 mtu 1500
        inet6 fe80::280:c8ff:fe4b:8abd%de0 prefixlen 64 scopeid 0x1 
        inet 210.30.17.22 netmask 0xffffff00 broadcast 210.30.17.255
        ether 00:80:c8:4b:8a:bd
        media: Ethernet autoselect (100baseTX )
        status: active
lp0: flags=8810 mtu 1500
lo0: flags=8049 mtu 16384
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet 127.0.0.1 netmask 0xff000000 
ppp0: flags=8010 mtu 1500
sl0: flags=c010 mtu 552
faith0: flags=8002 mtu 1500

假设你的ipv4地址为210.30.17.181。为你分配的ipv6地址为3ffe:3218:6::210.30.17.181
tunnel的服务器端ipv4地址为210.30.17.12

1。创建一个tunnel连接
ifconfig gif0 create tunnel 210.30.17.181 210.30.17.12

再看一下:
de0: flags=8843 mtu 1500
        inet 210.30.17.181 netmask 0xffffff00 broadcast 210.30.17.255
        inet6 fe80::280:c8ff:fe4b:e668%de0 prefixlen 64 scopeid 0x1 
        ether 00:80:c8:4b:e6:68 
        media: Ethernet autoselect (100baseTX )
        status: active
lp0: flags=8810 mtu 1500
lo0: flags=8049 mtu 16384
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet 127.0.0.1 netmask 0xff000000 
ppp0: flags=8010 mtu 1500
sl0: flags=c010 mtu 552
faith0: flags=8002 mtu 1500
gif0: flags=8051 mtu 1280
        tunnel inet 210.30.17.181 --> 210.30.17.12
        inet6 fe80::280:c8ff:fe4b:e668%gif0 prefixlen 64 scopeid 0x7 

多了一个tunnel,叫做gif0

2。给网卡配置ipv6地址

ifconfig de0 inet6 3ffe:3218:6::210.30.17.181/120

de0: flags=8843 mtu 1500
        inet 210.30.17.181 netmask 0xffffff00 broadcast 210.30.17.255
        inet6 fe80::280:c8ff:fe4b:e668%de0 prefixlen 64 scopeid 0x1 
        inet6 3ffe:3218:6::d21e:11b5 prefixlen 120 
        ether 00:80:c8:4b:e6:68 
        media: Ethernet autoselect (100baseTX )
        status: active
lp0: flags=8810 mtu 1500
lo0: flags=8049 mtu 16384
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
        inet 127.0.0.1 netmask 0xff000000 
ppp0: flags=8010 mtu 1500
sl0: flags=c010 mtu 552
faith0: flags=8002 mtu 1500
gif0: flags=8051 mtu 1280
        tunnel inet 210.30.17.181 --> 210.30.17.12
        inet6 fe80::280:c8ff:fe4b:e668%gif0 prefixlen 64 scopeid 0x7 

注意,de0上已经有了ipv6地址。你也可以给gif0上配置这个ipv6地址,如:

ifconfig gif0 inet6 3ffe:3218:6::210.30.17.181/120

3。配置ipv6的缺省路由

route add -inet6 default -iface gif0

再看看路由,

su-2.05a# netstat -rn|grep gif0
default                           gif0                          ULSc       gif0
fe80::%gif0/64                    link#7                        UC         gif0
fe80::280:c8ff:fe4b:e668%gif0     link#7                        UHL         lo0
ff02::%gif0/32                    link#7                        UC         gif0

注意,ipv6的default路由已经到了gif0上。

« 上一篇 | 下一篇 »

Trackbacks

点击获得Trackback地址,Encode: UTF-8 点击获得Trackback地址,Encode: GB2312 or GBK 点击获得Trackback地址,Encode: BIG5

发表评论

评论内容 (必填):