I have an Ubuntu PC with Miredo's implementation of the Teredo protocol. I want to temporarily make it so that I can access IPv6-only addresses with all IPv4 networking available solely for Miredo to use. As such:

  • can I configure my PC in a way to do the above?
  • If not, how may set up a QEMU/KVM guest to do the same via the host's Teredo access?

I realize that there's two questions asked in this post (one for local configuration and another for VMs), but I will edit it to the single question that's satisfactorily answered. And I'm asking on Unix & Linux SE instead of Ask Ubuntu because I believe the more technical questions would be better off in this SE.

  • This would be very difficult to do. Maybe impossible. Better if you don't use Teredo; native IPv6 is best, a tunnel from HE or SixXS would be good, or you might be able to do this with 6to4. Jan 1, 2014 at 18:57
  • @MichaelHampton I doubt it's as difficult a you suggest, but let's put my doubt aside for the moment and let me ask: how exactly would I get either of the tunnels to do as I want? I'm thinking it's manipulation of the priority of network interfaces they'd provide. And if that is the case, then the same could be done with Miredo because it also provides an network interface. Sorry for the late response, I had issues logging in.
    – Oxwivi
    Jan 10, 2014 at 12:15

2 Answers 2


Use the BindPort option in miredo.conf to restrict miredo to a specific port. Then use iptables to block all outgoing traffic except UDP from the chosen port.

iptables -A OUTPUT -p udp --sport <chosen port> -j ACCEPT
iptables -P OUTPUT -j REJECT

iptables -A INPUT -p udp --dport <chosen port> -j ACCEPT
iptables -P INPUT -j REJECT

I don't know about Miredo, but the method I've used for testing a similar scenario with other IPv6 tunneling technologies is fairly simple... I remove the default IPv4 route, which has the effect of blocking all IPv4 access outside my local LAN. Then I add a specific (/32) IPv4 route to the tunnel server through the local router, and then bring the tunnel up. If your tunnel server is addressed by a hostname you may need to add it to the hosts file, or add a route to the DNS server as well (if your DNS server is not local). Bringing up the tunnel should create a default IPv6 route, and unless you're unlucky, leave your IPv4 routes alone. Then you'll have IPv4 connectivity only to your local LAN, and global IPv6 connectivity through the tunnel.

Miredo may introduce other complication(s), but this works great for some other various tunnel types.

  • I'm planning to do all this in a virtual machine. So not afraid to break anything. But how exactly am I supposed to do things like add/remove routes? iptables? Forgot all about from the lack of use.
    – Oxwivi
    Jan 11, 2014 at 18:15
  • The basic concept is ip route { add | del | change | append | replace } ROUTE -- man ip for details. You can specify routes exactly as they are printed with ip route show. Also, you need to specify -6 for IPv6 route table manipulation, ie ip -6 route blah-blah
    – nrvate
    Jan 12, 2014 at 10:44
  • It could be a useful idea for a 6in4 tunnel. But it is not going to work for the Teredo protocol. A Teredo client need to communicate with Teredo relays, which can be on arbitrary IPv4 addresses. The list of relays being used is not known in advance and can change in the middle of a connection. The choice of which relay to use is not made by the Teredo client but rather by the native IPv6 host at the other end of the connection.
    – kasperd
    Jun 3, 2015 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .