# Connecting a Huawei E1762 usb modem



## gpw928 (Mar 5, 2011)

Hi,

This is how I got my Huawei E1762 usb modem going with ppp on FreeBSD 8.2.

My usb modem is normally plugged into my Billion router.  However, I need to stay connected when I travel.  So I just wanted to take the usb modem with me, and make it work via a usb port on FreeBSD hosts using ppp.  [This explains the contents of the ppp.linkup and ppp.linkdown files.]

When you plug in the modem, it identifies itself as:


```
$ devinfo -rv | grep u3g
        u3g0 pnpinfo vendor=0x12d1 product=0x1003 devclass=0x00 \
          devsubclass=0x00 sernum="" release=0x0000 intclass=0xff \
          intsubclass=0xff at bus=1 hubaddr=4 port=5 devaddr=2 interface=0
```

My starting point was Greg Lehey's post. His ppp.conf didn't work for me but the post was a great help.

Here is my working /etc/ppp/ppp.conf.  Use your own authname and authkey, and substitute your ISP's APN for 'internode':


```
# Run this as root (if you want linkup and linkdown route changes to work)
#
#   /usr/sbin/ppp -ddial internerd
#
default:
 allow users *
 #set log Phase Chat Connect hdlc LCP IPCP IPV6CP CCP tun
internerd:
 set device /dev/cuaU0.0
 set timeout 0
 set authname phil.chadwick
 set authkey gn55xzn76
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
        \"\" \
        AT OK-AT-OK \
        AT+CFUN=1 OK-AT-OK \
        AT+CMEE=2 OK-AT-OK \
        AT+CSQ OK \
        AT+CGDCONT=1,\\\"IP\\\",\\\"internode\\\" OK \
        AT+CGACT? OK-AT-OK \
        AT+CGATT? OK \
        AT+CGCLASS? OK \
        AT+COPS? OK \
        \\dATD*99# TIMEOUT 40 CONNECT"
 set crtscts on
 disable vjcomp
 disable acfcomp
 disable deflate
 disable deflate24
 disable pred1
 disable protocomp
 disable mppe
 disable ipv6cp
 disable lqr
 disable echo
 nat enable yes
 #disable dns
 resolv writable
 #set dns 208.67.220.220 208.67.222.222
 set ifaddr 10.1.0.2/0 10.1.0.1/0 255.255.255.255 0.0.0.0
 #add default HISADDR
```

Here is /etc/ppp/ppp.linkdown


```
# Warning: executed with uid of ppp invoker
default:
 shell logger "LABEL down (up UPTIME): OCTETSIN received, OCTETSOUT sent"
internerd:
 shell route delete default
 shell route add default billion
```

Here is /etc/ppp/ppp.linkup


```
# Warning: executed with uid of ppp invoker
internerd:
 shell route delete default
 shell route add default -interface INTERFACE
```

Hope this helps.

Cheers,

-- 
Phil


----------



## valhalla (Mar 6, 2011)

Hi, sir...I've read you post (I'm using FreeBSD-8.2 too), I wish you can help me. I have problems with my USB Wireless Modem, or it's just me that don't understand well. Because I'm newbie using FreeBSD, and I hope you can help me. I've tried your configuration, but I don't know what to do next. Like you can see in my post lately http://forums.freebsd.org/showthread.php?t=22146. No one with the answered that I want, and also I've tried this post: http://forums.freebsd.org/showthread.php?t=11996, http://forums.freebsd.org/showthread.php?t=22324, but nothing works for my USB Modem. My modem info:


```
Sierra Wireless 305 Modems Inc.
APN: my.apn
user name: my.username
password: my.password
Phone No.:*99***1#
```

When I pluged the usb Modem this is showed up: 


```
ugen4.3: <Sierra Wireless Inc.> at usbus4
ugen4.3: <Sierra Wireless Inc.> at usbus4 (disconnected)
ugen4.3: <Sierra Wireless Inc.> at usbus4
u3g0: <Sierra Wireless Inc. USB 305, class 0/0. rev 2.00/0.06, addr3> on usbus4

u3g0: Found 2 ports
```

And then I've tried your configuration, edit and make the ppp.conf, linkup and linkdown and then rebooted the machine. And then I plugged the usb Modem, still the same: when I pluged the usb Modem this is showed up: 


```
ugen4.3: <Sierra Wireless Inc.> at usbus4
ugen4.3: <Sierra Wireless Inc.> at usbus4 (disconnected)
ugen4.3: <Sierra Wireless Inc.> at usbus4
u3g0: <Sierra Wireless Inc. USB 305, class 0/0. rev 2.00/0.06, addr3> on usbus4

u3g0: Found 2 ports
```

And I've read some posts that I have to dial my modem, then I dialed using this command:
[cmd=]#ppp -ddial my.apn[/cmd]
then showed up: 


```
Working in ddial mode
Using interface tun1
```

I don't know what to do next...and the I've tried with this command: 
[cmd=]#ppp -ddial[/cmd]
and then this showed up: 


```
Working in ddial mode
Using interface tun2
```
. 

Next I've tried this command: 
[cmd=]#ifconfig[/cmd]
the result is: 


```
ath0: flags=8802<BROADCAST, SIMPLEX, MULTICAST> metric 0 mtu 2290
ether: 48:5d:60:52:14: e9
media: IEEE 802.11 Wireless Ethernet autoselect(autoselect)
status: no carrier

tun1: flags=8051<UP,POINTOPOINT, RUNNING, MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
Opened by PID 1665

tun2: flags=8051<UP,POINTOPOINT, RUNNING, MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
Opened by PID 1665
```

The question is, does it work? What I do next? I've tried tested the connection by updating my ports, but the result is: 


```
Can't fetch connection to: ftp://ftp.FreeBSD.org/pub/ports/distfiles.....
Can't fetch connection to: ftp://ftp.de.FreeBSD.org/pub/ports/distfiles....
Cant fetch connection to: ftp://jp.FreeBSD.org/pub/ports/distfiles....
```

I don't mind if anyone called me moron or stupid, but I've tried this almost in 2 weeks. I've searching by googling, the FreeBSD handbook, and from others forum. But still no results.

Can you help me mr. Phil? Please. I know this question was posted before, I wrote this similar post too. But no answer helped me. A simple answered mostly (they expect me to learn by myself perhaps..)

Thank you if you want to help me out....I appreciate it very much...

Best regards,

Kris...

ps: Sorry my english and grammar are not so well...


----------



## DutchDaemon (Mar 6, 2011)

valhalla, format your posts correctly.


----------



## gpw928 (Mar 6, 2011)

Hi Kris,

Each type of modem will generally require a custom chat script (the string following "set dial").

So it's not reasonable to expect my Huawei script to work with your Sierra modem.  It might be close, if you are very lucky...

You generally need to google for a script that works with your specific modem model.  I started with Greg Lehey's script written specifically for the Huawei E1762, which really helped, but didn't work initially for me (either ppp changed in FreeBSD 8.2, or I have a different Huawei firmware to Greg).

Once you replaced my chat script with one suited you your modem, uncomment the trace code.  i.e. remove the "#" from "set log":


```
#set log Phase Chat Connect hdlc LCP IPCP IPV6CP CCP tun
```

You can then look in /var/log/ppp.log to see what's going on.  If you see ppp connection fail, you then have to figure out why, fix it, and test ppp again.  It will generally fail in the chat script.  Getting a working chat script is really where all the work is!

It's also instructive to do a 
	
	



```
netstat -rn
```
 before and after running the ppp command.  This will show any differences in the routing tables.  In particular, look for changes to the default route.  If the default route has changed (this will happen in my scrips when the ppp.linkup commands are executed), then test the network with something like:
	
	



```
ping google.com
```

Also, I see you have two ppp instances running.  This is not good.  Run 
	
	



```
ps auxw | grep ppp
```
 to find the pids and send signal 15 to all of them prior to starting a fresh ppp test: 
	
	



```
kill -15 <pid>
```


Cheers,

-- 
Phil


----------



## valhalla (Mar 7, 2011)

DutchDaemon said:
			
		

> valhalla, format your posts correctly.



Sorry...I`ll paid attention next time I write a post. Thanks DutchDaemon.





Best regards,


----------

