Teredo on Docker Container

In few days ago I need to access to my docker container via teredo to access my entire network. If you’ve been following me for a long time, you might know, I am developt own Router-Server systems to handle my network requirments. My router system doesn’t has a package manager to install applications from directly but 3 months ago before to coming to university i make a work to run docker on my router system.

NEW: Teredo as a Container Service https://github.com/ahmetozer/docker-teredo

Create new docker with privileged mode

docker run --privileged -it ubuntu

Running these commands to enable IPv6 networing on your Docker Container.

sysctl net.ipv6.conf.all.disable_ipv6=0
sysctl net.ipv6.conf.default.disable_ipv6=0
sysctl net.ipv6.conf.lo.disable_ipv6=0

Installing Miredo for teredo service.

apt-get update
apt-get install -y iproute2 iputils-ping miredo

Finally start miredo service to accessing teredo network.

service miredo restart
root@whitedoor ~>docker run --privileged -it ubuntu
root@a0187d084a4a:/# sysctl net.ipv6.conf.all.disable_ipv6=0
ysctl net.ipv6.conf.all.disable_ipv6 = 0
root@a0187d084a4a:/# sysctl net.ipv6.conf.default.disable_ipv6=0
net.ipv6.conf.default.disable_ipv6 = 0
root@a0187d084a4a:/# sysctl net.ipv6.conf.lo.disable_ipv6=0
net.ipv6.conf.lo.disable_ipv6 = 0
root@a0187d084a4a:/# apt update
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease [242 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-backports InRelease [74.6 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [88.7 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf Packages [1277 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse armhf Packages [157 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports bionic/restricted armhf Packages [12.5 kB]
Get:8 http://ports.ubuntu.com/ubuntu-ports bionic/universe armhf Packages [11.0 MB]
Get:9 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe armhf Packages [1108 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf Packages [739 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse armhf Packages [4597 B]
Get:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted armhf Packages [10.5 kB]
Get:13 http://ports.ubuntu.com/ubuntu-ports bionic-backports/main armhf Packages [2490 B]
Get:14 http://ports.ubuntu.com/ubuntu-ports bionic-backports/universe armhf Packages [4250 B]
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-security/main armhf Packages [465 kB]
Get:16 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse armhf Packages [2077 B]
Get:17 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe armhf Packages [640 kB]
Get:18 http://ports.ubuntu.com/ubuntu-ports bionic-security/restricted armhf Packages [5013 B]
Fetched 15.9 MB in 24s (671 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@a0187d084a4a:/# apt-get install -y iproute2 iputils-ping miredo
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libatm1 libcap2 libcap2-bin libelf1 libidn11 libjudydebian1 libkmod2 libmnl0
  libpam-cap libudev1 libxtables12 udev
Suggested packages:
  iproute2-doc
The following NEW packages will be installed:
  iproute2 iputils-ping libatm1 libcap2 libcap2-bin libelf1 libidn11
  libjudydebian1 libkmod2 libmnl0 libpam-cap libxtables12 miredo udev
The following packages will be upgraded:
  libudev1
1 upgraded, 14 newly installed, 0 to remove and 1 not upgraded.
Need to get 2187 kB of archives.
After this operation, 10.3 MB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf libkmod2 armhf 24-1ubuntu3.2 [34.3 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf libudev1 armhf 237-3ubuntu10.33 [49.2 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf udev armhf 237-3ubuntu10.33 [1076 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf libelf1 armhf 0.170-0.4ubuntu0.1 [42.9 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libmnl0 armhf 1.0.4-2 [11.1 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf iproute2 armhf 4.15.0-2ubuntu1 [676 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libcap2 armhf 1:2.25-1.2 [11.7 kB]
Get:8 http://ports.ubuntu.com/ubuntu-ports bionic/universe armhf libjudydebian1 armhf 1.0.5-5 [53.1 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports bionic/universe armhf miredo armhf 1.2.6-4 [65.6 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf libidn11 armhf 1.33-2.1ubuntu1.2 [42.7 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf iputils-ping armhf 3:20161105-1ubuntu3 [52.9 kB]
Get:12 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libatm1 armhf 1:2.5.1-2build1 [19.2 kB]
Get:13 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libcap2-bin armhf 1:2.25-1.2 [20.1 kB]
Get:14 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libpam-cap armhf 1:2.25-1.2 [6752 B]
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libxtables12 armhf 1.6.1-2ubuntu2 [25.4 kB]
Fetched 2187 kB in 2s (1409 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libkmod2:armhf.
(Reading database ... 4040 files and directories currently installed.)
Preparing to unpack .../libkmod2_24-1ubuntu3.2_armhf.deb ...
Unpacking libkmod2:armhf (24-1ubuntu3.2) ...
Preparing to unpack .../libudev1_237-3ubuntu10.33_armhf.deb ...
Unpacking libudev1:armhf (237-3ubuntu10.33) over (237-3ubuntu10.31) ...
Setting up libudev1:armhf (237-3ubuntu10.33) ...
Selecting previously unselected package udev.
(Reading database ... 4045 files and directories currently installed.)
Preparing to unpack .../0-udev_237-3ubuntu10.33_armhf.deb ...
Unpacking udev (237-3ubuntu10.33) ...
Selecting previously unselected package libelf1:armhf.
Preparing to unpack .../1-libelf1_0.170-0.4ubuntu0.1_armhf.deb ...
Unpacking libelf1:armhf (0.170-0.4ubuntu0.1) ...
Selecting previously unselected package libmnl0:armhf.
Preparing to unpack .../2-libmnl0_1.0.4-2_armhf.deb ...
Unpacking libmnl0:armhf (1.0.4-2) ...
Selecting previously unselected package iproute2.
Preparing to unpack .../3-iproute2_4.15.0-2ubuntu1_armhf.deb ...
Unpacking iproute2 (4.15.0-2ubuntu1) ...
Selecting previously unselected package libcap2:armhf.
Preparing to unpack .../4-libcap2_1%3a2.25-1.2_armhf.deb ...
Unpacking libcap2:armhf (1:2.25-1.2) ...
Selecting previously unselected package libjudydebian1.
Preparing to unpack .../5-libjudydebian1_1.0.5-5_armhf.deb ...
Unpacking libjudydebian1 (1.0.5-5) ...
Setting up libkmod2:armhf (24-1ubuntu3.2) ...
Setting up udev (237-3ubuntu10.33) ...
Failure writing database /lib/udev/hwdb.bin: No space left on device
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Selecting previously unselected package miredo.
(Reading database ... 4333 files and directories currently installed.)
Preparing to unpack .../0-miredo_1.2.6-4_armhf.deb ...
Unpacking miredo (1.2.6-4) ...
Selecting previously unselected package libidn11:armhf.
Preparing to unpack .../1-libidn11_1.33-2.1ubuntu1.2_armhf.deb ...
Unpacking libidn11:armhf (1.33-2.1ubuntu1.2) ...
Selecting previously unselected package iputils-ping.
Preparing to unpack .../2-iputils-ping_3%3a20161105-1ubuntu3_armhf.deb ...
Unpacking iputils-ping (3:20161105-1ubuntu3) ...
Selecting previously unselected package libatm1:armhf.
Preparing to unpack .../3-libatm1_1%3a2.5.1-2build1_armhf.deb ...
Unpacking libatm1:armhf (1:2.5.1-2build1) ...
Selecting previously unselected package libcap2-bin.
Preparing to unpack .../4-libcap2-bin_1%3a2.25-1.2_armhf.deb ...
Unpacking libcap2-bin (1:2.25-1.2) ...
Selecting previously unselected package libpam-cap:armhf.
Preparing to unpack .../5-libpam-cap_1%3a2.25-1.2_armhf.deb ...
Unpacking libpam-cap:armhf (1:2.25-1.2) ...
Selecting previously unselected package libxtables12:armhf.
Preparing to unpack .../6-libxtables12_1.6.1-2ubuntu2_armhf.deb ...
Unpacking libxtables12:armhf (1.6.1-2ubuntu2) ...
Setting up libelf1:armhf (0.170-0.4ubuntu0.1) ...
Setting up libcap2:armhf (1:2.25-1.2) ...
Setting up libatm1:armhf (1:2.5.1-2build1) ...
Setting up libxtables12:armhf (1.6.1-2ubuntu2) ...
Setting up libjudydebian1 (1.0.5-5) ...
Setting up libmnl0:armhf (1.0.4-2) ...
Setting up libidn11:armhf (1.33-2.1ubuntu1.2) ...
Setting up iputils-ping (3:20161105-1ubuntu3) ...
Setting up libpam-cap:armhf (1:2.25-1.2) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/arm-linux-gnueabihf/perl5/5.26 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libcap2-bin (1:2.25-1.2) ...
Setting up iproute2 (4.15.0-2ubuntu1) ...
Setting up miredo (1.2.6-4) ...
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@a0187d084a4a:/# service miredo restart
 * Stopping Teredo IPv6 tunneling daemon miredo                          [ OK ]
 * Starting Teredo IPv6 tunneling daemon miredo                          [ OK ]
root@a0187d084a4a:/# ip addr show dev teredo
11: teredo: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc pfifo_fast state UNKNOWN group default qlen 500
    link/none
    inet6 2001:0:53aa:64c:20cb:8a7e:e020:d7f1/32 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::ffff:ffff:ffff/64 scope link
       valid_lft forever preferred_lft forever
    inet6 fe80::456a:9ac8:e9ad:ad2/64 scope link stable-privacy
       valid_lft forever preferred_lft forever

One line command

docker run --privileged -it ubuntu bash -c "sysctl net.ipv6.conf.all.disable_ipv6=0; sysctl net.ipv6.conf.default.disable_ipv6=0; sysctl net.ipv6.conf.lo.disable_ipv6=0;apt-get update;apt-get install -y iproute2 iputils-ping miredo;service miredo restart; ip addr show dev teredo; bash"

© 2024 All rights reserved.

Powered by Hydejack v7.5.0