OpenWrt, 3G, IPv6

While waiting for ADSL from XS4ALL to be connected, I’m playing with the 3G UMTS dongle I got in the meantime. Configuring a dongle like this on Windows or Mac is a disaster, lots of crapware (you can install this from the CD-drive emulated by the stick) which never works and behaves like a virus. On Linux (tried with Fedora) with NetworkManager (or more specifically ModemManager) installing this is very easy. Just plug it in, select your provider (even XS4ALL is listed!) and you are in business.

It turns out it is also quite easy to get this to work on OpenWrt. I am using OpenWrt 10.03.1-RC5-testing on an Alix board with USB2 port. I tried first to do this on my Linksys WRT160NL, but unfortunately I “bricked” it for now and am waiting for a 3.3V serial cable to fix it🙂.

Alix and 3G modem

3G

I assume OpenWrt (the version specified above) is installed on the machine and you can access it using SSH (configuring the LAN and WLAN is out of scope here). First the network configuration in /etc/config/network:

config 'interface' 'wan'
option 'ifname' 'ppp0'
option 'device' '/dev/ttyUSB0'
option 'service' 'umts'
option 'proto' '3g'
option 'pincode' '0000'
option 'apn' 'umts.xs4all.nl'
option 'username' 'xs4all'
option 'password' '1234'

For this to work you need a number of packages from OpenWrt:

# opkg update && opkg install kmod-usb2 kmod-usb-serial-option kmod-usb-serial chat comgt kmod-ppp

I probably forgot a few, see also OpenWrt documentation here.

This should make everything work! No other fiddling around needed… Except, modifying the 3G dongle to not emulate a CD drive… See this site. I used AT^U2DIAG=0, that at least made my Vodafone 3G (K3765) adapter not emulate a CD drive. I didn’t try this on the one I got from XS4ALL (Huawei E180), as I have to return that at some point🙂. I issued this AT command in Linux to /dev/ttyUSB0 after ModemManager performed a usb_modeswitch to enable the modem instead of the CD drive. This way I didn’t need it on OpenWrt, and it would also work in for instance a FritzBox.

IPv6

As a fan of IPv6 I also wanted to get this to work. I didn’t feel like using a tunnelbroker so instead opted for trying out 6to4, something I wanted to do already for a while…

Turns out, this is also quite easy. You just install the 6to4 package, just add a new entry to /etc/config/network:

config 'interface' 'wan6'
option 'proto' '6to4'

Next modify one line in the firewall (/etc/config/firewall):

config zone
option name 'wan'
option network 'wan wan6'
...
...

To make it available on the LAN, install the package radvd and enable it with /etc/init.d/radvd enable. Bringing the interface wan6 up will configure radvd for you. Don’t forget to restart the firewall and bring up the interface:

# /etc/init.d/firewall restart
# ifup wan6

A last thing would be to make sure net.ipv6.conf.all.forwarding=1 is set in /etc/sysctl.conf.

Unfortunately it seems that at least Mac OS X prefers IPv4 over IPv6 when using a 6to4 tunnel, which makes sense I assume as 6to4 tends to be flaky…

One thought on “OpenWrt, 3G, IPv6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s