blob: 9053bebc1e1c4245541bfa8e9dea7f857a37de10 [file] [log] [blame]
How to config the NAT46 in datapath to use the XLAT(CLAT)
========================================
Here we take 1802s (i.e. NezhaS) as example, 1826 (i.e. Nezha3) is similar.
The host PC system tested in this paper is Ubuntu 5.4.0-6Ubuntu 1~16.04.12.
1, PIPE mode
1) make kernel_menuconfig and select "DATA_PATH_NAT46" and save your new configuration.
And then rebuild:make -j8 V=99
2) Disable IPv6 in Ubuntu
"echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf"
"sysctl -p"
3) Redial using IPv6
"serial_client"
"AT+ZGDCONT=1,IPV6,GPRS"
"AT+ZGACT=1,1"
After this operation, you will not be able to access the IPv4 service and ping IPv4 will fail on the host side.
4) NAT46 Configuration
First query the IPv6 global address and local IPv4 address of ccinet, use "cat /sys/kernel/mpipe/devices/all"
you will get some information like this:
device state type refcnt IP IPv6
lo Down pipe 2 0.0.0.0 ::/0
embms0 Down pipe 2 0.0.0.0 ::/0
ccinet0 Up4/6 pipe 2 10.180.250.252 240e:9a:83e:4a98::/64
ccinet1 Down pipe 2 0.0.0.0 ::/0
ccinet2 Down pipe 2 0.0.0.0 ::/0
ccinet3 Down pipe 2 0.0.0.0 ::/0
ccinet4 Down pipe 2 0.0.0.0 ::/0
ccinet5 Down pipe 2 0.0.0.0 ::/0
ccinet6 Down pipe 2 0.0.0.0 ::/0
ccinet7 Down pipe 2 0.0.0.0 ::/0
ip6tnl0 Down pipe 2 0.0.0.0 ::/0
tunl0 Down pipe 2 0.0.0.0 ::/0
usbnet0 Up4/6 lan 3 192.168.1.1 ::/0
"10.180.250.252" will serve as the IPv4 address of host and the local IPv4 address in NAT46,
and "240e:9a:83e:4a98::" will serve as the local IPv6 address in NAT46.
The detailed configuration is as follows:
"echo add nat46 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 local.v4 10.180.250.252/32 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 local.v6 240e:9a:83e:4a98::1/64 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 local.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
32 indicates the mask length of the local IPv4 address, 64 indicates the prefix length of an IPv6 address.
if the remote IPv6 server(PLAT) is "240e:eb:8001:e05::/96",
"echo config nat46 remote.v6 240e:eb:8001:e05::/96 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 remote.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
the command "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" can be used to terminate the NAT46 translate.
5) Host Configuration
"ifconfig enp0s26u1u1 10.180.250.252 netmask 255.255.255.0 up"
"route add default gw 10.180.250.3"
6) Test
When use "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to terminate the NAT46 translate,
ping the IPv4 server on the host side will fails.
When use "echo 0 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to enable the NAT46 translate,
ping the IPv4 server on the host side will success.
----------------------------------------
2, MIFI mode
1) make kernel_menuconfig and select "DATA_PATH_NAT46" and save your new configuration.
And then rebuild:make -j8 V=99
2) Disable IPv6 in Ubuntu
"echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf"
"sysctl -p"
3) Redial using IPv6
"serial_client"
"AT+ZGDCONT=1,IPV6,GPRS"
"AT+ZGACT=1,1"
After this operation, you will not be able to access the IPv4 service and failed to ping IPv4 on the host or 1802s,
but you can successfully ping the IPv6 server on 1802s.
4) NAT46 Configuration
Use "ifconfig" to query the IPv6 global address and local IPv4 address of ccinet,
you will get some information like this:
br-lan Link encap:Ethernet HWaddr 02:C0:84:B0:2A:99
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 240e:9a:8c9:f13d::1/64 Scope:Global
inet6 addr: fe80::c0:84ff:feb0:2a99/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3296 (3.2 KiB) TX bytes:6411 (6.2 KiB)
ccinet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.164.56.133 Mask:255.255.255.255
inet6 addr: fe80::1/64 Scope:Link
inet6 addr: 240e:9a:8c9:f13d::1/64 Scope:Global
UP RUNNING NOARP MTU:1500 Metric:1
RX packets:28 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2848 (2.7 KiB) TX bytes:3136 (3.0 KiB)
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:142 errors:0 dropped:0 overruns:0 frame:0
TX packets:142 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7480 (7.3 KiB) TX bytes:7480 (7.3 KiB)
usbnet0 Link encap:Ethernet HWaddr 02:C0:84:B0:2A:99
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3436 (3.3 KiB) TX bytes:12027 (11.7 KiB)
"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.
The detailed configuration is as follows:
"echo add nat46 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 local.v4 10.164.56.133/32 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 local.v6 240e:9a:8c9:f13d::1/64 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 local.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
32 indicates the mask length of the local IPv4 address, 64 indicates the prefix length of an IPv6 address.
if the remote IPv6 server is "240e:eb:8001:e05::/96",
"echo config nat46 remote.v6 240e:eb:8001:e05::/96 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
"echo config nat46 remote.style RFC6052 | tee /sys/kernel/debug/tel/psd/data-pathv1/nat46_control"
the command "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" can be used to terminate the NAT46 translate.
5) Host Configuration
"dhclient enp0s26u1u1"
"route add default gw 192.168.1.1"
6) Test
When we use "echo 1 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to terminate the NAT46 translate,
ping the IPv4 server on the host side will fails.
When we use "echo 0 > /sys/kernel/debug/tel/psd/data-pathv1/bypass_nat46" to enable the NAT46 translate,
ping the IPv4 server on the host side will success.