Detecting your public IP address

There are times when I’m hacking together something and I need to know my public IP address. I could hard code it in, but where’s the fun in that?

Probably the best IP reporter I’ve seen so far is ifconfig.me, but they lack IPV6 support at the moment. Since I want this, I decided to make my own.

You can find it at wm.snoj.us. It’s rather simple right now and I don’t see myself adding too much. If you would like some other type of information or way it’s presented, leave a comment or email me.

IPv6 using Charter’s 6RD on Ubuntu behind an IPv4 only router.

Finally figured out how to get a 6rd tunnel setup with Charter. My problem was that 1) I wasn’t paying attention to the examples and 2) I have my IPv6 router behind an IPv4 only router. So unlike the examples, I needed to use the private IP address instead of the public for the tunnel. (Like you do for 6in4.)

You can find my setup script here.

In my /etc/network/interface I added the following to my eth0 interface.

post-up /etc/network/6rd || echo 1;
pre-down ip tunnel del tun6rd || echo 1;

In the original script, the author has PREFIX:0::1/32 assigned to the external interface and PREFIX:1::1/64 assigned to the inside. I’m not sure the reasoning for this as both reside on the same /64 subnet. To me, it would make more sense to use PREFIX:: for the outside and PREFIX::1 for the internal so they are right next to each other.

I hope this helps other Charter customers figure out their own ‘native’ IPv6 connectivity.

SnojNS = DNSHifter

It’s been a while since the last SnojNS update. Been working on a lot of other things lately, like a baby…and another one that’ll be here any day now.

SnojNS is now going to be called DNShifter thanks to my good buddy ivorycruncher. He wins Bacon Salt. I also may be rewriting it in Javascript using nodejs….maybe. So far things are going okay, but I’m running into issues with XML. Seems like nodejs doesn’t have built in support or an easy to install library* that’ll let me do the crazy stuff I was able to do in C#. So for the time being, the test code relies on some “fancy” handling of Javascript objects to provide a similar setup to an XML document.

It is definitely not pretty, but here’s a code dump..

Some of the reason for exploring nodejs is that it is very easy to have one codebase for multiple operating systems. Sure Mono can be used to run C# Linux, but it’s a really big package to install. There is also issues with some namespaces and classes not implemented 100% the same or even at all. I do suppose nodejs can have the same issues, but my biggest issue is with the ease one can account for the differences.

That and the code is currently sitting on a backup hard drive from when I installed Server 2008 on the laptop and I haven’t restored it yet.

Speaking of the C# version. Last I worked on it, I finally abstracted the code so listeners for IPv4 or IPv6 could be used. Work also began on using an ssh connection to do lookups using nslookup or dig. This feature I may kill in favor of what I’m currently dubbing DNSXML. Basically, using an httpd server with something like php to do the lookups and send back the results using xml for structure. Doing so would make the encryption (using https or ssh socks/port redirection) of the data easier and cross-platform. And by easier I mean, “I’m lazy and I don’t want to have to deal with that mess.”

*By install, I mean have the necessary library files in the same folder and a simple “require(‘xml_library’)”. In other words, no NPM and works on all OSes without installing things like cygwin.

IPv6 in the home and me

Last November we moved from a rental home into a home of our own. Unfortunately, the old woman before us never had cable television or internet and so we had to wait a month before the ISP was able to dig in a line and hook us up. Now that we have internet, I’ve finally been able to resurrect my network.

While our ISP does have 6RD, I’m a huge fan of Hurricane Electric’s TunnelBroker.net. I find it easy to use and I don’t need to worry about changing ISP and keeping the same address range.

From before the move I had a dual-stack with an old laptop working as the IPv6 tunnel/router/firewall. (Because I don’t yet have a PCMCIA ethernet card and it’s so old I can’t get vlan trunking working so it has to function behind my Buffalo router/AP.) Now that we have internet, I just powered it on, ran “sudo ifup he-ipv6”, and voila! IPv6 was up and running.

What to do with 2^64 addresses at my disposal? Well, one thing I’m wanting to get working is getting my media anywhere I have a cellular signal and data. This is a problem as my phone only seems to support IPv4 on cellular networks and I don’t really want to go the dynamic DNS route as it seems too…archaic.

IPv6 router using TunnelBroker

/etc/network/interfaces

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
	pre-up wget -q --no-check-certificate -O - 'https://ipv4.tunnelbroker.net/ipv4_end.php?ip=AUTO&pass={PASSWORD}&apikey={APIKEY}&tid={TUNNELID}'
	address {LOCAL_TUNNEL_IPV6}
	netmask 64 endpoint {HE_ENDPOINT}
	up `ip -6 route add default via {HE_TUNNEL_ENDPOINT_IPV6} dev he-ipv6`
	up `echo 1 > /proc/sys/net/ipv6/conf/all/forwarding`
	down `echo 0 > /proc/sys/net/ipv6/conf/all/forwarding`