Score:0

Route TRaffic from tunnel interface to Internet DSLite

cn flag

I am setting up DSLite AFTR in Ubuntu machine.

I am able to setup the tunnel between Rpi(B4) and Ubuntu(AFTR). The tunnel is of type IPv4inIPv6. I am running Dibbler server on Ubuntu and dibbler client on RPi to get global IPv6 address.

The overall setup looks like below (correction in image route from tun0 to wlp3s0):

The overall setup looks like below

I can able to see traffic through the tunnels from B4 to AFTR. The decapsulated packets on the AFTR (tun0).

So how can I route the traffic from tunnel interface(tun0) to wlp3s0(connected to internet) so that I can access internet.

root@AFTR:~$ tcpdump -i tun0  
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode  
listening on tun0, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes  
 IP 10.0.0.150.59143 > 95.211.158.137.domain: 59131+     
IP 10.0.0.150 > bom07s33-in-f3.1e100.net: ICMP echo request, id 1, seq 1610, length 40  
IP 10.0.0.150 > bom07s33-in-f3.1e100.net: ICMP echo request, id 1, seq 1611, length 40  
IP 10.0.0.150.53907 > 95.211.158.137.domain: 38519+ A? dns.msftncsi.com. (34)  
IP 10.0.0.150.53907 > 82.163.142.9.domain: 38519+ A? dns.msftncsi.com. (34)  
IP 10.0.0.150 > bom07s33-in-f3.1e100.net: ICMP echo request, id 1, seq 1612, length 40  
IP 10.0.0.150 > bom07s33-in-f3.1e100.net: ICMP echo request, id 1, seq 1613, length 40  

AFTR_script to create tunnel and adding IP rules:

ip link add name tun0 type ip6tnl local 2001:db8:1111:ff01::30 remote 2001:db8:1114:0:aa967:aa0e:d13e:c0cc mode ipip6 encaplimit none  
# bring up the tunnel interface  
ip link set tun0 up  

ip -6 addr add 2001:db8:1111:ff01::10 dev tun0  


iptables -t nat -A POSTROUTING -o wlp3s0 -j MASQUERADE #(wlp3s0 is the Internet side network card)  
echo "1 tun0" >> /etc/iproute2/rt_tables  
ip route add default dev tun0 table tun0  
iptables -t mangle -A PREROUTING -i tun0 -j MARK --set-mark 1  
iptables -t mangle -A POSTROUTING -j CONNMARK --save-mark  
iptables -t mangle -I PREROUTING -j CONNMARK --restore-mark  
ip rule add fwmark 1 iif wlp3s0 table tun0  

What I am doing wrong? How do I route traffic from tunnel(tun0) to the internet via wlp3s0.

Output for AFTR Tunnel ifconfig: root@AFTR:~$ ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 20-01-0D-B8-11-11-FF-01-00-00-00-00-00-00-00-00
inet addr:192.0.0.1 P-t-P:192.0.0.1 Mask:255.255.255.255
inet6 addr: 2001:db8:1111:ff01::10/128 Scope:Global
inet6 addr: fe80::4c9:4eff:feb6:91da/64 Scope:Link
UP POINTOPOINT RUNNING NOARP MTU:1452 Metric:1
RX packets:102 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:2 dropped:2 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:20025 (20.025 KiB) TX bytes:0 (0.0 B)

root@AFTR:~$ iptables -n -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT) target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
root@AFTR:~$ iptables -n -L -t mangle
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
CONNMARK all -- 0.0.0.0/0 0.0.0.0/0 CONNMARK restore
MARK all -- 0.0.0.0/0 0.0.0.0/0 MARK set 0x1

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT) target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
CONNMARK all -- 0.0.0.0/0 0.0.0.0/0 CONNMARK save

Default gateway:
root@AFTR:~$ ip route
default via 192.168.0.1 dev wlp3s0 proto static metric 600
169.254.0.0/16 dev wlp3s0 scope link metric 1000
192.168.0.0/24 dev wlp3s0 proto kernel scope link src 192.168.0.20 metric 600

Flaep avatar
ph flag
is forwarding enabled on ubuntu? `sysctl -w net.ipv4.ip_forward=1` maybe change ipv4 to ipv6
cn flag
Hi @Flaep, Yes the ipv4 forwarding was enabled by default.
Flaep avatar
ph flag
ok. I dont have much experience with iptables so i cant tell if that part is correct.
Flaep avatar
ph flag
For the rest I can at least offer some guessing. The output of ip route does not contain any routes involving the tunnel. This appears to be something to check. Then I do not understand where the IP 10.0.0.150 is coming from?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.