Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to set up a Huawei E1820 3G modem on FreeBSD 10.0-RELEASE
1) Load the u3g(4) driver:
# kldload u3g
# kldstat
Id Refs Address Size Name
...
7 1 0xffffffff81b6e000 5ffb u3g.ko
2) Set the driver to load at boot:
# echo 'u3g_load="YES"' >> /boot/loader.conf
2) Get the vendor and product IDs using lsusb(8):
# pkg install usbutils
# lsusb
Bus /dev/usb Device /dev/ugen3.2: ID 12d1:14ac Huawei Technologies Co., Ltd.
...
3) Create a devd(8) configuration for the modem:
# cat << EOF > /etc/devd/huawei-e1820.conf
attach 100 {
device-name "u3g[0-9]+";
match "vendor" "0x12d1";
match "product" "0x14ac";
action "/usr/sbin/ppp -ddial saunalahti";
};
EOF
4) Find the TTY name of the modem:
# sysctl -a dev.u3g | egrep '\.ttyname'
dev.u3g.0.ttyname: U0
5) Set the device to modem-only mode (disable the virtual CD-ROM and SD card reader):
# cu -s 115200 -l cuaU0.0
Connected
AT^U2DIAG=0
OK
~.
[EOT]
6) Configure ppp(8). The configuration below has been tested using a Saunalahti
Mobiililaajakaista 3G plan (http://saunalahti.fi/).
- Replace /dev/cuaUX.0 with the value reported by sysctl(8) above.
- Replace the value of the AT+CPIN command (XXXX) with the PIN of your SIM card.
# cp /etc/ppp/ppp.conf /etc/ppp/ppp.conf.original
# cat << EOF > /etc/ppp/ppp.conf
# Run this as root (if you want linkup and linkdown route changes to work)
#
# /usr/sbin/ppp -ddial saunalahti
#
default:
# set log Phase Chat Connect hdlc LCP IPCP IPV6CP CCP tun
saunalahti:
set device /dev/cuaU0.0
set timeout 0
set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
\"\" \
AT OK-AT-OK \
AT+CPIN=XXXX OK-AT-OK \
ATH OK-AT-OK \
ATE1 OK-AT-OK \
AT+CGDCONT=1,\\\"IP\\\",\\\"internet4\\\" OK \
\\dATD*99# TIMEOUT 40 CONNECT"
enable dns
resolv writable
# Use Google and Level3 DNS
set dns 8.8.8.8 4.2.2.4
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255 0.0.0.0
EOF
6) Start ppp(8):
# /usr/sbin/ppp -ddial saunalahti
Working in ddial mode
Using interface: tun0
7) Check that the interface is up and has an IP address:
# ifconfig tun0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
inet 84.231.181.159 --> 10.0.0.2 netmask 0xffffffff
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
Opened by PID 2263
8) Start ppp(8) after boot:
# cat << EOF >> /etc/rc.conf
ppp_enable="YES"
ppp_mode="ddial"
ppp_profile="saunalahti"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.