blob: 9053bebc1e1c4245541bfa8e9dea7f857a37de10 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001How to config the NAT46 in datapath to use the XLAT(CLAT)
2========================================
3Here we take 1802s (i.e. NezhaS) as example, 1826 (i.e. Nezha3) is similar.
4The host PC system tested in this paper is Ubuntu 5.4.0-6Ubuntu 1~16.04.12.
5
61, PIPE mode
71) make kernel_menuconfig and select "DATA_PATH_NAT46" and save your new configuration.
8And then rebuild:make -j8 V=99
9
102) Disable IPv6 in Ubuntu
11 "echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf"
12 "sysctl -p"
13
143) Redial using IPv6
15 "serial_client"
16 "AT+ZGDCONT=1,IPV6,GPRS"
17 "AT+ZGACT=1,1"
18 After this operation, you will not be able to access the IPv4 service and ping IPv4 will fail on the host side.
19
204) NAT46 Configuration
21 First query the IPv6 global address and local IPv4 address of ccinet, use "cat /sys/kernel/mpipe/devices/all"
22 you will get some information like this:
23 device state type refcnt IP IPv6
24 lo Down pipe 2 0.0.0.0 ::/0
25 embms0 Down pipe 2 0.0.0.0 ::/0
26 ccinet0 Up4/6 pipe 2 10.180.250.252 240e:9a:83e:4a98::/64
27 ccinet1 Down pipe 2 0.0.0.0 ::/0
28 ccinet2 Down pipe 2 0.0.0.0 ::/0
29 ccinet3 Down pipe 2 0.0.0.0 ::/0
30 ccinet4 Down pipe 2 0.0.0.0 ::/0
31 ccinet5 Down pipe 2 0.0.0.0 ::/0
32 ccinet6 Down pipe 2 0.0.0.0 ::/0
33 ccinet7 Down pipe 2 0.0.0.0 ::/0
34 ip6tnl0 Down pipe 2 0.0.0.0 ::/0
35 tunl0 Down pipe 2 0.0.0.0 ::/0
36 usbnet0 Up4/6 lan 3 192.168.1.1 ::/0
37
38 "10.180.250.252" will serve as the IPv4 address of host and the local IPv4 address in NAT46,
39 and "240e:9a:83e:4a98::" will serve as the local IPv6 address in NAT46.
40 The detailed configuration is as follows:
41 "echo add nat46 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
42 "echo config nat46 local.v4 10.180.250.252/32 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
43 "echo config nat46 local.v6 240e:9a:83e:4a98::1/64 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
44 "echo config nat46 local.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
45 32 indicates the mask length of the local IPv4 address, 64 indicates the prefix length of an IPv6 address.
46
47 if the remote IPv6 server(PLAT) is "240e:eb:8001:e05::/96",
48 "echo config nat46 remote.v6 240e:eb:8001:e05::/96 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
49 "echo config nat46 remote.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
50
51 the command "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" can be used to terminate the NAT46 translate.
52
535) Host Configuration
54 "ifconfig enp0s26u1u1 10.180.250.252 netmask 255.255.255.0 up"
55 "route add default gw 10.180.250.3"
56
576) Test
58 When use "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to terminate the NAT46 translate,
59 ping the IPv4 server on the host side will fails.
60 When use "echo 0 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to enable the NAT46 translate,
61 ping the IPv4 server on the host side will success.
62
63----------------------------------------
64
652, MIFI mode
661) make kernel_menuconfig and select "DATA_PATH_NAT46" and save your new configuration.
67And then rebuild:make -j8 V=99
68
692) Disable IPv6 in Ubuntu
70 "echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf"
71 "sysctl -p"
72
733) Redial using IPv6
74 "serial_client"
75 "AT+ZGDCONT=1,IPV6,GPRS"
76 "AT+ZGACT=1,1"
77 After this operation, you will not be able to access the IPv4 service and failed to ping IPv4 on the host or 1802s,
78 but you can successfully ping the IPv6 server on 1802s.
79
804) NAT46 Configuration
81 Use "ifconfig" to query the IPv6 global address and local IPv4 address of ccinet,
82 you will get some information like this:
83 br-lan Link encap:Ethernet HWaddr 02:C0:84:B0:2A:99
84 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
85 inet6 addr: 240e:9a:8c9:f13d::1/64 Scope:Global
86 inet6 addr: fe80::c0:84ff:feb0:2a99/64 Scope:Link
87 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
88 RX packets:29 errors:0 dropped:0 overruns:0 frame:0
89 TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
90 collisions:0 txqueuelen:0
91 RX bytes:3296 (3.2 KiB) TX bytes:6411 (6.2 KiB)
92
93 ccinet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
94 inet addr:10.164.56.133 Mask:255.255.255.255
95 inet6 addr: fe80::1/64 Scope:Link
96 inet6 addr: 240e:9a:8c9:f13d::1/64 Scope:Global
97 UP RUNNING NOARP MTU:1500 Metric:1
98 RX packets:28 errors:0 dropped:0 overruns:0 frame:0
99 TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
100 collisions:0 txqueuelen:1000
101 RX bytes:2848 (2.7 KiB) TX bytes:3136 (3.0 KiB)
102
103 lo Link encap:Local Loopback
104 inet addr:127.0.0.1 Mask:255.0.0.0
105 inet6 addr: ::1/128 Scope:Host
106 UP LOOPBACK RUNNING MTU:65536 Metric:1
107 RX packets:142 errors:0 dropped:0 overruns:0 frame:0
108 TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
109 collisions:0 txqueuelen:0
110 RX bytes:7480 (7.3 KiB) TX bytes:7480 (7.3 KiB)
111
112 usbnet0 Link encap:Ethernet HWaddr 02:C0:84:B0:2A:99
113 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
114 RX packets:34 errors:0 dropped:0 overruns:0 frame:0
115 TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
116 collisions:0 txqueuelen:1000
117 RX bytes:3436 (3.3 KiB) TX bytes:12027 (11.7 KiB)
118
119 "10.164.56.133" will serve as the local IPv4 address in NAT46, and "240e:9a:8c9:f13d::1" will serve as the local IPv6 address in NAT46.
120 The detailed configuration is as follows:
121 "echo add nat46 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
122 "echo config nat46 local.v4 10.164.56.133/32 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
123 "echo config nat46 local.v6 240e:9a:8c9:f13d::1/64 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
124 "echo config nat46 local.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
125 32 indicates the mask length of the local IPv4 address, 64 indicates the prefix length of an IPv6 address.
126
127 if the remote IPv6 server is "240e:eb:8001:e05::/96",
128 "echo config nat46 remote.v6 240e:eb:8001:e05::/96 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
129 "echo config nat46 remote.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
130
131 the command "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" can be used to terminate the NAT46 translate.
132
1335) Host Configuration
134 "dhclient enp0s26u1u1"
135 "route add default gw 192.168.1.1"
136
1376) Test
138 When we use "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to terminate the NAT46 translate,
139 ping the IPv4 server on the host side will fails.
140 When we use "echo 0 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to enable the NAT46 translate,
141 ping the IPv4 server on the host side will success.