# How to configure ppp for u3g?



## iacobus (Aug 28, 2010)

Hi!

I'am new in FreeBSD, but I have used Linux for a few year.
I have got mobile modem: Huawei e1750c. As far as I know it is supported by
u3g driver. On Linux I use wvdial as a dialer, and there are no problems with
connection. On FreeBSD I just can't find propper ppp.conf, however I spend many
hours googling and trying some.


There are data needed to establish connection:

```
ASP: "internet"
user: ""
password: ""
phone: *99#
```


my wvdial (Linux) config file:

```
Modem = /dev/ttyUSB0
Baud = 57600
Init1 = ATH
Init2 = ATE1
Init3 = AT+CGDCONT=1,"IP","internet"
Dial Command = ATD
Phone = *99#
Stupid mode = yes
Username = "blank"
Password = "blank"
Auto DNS = yes
```


There is one of ppp.conf I tried:

```
default:
set log Phase Chat LCP IPCP CCP tun command
ident user-ppp VERSION (built COMPILATIONDATE)

set device /dev/cuaU0.0

set speed 115200
set dial "ABORT BUSY TIMEOUT 2 \
\"\" \
AT OK-AT-OK \
AT+CFUN=1 OK-AT-OK \
AT+CMEE=2 OK-AT-OK \
AT+CSQ OK \
AT+CGDCONT=1,\\\"IP\\\",\\\"internet\\\" OK \
AT+CGACT? OK-AT-OK \
AT+CGATT? OK \
AT+CGCLASS? OK \
AT+COPS? OK \
ATD*99# CONNECT"

set timeout 180
enable dns
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR
```


After i plug modem i got:

```
ugen4.2: <HUAWEI Technology> at usbus4
ugen4.2: <HUAWEI Technology> at usbus4 (disconnected)
ugen4.2: <HUAWEI Technology> at usbus4
u3g0: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2>
on usbus4
u3g0: Found 3 ports.
umass0: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2> on
usbus4
umass0: SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
umass1: <HUAWEI Technology HUAWEI Mobile, class 0/0, rev 2.00/0.00, addr 2> on
usbus4
umass1: SCSI over Bulk-Only; quirks = 0x0000
(probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
cd0 at umass-sim0 bus 0 scbus0 target 0 lun 0
cd0: <HUAWEI Mass Storage 2.31> Removable CD-ROM SCSI-2 device
cd0: 40.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
umass1:1:1:-1: Attached to scbus1
(probe0:umass-sim1:1:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
(probe0:umass-sim1:1:0:0): CAM status: SCSI Status Error
(probe0:umass-sim1:1:0:0): SCSI status: Check Condition
(probe0:umass-sim1:1:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
da0 at umass-sim1 bus 1 scbus1 target 0 lun 0
da0: <HUAWEI SD Storage 2.31> Removable Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
```

when i try to use "ppp default" and then "dial" i got:

```
# ppp default
Loading /lib/libalias_cuseeme.so
Loading /lib/libalias_ftp.so
Loading /lib/libalias_irc.so
Loading /lib/libalias_nbt.so
Loading /lib/libalias_pptp.so
Loading /lib/libalias_skinny.so
Loading /lib/libalias_smedia.so
Working in interactive mode
Using interface: tun0
Warning: Bad label in /etc/ppp/ppp.conf (line 2) - missing colon
Warning: Bad label in /etc/ppp/ppp.conf (line 2) - missing colon
ppp ON localhost> dial
Warning: deflink: /dev/cuad1: Bad file descriptor
Warning: deflink: /dev/cuad0: Bad file descriptor
```

Nothing happens, there is still no connection.

Some device nodes are created after I plug a modem. There is diff result
of listed /dev pre and post pluging:

```
jakub@iac-deb:~$ diff /media/disk/pre_dev /media/disk/post_dev
17a18
> cd0
20a22,30
> cuaU0.0
> cuaU0.0.init
> cuaU0.0.lock
> cuaU0.1
> cuaU0.1.init
> cuaU0.1.lock
> cuaU0.2
> cuaU0.2.init
> cuaU0.2.lock
23a34
> da0
43a55,56
> pass0
> pass1
51a65,73
> ttyU0.0
> ttyU0.0.init
> ttyU0.0.lock
> ttyU0.1
> ttyU0.1.init
> ttyU0.1.lock
> ttyU0.2
> ttyU0.2.init
> ttyU0.2.lock
77a100
> ugen4.2
```


I would be very gratefull if You could help me to configure ppp.conf.
FreeBSD without internt connection is useless for me... 

Thanks,
Jakub Nowacki.


----------



## jb_fvwm2 (Aug 29, 2010)

Someone posted one the other day on
comp.unix.bsd.freebsd.misc (I think is the one).
However, are you sure you should be using
tun0 ? Not changed if you are using v8 ?
Additionally, sometimes one needs additional
usb devices (new in v8) loaded. 
...
Good luck, ppp.conf originally took me two weeks...
on dialup
...
Also search u3g on this and daemonforums.org... someone may have
posted a working howto.  ( 24 threads on this forum with that
search as of today...)


----------



## fbsd1 (Aug 30, 2010)

You forgot to say that your modem was a usb device. da0 
You have the wrong device specified in the ppp.conf
set device /dev/cuaU0.0 is not correct. I think it should be set device /dev/da0


----------



## RoboNuggie (Aug 30, 2010)

I struggled on and off with u3g + usb dongles, and decided that I would get a wifi/ethernet router that takes a 3g usb modem.... simplifies the process as the usb devices is detected automatically by the router which then relays the internet connection as per a landline broadband connection...  not the answer you are looking for if you are a mobile user, but perhaps a possible solution for a desk bound or in house connection.


----------



## wblock@ (Aug 30, 2010)

fbsd1 said:
			
		

> You forgot to say that your modem was a usb device. da0
> You have the wrong device specified in the ppp.conf
> set device /dev/cuaU0.0 is not correct. I think it should be set device /dev/da0



No, /dev/cuaU0 is correct.  See u3g(4) for more information on these composite devices.


----------



## Horos (Feb 13, 2012)

Hello.

I'm new to the forum and I hope I posted in the appropriate topic. My problem is how to configure a ppp connection. I have a Vodafone K3765 modem and I can not connect to the Internet. The modem is recognized as such and the problem seems to be related to the dial strings. What dial strings are suitable for my modem?
I have FreeBSD 9.0 Beta2/i386. I can not update the OS, because I can not connect to the Internet. The modem is my only connection to the Internet.

Please help me, I do not know what to do. I tried everything, I read FreeBSD Handbook, nothing helped me.


----------



## Horos (Feb 15, 2012)

I see that no one gets tired to respond. I really want to connect to the Internet using FreeBSD. I regret that I can not post the contents of my ppp.conf because I can not connect with FreeBSD. As an idea, it's like Iacobus, with some additions.

So far, I have managed to establish a modem connection, but then I see the ppp log that the connection is canceled, I do not know why. There is no problem with the modem, because the same modem works well with Ubuntu. What is missing so I can make a connection with this modem in FreeBSD?

I learned that when ppp is launched in interactive mode, and a connection is established properly, all the three letters of his name are capitalized. To me, only two letters are capitalized. Here I was stuck. What can I do? I really need help, I want to use FreeBSD. But I can not use it without an Internet connection.


----------



## jb_fvwm2 (Feb 15, 2012)

```
set log local Phase Chat Connect LCP IPC  CCP CBCP tun command
```
 A while since I've used it, but the "local" word in your ppp.conf may help see errors locally, which you can otherwise investigate (Howsoever, other words in that line may need to be changed or deleted for the ppp.conf to continue working). Of course, you may need an internet connection to check forums for the new errors you may be seeing.


----------



## Horos (Feb 16, 2012)

I have already introduced the word "local" in my ppp.conf file. I transcribe my ppp.conf file. Here is it:


```
default:
 set local log Phase Chat LCP IPCP CCP tun command
 ident user-ppp VERSION

 set device /dev/cuaU0.0
 set speed 115200

vodafone:
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
 \"\" \
 AT OK-AT-OK \
 AT+CFUN=1 OK-AT-OK \
 AT+CSQ OK \
 AT+CGDCONT=1,\\\"IP\\\",\\\"APN\\\" OK \
 AT+CGACT? OK-AT-OK \
 AT+CGATT? OK \
 AT+CGCLASS? OK \
 AT+COPS=0,0,"RO Vodafone RO",2 OK \
 ATD*99# CONNECT"

 set timeout 180
 enable dns
 resolv writable
 set crtscts on
 disable vjcomp
 disable acfcomp
 disable deflate
 disable deflate24
 disable pred1
 disable protocomp
 disable mppe
 disable ipv6cp
 disable lqr
 disable echo

papchap:
 set phone *99#
 set authname name
 set authkey pass

 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
 add default HISADDR
```

Name, pass and APN are correct, I am sure.

I entered the command:


```
ppp vodafone
```

And I see what happens. Sorry I can not transcribe the command output, it might be relevant.  But I try to describe what happens. In short, it creates a connection, get the DNS addresses (which is incorrect, I checked) and then the connection is closed (logout). It is not just that the DNS addresses is wrong, but that connection is lost. What can I try? I have exhausted the possibilities. 

I do not know very well FreeBSD, but using Linux. With Linux, the modem works well. Why does it not work with FreeBSD?


----------



## gpw928 (Mar 1, 2012)

Hi,

Please read these archives (following the links they contain might also help):


http://forums.freebsd.org/showthread.php?t=27874

http://forums.freebsd.org/showthread.php?t=24800

http://forums.freebsd.org/showthread.php?t=22324

Set the logging to "set log Phase Chat Connect" in /etc/ppp/ppp.conf.

Make any other changes that seem appropriate.

Truncate the log file (as root):


```
>/var/log/ppp.log
```

Try it again:


```
/usr/sbin/ppp -ddial <tag>
```

Where "<tag>" is a label identifying your ISP in /etc/ppp/ppp.conf.

Then post a copy of your ppp config files, and the log (/var/log/ppp.log).

We do need to see the config files and the logs!

(You may have to upload the log if it's too large to post.)

Cheers,

-- 
Phil


----------



## Horos (Mar 5, 2012)

gpw928, thank you for reply. I will try your suggestions. But I do not know how to post the log PPP daemon, because Linux can not read data from FreeBSD partition (I have a dual-boot FreeBSD/Debian Testing).
Is there any way to read, in Linux, UFS2 partition? Frankly speaking, I want to give up the idea of â€‹â€‹having my system FreeBSD. I thought that FreeBSD is better than Linux, but maybe I thought wrong.
Sorry for honesty, but I am exasperated.


----------



## jb_fvwm2 (Mar 5, 2012)

How long before it disconnects?  Does the PPP show, can you use the data stream from another terminal? (BTW a web search "vodafone ppp.conf disconnects" showed a large number of resources)...  (I know the exasperation, it took about two weeks for me to set up dialing in windows, later about a week or two to set up 56k ppp in FreeBSD  for the ISP...)


----------



## Horos (Mar 6, 2012)

I do not quite understand what you mean. In FreeBSD, my modem disconnects fairly quickly, about 10 seconds. Simply can not keep the connection.
I really do not understand why it is so hard to connect the modem with FreeBSD. This modem is supported by FreeBSD, I checked it. It should work well, after editing (correct) ppp.conf file. In Linux, everything works fine, I configured the connection with *pppconfig*.

I think something is missing, and this lack prevents connection. But I do not know what is missing.


----------



## jb_fvwm2 (Mar 6, 2012)

```
set timeout 3000
 enable dns
 set speed 115200 # or 40000
 deny lqr deflate pred1
 disable lqr delfate pred1
 disable mpp3
 disable ipv6
 set reconnect timeout 30
 set parity none
 set accumap a0000
 set mru max 2048
 set mtu max 2048
 ...
```
One of those may fix or break it further?  (I see some
are already in your configuration...)


----------



## Horos (Mar 6, 2012)

Thanks, I'll try that. Out of curiosity, is a ppp.linkup file necessary? I saw some advice in this regard on a website. What should be entered in this file? I checked and my system does not include this file. It must be created manually?


----------



## jb_fvwm2 (Mar 6, 2012)

It is in the source code, but apparantly installworld does not install it by default (or something similar); reading it, it is way beyond my expertise.


----------



## humand (Aug 23, 2012)

jb_fvwm2, your problem is most likely with ppp.conf.
can you try with the followings set dial:

```
set dial "ABORT BUSY TIMEOUT 3 \
        \"\" \
        AT OK-AT-OK \
        AT+CFUN=1 OK-AT-OK \
        AT+CMEE=2 OK-AT-OK \
        AT+CSQ OK \
        AT+CGDCONT=1,\\\"IP\\\",\\\"APN\\\" OK \
        ATD*99# CONNECT"
```
also, clean /var/log/ppp.log before you connect, and post the contents after.


----------



## jb_fvwm2 (Aug 23, 2012)

I was not posting a problem in this thread, you wish to redirect your question to?


----------



## humand (Aug 24, 2012)

My apologies, it was addressed to Horos/iacobus or whoever has problems with ppp.conf in this thread.


----------

