Difference between revisions of "Data connection procedure using PPP"

From Yantrr Wiki
Jump to: navigation, search
(Created page with "* Place a data enabled mini-SIM in the SIM card slot and connect a GSM antenna to the respective 2G/3G antenna connector. * Ensure that the power jumpers J2 and J3(ignore if b...")
 
 
Line 103: Line 103:
 
  Init3 = at+cgdcont=1,"ip","APN"
 
  Init3 = at+cgdcont=1,"ip","APN"
 
  Stupid Mode = 1
 
  Stupid Mode = 1
 +
 +
'''Note:''' Consult your network provider for exact details in case you are facing any difficulties. 
 +
 +
* Now save and exit the wvdial.conf file.
 +
* Next we have to establish wvdial connection. (In this example we have taken airtel-3G micro-SIM card)
 +
 +
wvdial Airtel_3G
 +
 +
'''NOTE:''' Here you may get some errors like
 +
 +
warning, can't find address for `www.suse.de`
 +
--> warning, address lookup does not work
 +
--> Nameserver (DNS) failure, the connection may not work.
 +
 +
For this you have to edit your wvdial.conf file correctly by verifying the details with the service provider of your SIM card. You can also try:
 +
 +
In the following file /etc/ppp/peers/wvdial, comment or remove usepeerdns
 +
 +
nano /etc/ppp/peers/wvdial
 +
 +
noauth
 +
name wvdial
 +
#usepeerdns
 +
 +
And in /etc/wvdial.conf, add following two lines in the column of your internet service provider:
 +
 +
nano /etc/wvdial.conf
 +
 +
check DNS = no
 +
auto DNS = no
 +
 +
* Now we will check whether connection is established or not.
 +
 +
root@Yantrr:~# ifconfig
 +
eth0  Link encap:Ethernet  HWaddr 6c:ec:eb:64:98:ce 
 +
    inet addr:192.168.1.150  Bcast:192.168.1.255  Mask:255.255.255.0
 +
    inet6 addr: fe80::6eec:ebff:fe64:98ce/64 Scope:Link
 +
    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 +
    RX packets: 20930 errors: 0 dropped: 2409 overruns: 0 frame: 0
 +
    TX packets: 4791 errors: 0 dropped: 0 overruns: 0 carrier: 0
 +
    collisions:0 txqueuelen:1000
 +
    RX bytes:4089157 (3.8 MiB)  TX bytes:533725 (521.2 KiB)
 +
    Interrupt:40
 +
lo    Link encap:Local Loopback 
 +
    inet addr:127.0.0.1  Mask:255.0.0.0
 +
    inet6 addr: ::1/128 Scope:Host
 +
    UP LOOPBACK RUNNING  MTU:65536  Metric:1
 +
    RX packets: 160 errors: 0 dropped: 0 overruns: 0 frame: 0
 +
    TX packets: 160 errors: 0 dropped: 0 overruns: 0 carrier: 0
 +
    Collisions: 0 txqueuelen: 0
 +
    RX bytes:14652 (14.3 KiB)  TX bytes:14652 (14.3 KiB)
 +
'''ppp0  Link encap:Point-to-Point Protocol 
 +
    inet addr:100.105.62.223  P-t-P:10.64.64.64  Mask:255.255.255.255
 +
    UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
 +
    RX packets: 7 errors: 0 dropped: 0 overruns: 0 frame: 0
 +
    TX packets: 17 errors: 0 dropped: 0 overruns: 0 carrier: 0
 +
    collisions:0 txqueuelen:3
 +
    RX bytes:130 (130.0 B)  TX bytes:937 (937.0 B)
 +
 +
* You can also check ip route :
 +
root@Yantrr:~# ip route
 +
default via 192.168.1.1 dev eth0
 +
10.64.64.64 dev ppp0  proto kernel  scope link  src 100.106.85.110
 +
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.150
 +
 +
* Next is to get the information about the hosts, gateways etc. For this you should view the routing table
 +
 +
root@Yantrr:~# route -n
 +
Kernel IP routing table
 +
Destination Gateway          Genmask          Flags    Metric    Ref      Use    iface
 +
0.0.0.0    192.168.1.1    0.0.0.0        UG     0      0          0      eth0     
 +
10.64.64.64    0.0.0.0        255.255.255.255      UH      0     0          0      ppp0
 +
192.168.1.0    0.0.0.0        255.255.255.0        U     0      0    0      eth0
 +
 +
* Here you can see gateway is not initialised to ppp0 protocol which has an IP 10.64.64.64 and also in ip route ,it shows “default via 192.168.1.1 dev eth0” which should be changed to “default via 10.64.64.64 dev ppp0”
 +
* For that you have to type following commands:
 +
 +
# GW=$(ip address show ppp0 | awk '/peer/ {print $4}' | cut -d"/" -f1)
 +
# echo $GW
 +
# /sbin/ip route replace default via $GW dev ppp0
 +
 +
* Now if you check routing table
 +
 +
Destination Gateway    Genmask    Flags  Metric  Ref Use  Iface
 +
0.0.0.0    10.64.64.64 0.0.0.0      UG 0  0    0    ppp0
 +
10.64.64.64 0.0.0.0    255.255.255.255  UH 0  0    0    ppp0
 +
192.168.1.0 0.0.0.0    255.255.255.0      U 0  0    0    eth0
 +
 +
* Also the ip route command changes to
 +
 +
root@Yantrr:~# ip route
 +
default via 10.64.64.64 dev ppp0
 +
10.64.64.64 dev ppp0  proto kernel  scope link  src 100.106.85.110
 +
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.150
 +
 +
* Now you are ready to use the internet connection via ppp0.
 +
* You can check the connections by using ping command.
 +
* Also check the file /etc/resolv.conf 
 +
 +
nano /etc/resolv.conf
 +
 +
* The content of file should be
 +
 +
nameserver 192.168.1.150
 +
nameserver 8.8.8.8
 +
 +
'''Note:''' Another error that can arise while you ping any IP is that it may reach the DNS but could not transmit packets. For eg:
 +
 +
root@Yantrr:~# ping 8.8.8.8
 +
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
 +
--- 8.8.8.8 ping statistics ---
 +
6 packets transmitted, 0 received, 100% packet loss, time 5000ms
 +
 +
For this also you have to check your wvdial configurations and also the routing table.

Latest revision as of 00:22, 13 July 2016

  • Place a data enabled mini-SIM in the SIM card slot and connect a GSM antenna to the respective 2G/3G antenna connector.
  • Ensure that the power jumpers J2 and J3(ignore if battery feature present) on VIBE2 are in place and eeprom address set at 0x54 using dip switch S7
  • Power up VIBE2 using the 5V, 5A DC adapter (supplied with VIBE2).
  • After powering up and bootup, ssh into VIBE2 through Ethernet Cable (at IP 192.168.1.150 for preflashed eMMC images)
ssh -l root 192.168.1.150
  • Username for root login is root and password is root. For user login, username is debian and password is temppwd.
  • Then you have to check modem using lsusb command.

Note: Please ensure that the user leds on the board is glowing according to its functionality after booting/powering the board.

root@Yantrr:~# lsusb
Bus 001 Device 002: ID 0424:2412 Standard Microsystems Corp.
Bus 002 Device 002: ID 21f5:2012  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • Now there are two ways to setup ppp0 connections:

a. ppp daemon

  • For setting it, you have to open /etc/ppp/peers/airtel file (we used airtel SIM).
nano /etc/ppp/peers/airtel
  • From the opened window, you can verify the username for your service provider.
hide-password
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/airtel"
debug
/dev/ttyUSB3
460800
#defaultroute
replacedefaultroute
noipdefault
user "airtel"
remotename airtel
  • Now you can use pon command.
pon airtel
  • You can check whether ppp0 connection is up or not.
root@Yantrr:~# ifconfig
eth0  	Link encap:Ethernet  HWaddr 6c:ec:eb:64:98:ce  
    	inet addr:192.168.1.150  Bcast:192.168.1.255  Mask:255.255.255.0
    	inet6 addr: fe80::6eec:ebff:fe64:98ce/64 Scope:Link
    	UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    	RX packets: 20930 errors: 0 dropped: 2409 overruns: 0 frame: 0
    	TX packets: 4791 errors: 0 dropped: 0 overruns: 0 carrier: 0
    	collisions:0 txqueuelen:1000
    	RX bytes:4089157 (3.8 MiB)  TX bytes:533725 (521.2 KiB)
    	Interrupt:40
lo    	Link encap:Local Loopback  
    	inet addr:127.0.0.1  Mask:255.0.0.0
    	inet6 addr: ::1/128 Scope:Host
    	UP LOOPBACK RUNNING  MTU:65536  Metric:1
    	RX packets: 160 errors: 0 dropped: 0 overruns: 0 frame: 0
    	TX packets: 160 errors:
ppp0  	Link encap:Point-to-Point Protocol
    	inet addr:100.105.62.223  P-t-P:10.64.64.64  Mask:255.255.255.255
    	UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
    	RX packets: 7 errors: 0 dropped: 0 overruns: 0 frame: 0
    	TX packets: 17 errors: 0 dropped: 0 overruns: 0 carrier: 0
    	collisions:0 txqueuelen:3
    	RX bytes:130 (130.0 B)  TX bytes:937 (937.0 B)
  • Now you can check connections using commands given further in the document.

b.Wvdial

  • First we will setup ppp0 connections using wvdial.
  • For this you have to install wvdial tool using command.
sudo apt -get install wvdial
  • Now we have to set the configuration of wvdial using wvdial.conf file. For this type
nano /etc/wvdial.conf
  • Assuming that you have the USERNAME, PASSWORD and APN available for the service provider of the SIM card being used, edit and make wvdial.conf file like this. Sample Wvdial files for some service providers are given HERE
  • NOTE: Also verify the modem port mentioned in the wvdial.conf file with actual modem port.

For ZTE model- /dev/ttyUSB3

For SEW Strong Rising model- /dev/ttyUSB0

[Dialer Defaults]
Modem Type = Analog
ModemPhone = *99#
ISDN = 0
Baud = 115200
Username = USERNAME
Password = PASSWORD
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = at+cgdcont=1,"ip","APN"
Stupid Mode = 1

Note: Consult your network provider for exact details in case you are facing any difficulties.

  • Now save and exit the wvdial.conf file.
  • Next we have to establish wvdial connection. (In this example we have taken airtel-3G micro-SIM card)
wvdial Airtel_3G

NOTE: Here you may get some errors like

warning, can't find address for `www.suse.de`
--> warning, address lookup does not work
--> Nameserver (DNS) failure, the connection may not work.

For this you have to edit your wvdial.conf file correctly by verifying the details with the service provider of your SIM card. You can also try:

In the following file /etc/ppp/peers/wvdial, comment or remove usepeerdns

nano /etc/ppp/peers/wvdial
noauth
name wvdial
#usepeerdns

And in /etc/wvdial.conf, add following two lines in the column of your internet service provider:

nano /etc/wvdial.conf
check DNS = no
auto DNS = no
  • Now we will check whether connection is established or not.

root@Yantrr:~# ifconfig

eth0  	Link encap:Ethernet  HWaddr 6c:ec:eb:64:98:ce  
    	inet addr:192.168.1.150  Bcast:192.168.1.255  Mask:255.255.255.0
    	inet6 addr: fe80::6eec:ebff:fe64:98ce/64 Scope:Link
    	UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    	RX packets: 20930 errors: 0 dropped: 2409 overruns: 0 frame: 0
    	TX packets: 4791 errors: 0 dropped: 0 overruns: 0 carrier: 0
    	collisions:0 txqueuelen:1000
    	RX bytes:4089157 (3.8 MiB)  TX bytes:533725 (521.2 KiB)
    	Interrupt:40
lo    	Link encap:Local Loopback  
    	inet addr:127.0.0.1  Mask:255.0.0.0
    	inet6 addr: ::1/128 Scope:Host
    	UP LOOPBACK RUNNING  MTU:65536  Metric:1
    	RX packets: 160 errors: 0 dropped: 0 overruns: 0 frame: 0
    	TX packets: 160 errors: 0 dropped: 0 overruns: 0 carrier: 0
    	Collisions: 0 txqueuelen: 0
    	RX bytes:14652 (14.3 KiB)  TX bytes:14652 (14.3 KiB)
ppp0  	Link encap:Point-to-Point Protocol  
    	inet addr:100.105.62.223  P-t-P:10.64.64.64  Mask:255.255.255.255
    	UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
    	RX packets: 7 errors: 0 dropped: 0 overruns: 0 frame: 0
    	TX packets: 17 errors: 0 dropped: 0 overruns: 0 carrier: 0
    	collisions:0 txqueuelen:3
    	RX bytes:130 (130.0 B)  TX bytes:937 (937.0 B)
  • You can also check ip route :
root@Yantrr:~# ip route
default via 192.168.1.1 dev eth0
10.64.64.64 dev ppp0  proto kernel  scope link  src 100.106.85.110
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.150
  • Next is to get the information about the hosts, gateways etc. For this you should view the routing table
root@Yantrr:~# route -n
Kernel IP routing table
Destination 	Gateway          Genmask          Flags    Metric     Ref      Use    iface
0.0.0.0     	192.168.1.1    0.0.0.0     	    UG	    0  	     0          0      eth0      
10.64.64.64    0.0.0.0        255.255.255.255      UH      0	     0          0      ppp0
192.168.1.0    0.0.0.0        255.255.255.0         U 	    0  	     0    	0      eth0
  • Here you can see gateway is not initialised to ppp0 protocol which has an IP 10.64.64.64 and also in ip route ,it shows “default via 192.168.1.1 dev eth0” which should be changed to “default via 10.64.64.64 dev ppp0”
  • For that you have to type following commands:
# GW=$(ip address show ppp0 | awk '/peer/ {print $4}' | cut -d"/" -f1)
# echo $GW
# /sbin/ip route replace default via $GW dev ppp0
  • Now if you check routing table
Destination 	Gateway     	Genmask     	 Flags  Metric  Ref	Use   Iface
0.0.0.0     	10.64.64.64 	0.0.0.0     	  UG	 0  	 0    	0     ppp0
10.64.64.64 	0.0.0.0     	255.255.255.255   UH	 0  	 0    	0     ppp0
192.168.1.0 	0.0.0.0     	255.255.255.0      U 	 0  	 0    	0     eth0
  • Also the ip route command changes to
root@Yantrr:~# ip route
default via 10.64.64.64 dev ppp0
10.64.64.64 dev ppp0  proto kernel  scope link  src 100.106.85.110
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.150
  • Now you are ready to use the internet connection via ppp0.
  • You can check the connections by using ping command.
  • Also check the file /etc/resolv.conf
nano /etc/resolv.conf
  • The content of file should be
nameserver 192.168.1.150
nameserver 8.8.8.8

Note: Another error that can arise while you ping any IP is that it may reach the DNS but could not transmit packets. For eg:

root@Yantrr:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 5000ms

For this also you have to check your wvdial configurations and also the routing table.