INSTALACJA URUCHOMIENIE MODEMU GSM AERO2 LINUX DEBIAN


   apt-get install wvdial 

------------------------------------------------

 apt-get install wvdial
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libuniconf4.6 libwvstreams4.6-base libwvstreams4.6-extras
The following NEW packages will be installed:
  libuniconf4.6 libwvstreams4.6-base libwvstreams4.6-extras wvdial
0 upgraded, 4 newly installed, 0 to remove and 12 not upgraded.
Need to get 1,071 kB of archives.
After this operation, 2,606 kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.no.debian.org/debian/ wheezy/main libwvstreams4.6-base i386 4.6                             .1-5 [265 kB]
Get:2 http://ftp.no.debian.org/debian/ wheezy/main libwvstreams4.6-extras i386 4                             .6.1-5 [515 kB]
Get:3 http://ftp.no.debian.org/debian/ wheezy/main libuniconf4.6 i386 4.6.1-5 [1                             86 kB]
Get:4 http://ftp.no.debian.org/debian/ wheezy/main wvdial i386 1.61-4.1 [104 kB]
Fetched 1,071 kB in 17s (60.6 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libwvstreams4.6-base.
(Reading database ... 147685 files and directories currently installed.)
Unpacking libwvstreams4.6-base (from .../libwvstreams4.6-base_4.6.1-5_i386.deb)                              ...
Selecting previously unselected package libwvstreams4.6-extras.
Unpacking libwvstreams4.6-extras (from .../libwvstreams4.6-extras_4.6.1-5_i386.d                             eb) ...
Selecting previously unselected package libuniconf4.6.
Unpacking libuniconf4.6 (from .../libuniconf4.6_4.6.1-5_i386.deb) ...
Selecting previously unselected package wvdial.
Unpacking wvdial (from .../wvdial_1.61-4.1_i386.deb) ...
Processing triggers for man-db ...
Setting up libwvstreams4.6-base (4.6.1-5) ...
Setting up libwvstreams4.6-extras (4.6.1-5) ...
Setting up libuniconf4.6 (4.6.1-5) ...
Setting up wvdial (1.61-4.1) ...

Sorry.  You can retry the autodetection at any time by running "wvdialconf".
   (Or you can create /etc/wvdial.conf yourself.)


----------------------------------------------------------




Po woeniu modemu w gniazdo USB, sprawdzamy jak system widzi sprzt:

  lsusb | grep Huawei 

Bus 002 Device 007: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard



Najpierw naley sprbowa rcznie przeczy tryb modemu:


usb_modeswitch -v 12d1 -p 1001 -H 1

Looking for default devices ...
 No devices in default mode found. Nothing to do. Bye.

----------------------------------------------------

 usb_modeswitch -v 12d1 -p 14fe -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" 

----------------------------------------------------------------

  ls /dev/ttyUSB* 


------------------------------


usb_modeswitch -v 12d1 -p 14fe -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000"

Looking for target devices ...
   found matching product ID
   adding device
 Found devices in target mode or class (1)
Looking for default devices ...
 No devices in default mode found. Nothing to do. Bye.


-----------------------------------------------------------


  vi /etc/wvdial.conf 


[Dialer aero]
Init1 = ATZ
#Init2 = AT+CPIN=2283   # za pierwszym razem  trzeba odblokowac lub wpisac w inny sposob  

#Init3 = ATZ
Username =;
Password =;

;Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init4 = AT+CGDCONT=1,"IP","darmowy"
Phone = *99#
Stupid mode = yes
Dial Attempts = 0
Auto DNS = 1


;#Auto DNS = on

;Stupid mode = yes
;Phone = *99#



;Modem Type = USB Modem
; Phone = 
;::ISDN = 0
;Modem = /dev/ttyACM0
Modem = /dev/ttyUSB0


-----------------------------



  wvdial aero 


--bad init string




--------------------------------

[Dialer aero]
Init1 = ATZ
Init2 = AT+CPIN=2280

wvdial aero

--> Sending: AT+CPIN=2280
+CME ERROR: 3
--> Bad init string.
--> Disconnecting at Tue Feb 12 15:42:56 2013


----------------------------
[Dialer aero]
Init1 = ATZ
#Init2 = AT+CPIN=2280

wvdial aero
------------------------------


  ifconfig 


ppp0      Link encap:Point-to-Point Protocol
          inet addr:37.209.159.146  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:224 (224.0 B)  TX bytes:305 (305.0 B)




==============================

   vi /etc/init.d/rc.masq9 


========================

# uruchomienie przekazywania pakietow IP miedzy interfejsami
echo "1" > /proc/sys/net/ipv4/ip_forward

# Wlaczenie mechanizmu wykrywania oczywistych falszerstw
echo "1" > /proc/sys/net/ipv4/conf/all/rp_filter

# Ochrona przed atakiem typu Smurf
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

# Nie aktceptujemy pakietow "source route"
echo "0" > /proc/sys/net/ipv4/conf/all/accept_source_route

# Nie przyjmujemy pakietow ICMP rediect, ktore moga zmienic tablice routingu
echo "0" > /proc/sys/net/ipv4/conf/all/accept_redirects

# Wlaczamy ochrone przed blednymi komunikatami ICMP error
echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses

# Wlacza logowanie dziwnych (spoofed, source routed, redirects) pakietow
echo "1" > /proc/sys/net/ipv4/conf/all/log_martians

#############3

# Limitowanie sesji tcp
#echo "30" > /proc/sys/net/ipv4/tcp_fin_timeout
#echo "2400" > /proc/sys/net/ipv4/tcp_keepalive_time
#echo "0" > /proc/sys/net/ipv4/tcp_window_scaling
#echo "0" > /proc/sys/net/ipv4/tcp_sack
#echo "20" > /proc/sys/net/ipv4/ipfrag_time
#echo "1280" > /proc/sys/net/ipv4/tcp_max_syn_backlog

# TCP timestamps protection
echo "1" > /proc/sys/net/ipv4/tcp_timestamps

# Ignore redirected packets
echo "0" > /proc/sys/net/ipv4/conf/all/send_redirects

# uruchomienie przekazywania pakietow IP miedzy interfejsami
echo "1" > /proc/sys/net/ipv4/ip_forward

echo "1" > /proc/sys/net/ipv4/tcp_syncookies



ipt=`which iptables`


#blokujemy dopuszczalny ruch w dwie strony
$ipt -t filter -P FORWARD ACCEPT
$ipt -t filter -P INPUT DROP
$ipt -t filter -P OUTPUT  ACCEPT



# Pozwalamy pakietom biegac po naszym komputerze
# czyli odblokowujemy petle zwrotna LOOPBACK
$ipt -A INPUT -i lo -j ACCEPT                   # aby sie wylaczyl portmap
$ipt -A OUTPUT -o lo -j ACCEPT
$ipt -A FORWARD -o lo -j ACCEPT


# Zapisujemy caly nasz ruch w logach
$ipt -A INPUT -j LOG -m limit --limit 15/hour              # 15 logóa godzine
$ipt -A OUTPUT -j LOG -m limit --limit 15/hour
$ipt -A FORWARD -j LOG -m limit --limit 15/hour


####################################################################
####################################################################
#################### INPUT   ##########################
####################################################################




$ipt -A INPUT -p tcp --dport 65534  -j ACCEPT
$ipt -A INPUT -p tcp --dport 21  -j ACCEPT
$ipt -A INPUT -p tcp --dport 22  -j ACCEPT
$ipt -A INPUT -p tcp --dport 80  -j ACCEPT
$ipt -A INPUT -p tcp --dport 443  -j ACCEPT
$ipt -A INPUT -p tcp --dport 3306  -j ACCEPT
$ipt -A INPUT -p tcp --dport 8080  -j ACCEPT



# dostep do DNS
$ipt -A INPUT -p tcp --sport 53  -j ACCEPT
$ipt -A INPUT -p tcp --dport 53  -j ACCEPT


$ipt -A INPUT -p udp --sport 53  -j ACCEPT
$ipt -A INPUT -p udp --dport 53  -j ACCEPT



####################################################################
#################### FORWARD   ##########################
####################################################################


$ipt -A FORWARD -p udp --sport 53  -j ACCEPT
$ipt -A FORWARD  -p udp --dport 53  -j ACCEPT

$ipt -A FORWARD -p tcp --sport 53  -j ACCEPT
$ipt -A FORWARD  -p tcp  --dport 53  -j ACCEPT


################   MASQUERADE     ############################

$ipt -A FORWARD -s 192.168.10.0/255.255.255.0 -d 0/0 -j ACCEPT
$ipt -A FORWARD -s 0/0 -d 192.168.10.0/255.255.255.0 -j ACCEPT

#----------------------------------------------

$ipt -t nat -A POSTROUTING -s 192.168.10.2 -d 0/0 -j MASQUERADE
$ipt -t nat -A POSTROUTING -s 192.168.10.3 -d 0/0 -j MASQUERADE
$ipt -t nat -A POSTROUTING -s 192.168.10.4 -d 0/0 -j MASQUERADE
$ipt -t nat -A POSTROUTING -s 192.168.10.5 -d 0/0 -j MASQUERADE
$ipt -t nat -A POSTROUTING -s 192.168.10.9 -d 0/0 -j MASQUERADE
$ipt -t nat -A POSTROUTING -s 192.168.10.7 -d 0/0 -j MASQUERADE
$ipt -t nat -A POSTROUTING -s 192.168.10.11 -d 0/0 -j MASQUERADE


=====================================================

root@SRVBAZA:~# chmod a+x /etc/init.d/rc.masq9
================================


vi /etc/network/interfaces

==================================

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 192.168.10.1
        netmask 255.255.255.0
        network 192.168.10.0
        broadcast 192.168.10.255
        


        #gateway 192.168.10.1
        # dns-* options are implemented by the resolvconf package, if installed
        #dns-nameservers 192.168.10.1

==============================================
  root@SRV2:~# wvdial aero 

--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT+CGDCONT=1,"IP","darmowy"
AT+CGDCONT=1,"IP","darmowy"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Sat Jan 26 15:28:14 2013
--> Pid of pppd: 4187
--> Using interface ppp0
--> pppd: 0]0][08][08]
--> pppd: 0]0][08][08]
--> pppd: 0]0][08][08]
--> pppd: 0]0][08][08]
--> pppd: 0]0][08][08]
--> pppd: 0]0][08][08]
--> local  IP address 37.209.152.99
--> pppd: 0]0][08][08]
--> remote IP address 10.64.64.64
--> pppd: 0]0][08][08]
--> primary   DNS address 193.41.112.14
--> pppd: 0]0][08][08]
--> secondary DNS address 193.41.112.18
--> pppd: 0]0][08][08]



DODATKOWA POMOC 




  modprobe -v option 

wvdial aero



route del default


route add default dev ppp0 



Jeli chcemy wyczy modem (aby przesta rejestrowa si w sieci), uruchamiamy:

# wvdial modem-stop


echo "12d1 1506" > /sys/bus/usb-serial/drivers/option1/new_id

usb_modeswitch -v 12d1 -p 14fe -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" 

route del default


route add default dev ppp0 


netstat -rn    pokaze brame 


=================

# route add -net 131.181.0.0 netmask 255.255.0.0 ppp0
# route del default
# route add default gw 131.181.142.1

=================

lsusb

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 011: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub




=====================


================
usb_modeswitch -v 12d1 -p 14fe -V 12d1 -P 1506


root@SRV2:~# usb_modeswitch -v 12d1 -p 14fe -V 12d1 -P 1506

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found devices in default mode or class (1)
Accessing device 008 on bus 001 ...
Using endpoints 0x01 (out) and 0x81 (in)
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI
   Model String: Mass Storage
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Warning: no switching method given.
-> Run lsusb to note any changes. Bye.

======================================================