在 Linux 中通过 SLIP 隧道传输 IPv6 流量

在 Linux 中通过 SLIP 隧道传输 IPv6 流量

在过去的几天里,我尝试了 6loWPAN 技术。现在由于缺乏Linux和计算机网络经验,我无法继续我的实验。我的设置如下:网络结构

我已经建立了传感器网络,由节点和路由器组成,路由器连接到PC上的Ubuntu虚拟机,这台PC也通过eth0接口连接到互联网。从传感器路由器到 PC 的连接是通过 tunslip6 实用程序建立的,该实用程序创建 tun0 接口。 Tunslip6 输出:

********SLIP started on ``/dev/ttyACM0''
opened tun device ``/dev/tun0''
ifconfig tun0 inet `hostname` up
ifconfig tun0 add aaaa::1/64
ifconfig tun0 add fe80::0:0:0:1/64
ifconfig tun0

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:127.0.1.1  P-t-P:127.0.1.1  Mask:255.255.255.255
          inet6 addr: fe80::1/64 Scope:Link
          inet6 addr: aaaa::1/64 Scope:Global
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Starting Contiki-3.x-2924-g6cdba10
With DriverLib v0.46593
TI CC1310 DIY module rev. 0.shit.1
IEEE 802.15.4: No, Sub-GHz: Yes, BLE: No, Prop: No
 Net: sicslowpan
 MAC: CSMA
 RDC: ContikiMAC, Channel Check Interval: 16 ticks
 RF: Channel 25
 Node ID: 613
*** Address:aaaa::1 => aaaa:0000:0000:0000
Got configuration message of type P
Setting prefix aaaa::
Server IPv6 addresses:
 aaaa::212:4b00:af6:265
 fe80::212:4b00:af6:265

因此我也可以从网络浏览器连接到我的路由器以及网站。 路由器网络界面

但是当我的传感器节点尝试访问 www.contiki-os.org 时,它甚至无法丰富 DNS 服务器。我想,发生这种情况是因为 tun0 和 eth0 接口未以某种方式连接。Wireshark 捕获 tun0 流量。

问题如下:我应该如何在 eth0 和 tun0 之间创建连接,以便我的节点能够访问互联网?我的 Ubuntu 虚拟机的 ifconfig 输出:

eth0      Link encap:Ethernet  HWaddr 00:0c:29:cb:f8:95  
          inet addr:192.168.202.131  Bcast:192.168.202.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fecb:f895/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:82922 errors:0 dropped:0 overruns:0 frame:0
          TX packets:54933 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:78915513 (78.9 MB)  TX bytes:5782093 (5.7 MB)
          Interrupt:19 Base address:0x2000 

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:6854 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6854 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1068353 (1.0 MB)  TX bytes:1068353 (1.0 MB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:127.0.1.1  P-t-P:127.0.1.1  Mask:255.255.255.255
          inet6 addr: fe80::1/64 Scope:Link
          inet6 addr: aaaa::1/64 Scope:Global
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:944 (944.0 B)  TX bytes:1410 (1.4 KB)

答案1

您将需要实施 NAT64。 NAT64 执行从 IPv6 到 IPv4 的网络地址转换。泰加是 Linux 的一个实现。

相关内容