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):
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