I just registered with Celcom Broadband with no contract. Received a ZTE MF190 USB modem with sim card and working fine in XP. As usual, making it work in OpenBSD is the goal. OpenBSD's umsm listed a few ZTE USB modem as supported USB 3g modem but currently using cu -l cuaU0 will just display "Connected" and hangs there. Tried using cuaU0 to cuaU2 with no avail. I've posted a question in misc@ and a guy have replied and forwarded related emails regarding ZTE USB 3g modem. Thanks for that!. It seems that this type of USB Modem share similar properties as a supported ZTE modem, so no patching is required.
1) Getting info about the USB Modem.
Here's the dmesg after I inserted the usb 3g modem.
umsm0 at uhub0 port 3 configuration 1 interface 0 "ZTE,Incorporated ZTE WCDMA Technologies MSM" rev 2.00/0.00 addr 5
umsm0 detached
umsm0 at uhub0 port 3 configuration 1 interface 0 "ZTE,Incorporated ZTE WCDMA Technologies MSM" rev 2.00/0.00 addr 5
ucom0 at umsm0
umsm1 at uhub0 port 3 configuration 1 interface 1 "ZTE,Incorporated ZTE WCDMA Technologies MSM" rev 2.00/0.00 addr 5
ucom1 at umsm1
umass1 at uhub0 port 3 configuration 1 interface 2 "ZTE,Incorporated ZTE WCDMA Technologies MSM" rev 2.00/0.00 addr 5
umass1: using SCSI over Bulk-Only
scsibus1 at umass1: 2 targets, initiator 0
cd1 at scsibus1 targ 1 lun 0: <ZTE, USB SCSI CD-ROM, 2.31> SCSI2 5/cdrom removable
umsm2 at uhub0 port 3 configuration 1 interface 3 "ZTE,Incorporated ZTE WCDMA Technologies MSM" rev 2.00/0.00 addr 5
ucom2 at umsm2
Here's the usbdevs -v outputs:
Controller /dev/usb0:
addr 1: high speed, self powered, config 1, EHCI root hub(0x0000), Intel(0x8086), rev 1.00
port 1 powered
port 2 powered
port 3 addr 5: high speed, power 500 mA, config 1, ZTE WCDMA Technologies MSM(0x0031), ZTE,Incorporated(0x19d2), rev 0.00, iSerialNumber P671A1CELD010000
port 4 powered
port 5 addr 2: high speed, self powered, config 1, USB2 Hub(0x6560), Cypress Semiconductor(0x04b4), rev 0.0b
port 1 addr 3: high speed, self powered, config 1, USB Multibay IDE 2.466(0x031d), Hewlett Packard(0x03f0), rev 2.46, iSerialNumber HH63MC0BLTC1
port 2 powered
port 3 powered
port 4 addr 4: low speed, power 98 mA, config 1, USB-PS/2 Optical Mouse(0xc03d), Logitech(0x046d), rev 20.00
port 6 powered
port 7 powered
port 8 powered
Controller /dev/usb1:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
port 1 powered
port 2 powered
Controller /dev/usb2:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
port 1 powered
port 2 powered
Controller /dev/usb3:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000), Intel(0x8086), rev 1.00
port 1 powered
port 2 powered
2) Set up the logging environment.
I create /var/log/ppp.log file. Then I vim /etc/syslog.conf and add:
!ppp
*.* /var/log/ppp.log
3) Testing using userland ppp.
So the logging part is done. Now to test the ppp environment. I found that /dev/cuaU2 is the working device for this. I tried /dev/cuaU0 but didn't work. /dev/cuaU1 on the other hand don't have Carrier Detect. Here's my ppp testing result. Bolded texts are my input:
# ppp
Working in interactive mode
Using interface: tun0
ppp ON karlaphp> set device /dev/cuaU2
ppp ON karlaphp> set speed 384000
ppp ON karlaphp> show physical
Name: deflink
State: closed
Device: N/A
Link Type: interactive
Connect Count: 0
Queued Packets: 0
Phone Number: N/A
Defaults:
Device List: "/dev/cuaU2"
Characteristics: 384000bps, cs8, no parity, CTS/RTS on
CD check delay: device specific
Connect time: 0:00:00
0 octets in, 0 octets out
0 packets in, 0 packets out
Overall 0 bytes/sec
ppp ON karlaphp> term
deflink: Entering terminal mode on /dev/cuaU2
Type `~?' for help
AT
OK
ATZ
OK
AT+CGDCONT=1,"IP","celcom3g"
OK
ATDT*99#
CONNECT 7200000
So basically interactive ppp is working, but I haven't got the chance to test my /etc/ppp/ppp.conf script thoroughly as I'm currently at work (yeah I do this at work...). But, for the pleasure of the eyes, here's my current /etc/ppp/ppp.conf script:
default:
set log Phase tun connect
set device /dev/cuaU2
set speed 384000
disable ipv6cp
celcom:
set dial "ABORT BUSY ABORT NO\sCARRIER TIMEOUT 5 \"\" ATZ OK-ATZ-OK AT+CGDCONT=1,\\\"IP\\\",\\\"celcom3g\\\" OK \\dATDT\\T TIMEOUT 40 CONNECT"
# dial number are *99# or *99***1#
set phone "*99#"
set login
set authname ""
set authkey ""
set timeout 0
set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
add default HISADDR
enable dns
If I dialed to celcom, I'll get this warning:
Warning: 0.0.0.0/0: Change route failed: errno: No such process
Warning: ff01:6::/32: Change route failed: errno: Network is unreachable
Warning: ff02:6::/32: Change route failed: errno: Network is unreachable
Warning: ff02:6::/32: Change route failed: errno: Network is unreachable
But I was told (by googling) that it's just a warning and non-fatal. The 2nd to 4th warning is just mentioning about IPV6 so it's nothing.
4) Set up pppd for Celcom 3G.*hip hip, hurray!. hip hip, hurray!*
This is the final part. Instead of using userland ppp, I'll go for pppd. Do man both for informations. Ok for this, I will create 2 files. Here's the steps:
First I'll create and edit /etc/ppp/peers/celcom3g file. On my system, there's no /etc/ppp/peers folder so I mkdir it first. Here's what my /etc/ppp/peers/celcom file looks like:
/dev/ttyU2
debug
384000
noauth
noipdefault
ipcp-restart 10
ipcp-accept-local
ipcp-accept-remote
0.0.0.0:10.64.64.64
defaultroute
novj
connect "chat -v -f /etc/ppp/peers/celcom3g.chat"
Then I created /etc/ppp/peers/celcom3g.chat file. Here's what mine looks like:
ABORT "BUSY"
ABORT "NO CARRIER"
ABORT "ERROR"
ABORT "VOICE"
ABORT "NO DIALTONE"
SAY "Calling Celcom3G...\n"
"" AT
OK ATV1
OK ATE0
OK AT&F&D2&C1S0=0
OK ATS7=60S30=0
OK ATS0=0
OK AT
OK ATV1
OK ATE0
OK AT&F&D2&C1S0=0
OK ATS7=60S30=0
OK ATDT*99#
TIMEOUT 45
CONNECT \d\c
Where the hell did I get the idea for all the AT commands?. Well, I took a peek at the USB Modem's log in XP. If you google for Celcom 3G ppp script, you'll most probably notice that I don't have the familiar AT+CGDCONT=1,"IP","celcom3g" command. Do I need it? For now, I don't think so, because I'm updating this while I'm on Celcom 3G! Using that chat script. Why don't I need it? I don't know, honestly. But it's working. You'll also notice that ATDT*99# means that I'm dialing *99#, if you want to use *99***1#, just replace that test appropriately. Oh, I almost forgot how to dial using pppd. First, I created ppp0 links:
# sudo ifconfig ppp0 create
Then dial using pppd:
# pppd call celcom3g
If your script is named other than celcom3g, replace the celcom3g to your file name. To check the log, use tail -f /var/log/daemon to see if there's anything weird, or if reading log files is one of your fetish. How to disconnect from the connection? I just use ps aux | grep ppp and then kill pid and finally ifconfig ppp0 destroy. Do search for scripts that simplifies it.
After I disabled my http_proxy, I can browse the net with no issue. So I set my Firefox to Use system proxy settings. Speaking of which, I need to find a way to automate turning on/off http_proxy depending on whether I'm in the office (proxy) or at home (no proxy). That'll be my next project. As usual, any tips is much appreciated. Later and enjoy!
Edit: I've replace /dev/cuaU2 to /dev/ttyU2. man 4 tty for more info.
Tuesday, March 29, 2011
Tuesday, March 08, 2011
OpenBSD NC4200: My .profile for TERM type. xterm-256color / wsvt25.
OpenBSD have 256 color support in xterm, which is xterm-256color. For console, setting the TERM to wsvt25 is better. Color will work but weird stuff will happen is you use xterm term type for console, such as funny scrolling while ls-ing, tmux behaving weirdly and other stuff. But is I use wsvt25 as my term type, mp3blaster won't work correctly, vim color scheme (I use wombat scheme) will display white background instead of the dark background. So, I have to set my .profile to detect the original term type and change it to the color version.
In console, the original term type is vt220, so I'll use wsvt25 for color but mp3blaster won't work correctly. In X, the term is xterm so I'll use xterm-256color instead.
I open up .profile and put the lines below.
# This is to check the TERM and change accordingly.
if [[ $TERM = xterm ]];
then export TERM="xterm-256color";
else
export TERM="wsvt25";
fi
Then my console and xterm will have appropriate color enabled. Later then.
In console, the original term type is vt220, so I'll use wsvt25 for color but mp3blaster won't work correctly. In X, the term is xterm so I'll use xterm-256color instead.
I open up .profile and put the lines below.
# This is to check the TERM and change accordingly.
if [[ $TERM = xterm ]];
then export TERM="xterm-256color";
else
export TERM="wsvt25";
fi
Then my console and xterm will have appropriate color enabled. Later then.
Friday, March 04, 2011
OpenBSD NC4200: Apache + PostgreSQL + PHP5 + P4A. Another interesting project.
Ok this is my current project. I'm exploring PHP now and because I only have a little knowledge on programming PHP, I need to use some sort of RAD / Visual tool to start building PHP website fast. I read that P4A - PHP For Applications - PHP RAD Framework is one of the tool that can be use so I'm exploring that now. So I need to build a OAPP (OpenBSD + Apache + PostgreSQL + PHP) environment on my 4.8. I would love a pre-built stack for this but AFAIK, there's none for OpenBSD. It's not a bad thing though because manual installation is better for my brain somehow.
1) Setting up Apache
OpenBSD have a custom Apache 1.3 installed by default. There's also Apache 2 package but I'll just focus with what's already there. To get the Apache running I just edit /etc/rc.conf.local and add:
httpd_flags=""
2) Setting up PostgreSQL
I installed these packages:
postgresql-server-8.4.4
postgresql-client-8.4.4
postgresql-docs-8.4.4
After installation, you can see the brief steps you need to take to enable PostgreSQL. I had problem using su - _postgresql because I kept getting wrong password. After searching for answer, I found a way for that.
2.1) Set password for _postgresql
# su
# passwd _postgresql
Then after the password for user _postgresql has been set, I can finally follow the brief tips for starting up PostgreSQL (which can also be read at /usr/local/share/doc/postgresql/README.OpenBSD).
# su - _postgresql
# mkdir /var/postgresql/data
# initdb -D /var/postgresql/data -U postgres -A md5 -W
You can follow the rest of the steps contained inside /usr/local/share/doc/postgresql/README.OpenBSD. I also read somewhere on the net that I need to edit /etc/rc.conf.local and add this line:
postgres_flags=""
2.2) Set up phpPgAdmin
I installed phpPgAdmin-4.2.3 package which will also install core php5 packages. I had a problem trying to log in to phpPgAdmin using postgres id which has been created earlier. After googling for answer, here's the way to do that. Edit the file /var/www/phpPgAdmin/conf/config.inc.php. Then edit/add the bolded text.
// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';
// If extra login security is true, then logins via phpPgAdmin with no
// password or certain usernames (pgsql, postgres, root, administrator)
// will be denied. Only set this false once you have read the FAQ and
// understand how to change PostgreSQL's pg_hba.conf to enable
// passworded local connections.
$conf['extra_login_security'] = false;
Then after that I can log in using postgres id and manage the PostgreSQL database. There's also pgadmin3 program which uses wxWidget, a GUI program to manage PostgreSQL database.
3) Install PHP5
As I wanted to try out P4A - PHP For Applications - PHP RAD Framework, the relevant PHP5 packages I installed is:
php5-core-5.2.13p0
php5-pdo_pgsql-5.2.13p0
php5-pgsql-5.2.13p0
Installation is straightforward and there's brief description on how to enable PHP5 support + testing out PHP5.
4) Set up P4A - PHP For Applications - PHP RAD Framework
http://p4a.sourceforge.net/ have the nescessary files for the application. I downloaded p4a-3.8.1.zip from the site, unzip the package and rename the p4a-3.8.1 folder to p4a. After that I move the folder to /var/www/htdocs/. When I open up http://localhost/p4a/ using Firefox, I can see the P4A page.I'm currently having problem viewing the hello_world sample page correctly and I'm trying to find some answer for that. This RAD program is made for linux but I noticed there's OpenBSD user using it too. So I guess there's a way for me to get it to work correctly.
5) Install NetBeans + PHP plugins.
I installed NetBeans 6.9 from OpenBSD's package. I know NetBeans still have weird character issue on compiling Java codes but I'm not using NetBeans to write Java program. Instead, I want to use NetBeans to write PHP codes. So after I installed NetBeans from package, I installed PHP related plugins. After that, I wrote the hello_world sample P4A code which is available in the P4A website and wallah! It's working. I've also linked NetBeans with PostgreSQL and it's working fine.
So far, all is ok. I'm studying PHP bits by bits, slowly as a serious hobby rather than serious work. One thing for sure, this is a start. Later.
1) Setting up Apache
OpenBSD have a custom Apache 1.3 installed by default. There's also Apache 2 package but I'll just focus with what's already there. To get the Apache running I just edit /etc/rc.conf.local and add:
httpd_flags=""
2) Setting up PostgreSQL
I installed these packages:
postgresql-server-8.4.4
postgresql-client-8.4.4
postgresql-docs-8.4.4
After installation, you can see the brief steps you need to take to enable PostgreSQL. I had problem using su - _postgresql because I kept getting wrong password. After searching for answer, I found a way for that.
2.1) Set password for _postgresql
# su
# passwd _postgresql
Then after the password for user _postgresql has been set, I can finally follow the brief tips for starting up PostgreSQL (which can also be read at /usr/local/share/doc/postgresql/README.OpenBSD).
# su - _postgresql
# mkdir /var/postgresql/data
# initdb -D /var/postgresql/data -U postgres -A md5 -W
You can follow the rest of the steps contained inside /usr/local/share/doc/postgresql/README.OpenBSD. I also read somewhere on the net that I need to edit /etc/rc.conf.local and add this line:
postgres_flags=""
2.2) Set up phpPgAdmin
I installed phpPgAdmin-4.2.3 package which will also install core php5 packages. I had a problem trying to log in to phpPgAdmin using postgres id which has been created earlier. After googling for answer, here's the way to do that. Edit the file /var/www/phpPgAdmin/conf/config.inc.php. Then edit/add the bolded text.
// Hostname or IP address for server. Use '' for UNIX domain socket.
// use 'localhost' for TCP/IP connection on this computer
$conf['servers'][0]['host'] = 'localhost';
// If extra login security is true, then logins via phpPgAdmin with no
// password or certain usernames (pgsql, postgres, root, administrator)
// will be denied. Only set this false once you have read the FAQ and
// understand how to change PostgreSQL's pg_hba.conf to enable
// passworded local connections.
$conf['extra_login_security'] = false;
Then after that I can log in using postgres id and manage the PostgreSQL database. There's also pgadmin3 program which uses wxWidget, a GUI program to manage PostgreSQL database.
3) Install PHP5
As I wanted to try out P4A - PHP For Applications - PHP RAD Framework, the relevant PHP5 packages I installed is:
php5-core-5.2.13p0
php5-pdo_pgsql-5.2.13p0
php5-pgsql-5.2.13p0
Installation is straightforward and there's brief description on how to enable PHP5 support + testing out PHP5.
4) Set up P4A - PHP For Applications - PHP RAD Framework
http://p4a.sourceforge.net/ have the nescessary files for the application. I downloaded p4a-3.8.1.zip from the site, unzip the package and rename the p4a-3.8.1 folder to p4a. After that I move the folder to /var/www/htdocs/. When I open up http://localhost/p4a/ using Firefox, I can see the P4A page.
5) Install NetBeans + PHP plugins.
I installed NetBeans 6.9 from OpenBSD's package. I know NetBeans still have weird character issue on compiling Java codes but I'm not using NetBeans to write Java program. Instead, I want to use NetBeans to write PHP codes. So after I installed NetBeans from package, I installed PHP related plugins. After that, I wrote the hello_world sample P4A code which is available in the P4A website and wallah! It's working. I've also linked NetBeans with PostgreSQL and it's working fine.
So far, all is ok. I'm studying PHP bits by bits, slowly as a serious hobby rather than serious work. One thing for sure, this is a start. Later.
Subscribe to:
Posts (Atom)
6.5 amd64: Modify existing certbot certificates.
Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...
-
Now FreeBSD has version 6.x fer production purpose and 7 fer current. I missed quite a release nowadays. But 1 of the most important news I...
-
Update: My Updated wmiirc Status Bar Script is the recent version, there's a bit of error in the script below so you guys better take a...
-
Ok. I'm still testing to get auto proxy setting script. But in the mean time, you can copy and use this simple script to dial/disconnect...