Setup UMTS with OpenBSD
Introduction
I finally bought a UMTS account from Telenor for my Thinkpad X201i. I imagine myself working under a oak tree during the summer when I am on parental leave. So how to set it up under OpenBSD?
This is my setup
- Thinkpad X201i
- OpenBSD 4.8 - I assume a working install
- Huawei E1750 HSUPA USB modem
- Telenor mobile broadband subscription (Swedish)
So how to set it up under OpenBSD.
There are two ways to connect your modem through ppp
protocol, userland ppp(8) and as a kernel pppd(8).
Userland ppp is the first thing to try, until you know exactly how to connect to your service provider. Userland ppp provides much better interactivity and logging facilities which let you figure out all the peculiarities of your service provider.
Userland PPP
There are roughly 3 steps to connect via ppp.
- Check modem hardware driver
- Identify correct serial port device to use
- Adapt ppp configuration to match your service providers ppp protocol configuration
Check modem driver support
As always when checking for hardware driver support you need to check the dmesg output relating to the USB modem. In my case the USB modem show up as the following.
umsm0 at uhub2 port 2 configuration 1 interface 0 "HUAWEI Technology HUAWEI Mobile" rev 2.00/0.00 addr 3 ucom0 at umsm0
umsm1 at uhub2 port 2 configuration 1 interface 1 "HUAWEI Technology HUAWEI Mobile" rev 2.00/0.00 addr 3 ucom1 at umsm1
umsm2 at uhub2 port 2 configuration 1 interface 2 "HUAWEI Technology HUAWEI Mobile" rev 2.00/0.00 addr 3 ucom2 at umsm2
The E1750 modem is supported out of the box by OpenBSD. The E1750 device is supported by umsm(4) driver.
An usb tty compatible driver, ucom, in turn attach to the physical driver, umsm. The ucom driver is accessed through device names as /dev/cuaUx
. In my case the modem seems to present three serial ports which is available through /dev/cuaU0
to /dev/cuaU2
via ucom0 to ucom2.
You need to figure out which device that can be used to connect. This may be dependent on the actual USB modem hardware used where only some of the serial ports support dial out connection. In my case the first port /dev/cuaU0
works!
Adapt ppp configuration
The following /etc/ppp/ppp.conf
is the final configuration that works for in my setup. Note that commands must be intedented in relation to labels.
default:
set log Phase Chat LCP IPCP CCP tun command connect
set device /dev/cuaU0
set speed 384000
telenor:
set phone "*99#"
set timeout 0
set ifaddr 192.168.0.199/0 10.0.0.0/0 255.255.255.0 0.0.0.0
set dial "ABORT ERROR ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
\"\" ATZ OK-ATZ-OK AT+CGDCONT=1,\\\"IP\\\",\\\"internet.telenor.se\\\" OK \\dATD\\T TIMEOUT 40 CONNECT"
add default HISADDR
enable dns
disable ipv6cp pred1 mppe
Everything in the ppp.conf
file is described in detail in ppp(8). I spent a lot of time reading this specific manual page.
First line is important for debugging reasons as it defines what parts of the protocol that should be logged to syslog. To get log output (also described in ppp(8)) you need to add ppp logging to /etc/syslog.conf
.
!ppp
*.*<TAB>/var/log/ppp.log
The next two lines (in the default section) specify the device and speed respectively.
The phone number configuration is one of two common dial strings for 3G modems. \T
will be replaced by this string in the set dial
command. Timeout of 0 means indefinite timeout.
You should really check out ppp(8) for a description of set ifaddr
. This line roughly means I prefer to get 192.168.0.199
as local IP address but I accept any local address if I can't get it. I also accept any remote address but give an example IP address.
I use the default dial string (suggested by /etc/ppp/ppp.conf.sample
) but replace target domain with my providers domain, "internet.telenor.se".
The next two commands allow default gateway and dns to be configured by remote service. The last line disable some functionality that didn't seem to be supported by my provider (which I figured out by reading the log file).
Using this configuration I am able to connect to my provider. If you have problems figuring out the details from your provider you can setup the connection in interactive mode and call each command separately. See ppp(8) and references below on how to do that.
Connect
Interactive mode ...
# ppp
Working in interactive mode
Using interface: tun0
ppp ON think> load telenor
ppp ON think> dial
Disconnect ... TBD
Automatic mode ...
ppp -auto telenor
Disconnect ... TBD
Kernel PPP
TBD.
References
- ppp(8)
- pppd(8)
- How to OpenBSD with Huawei E1750 UMTS
- OpenBSD:Using Celcom ZTE MF190 USB Modem
- List of AT commands