Difference between revisions of "4gcanipv6"

From Radio Amteur Station OH5BZR - WIKI
Jump to: navigation, search
(Created page with " =/etc/network/interfaces= <code> auto lo eth0 wwan0 sixxs # The primary network interface iface eth0 inet static address 192.168.0.40 netmask 255.255.255....")
 
(keepUP script to cron tab)
Line 53: Line 53:
  
 
=keepUP script to cron tab=
 
=keepUP script to cron tab=
 +
- prerequsite: sudo apt-get wvdial aiccu glib-networking-common libqmi
 +
- first if IPV4 dose not work start's Huawei E398 reset and setup
 +
- if aiccu ipv6 tunnel not respond restart's IPV%
  
 +
bug's: dose not detect problem's in DNS and BIND, DNS and BIND need's
 +
own restart and cheking as weel !
 +
 +
== crontab ==
 
<code>
 
<code>
 
  #!/bin/bash
 
  #!/bin/bash
Line 86: Line 93:
 
         fi
 
         fi
 
     fi
 
     fi
 +
</code>
 +
== wwanREPAIR ==
 +
<code>
 +
#!/bin/sh
 +
ifdown sixxs
 +
ifdown wwan0
 +
wvdial hardreset
 +
sleep 30
 +
usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1 -W
 +
sleep 40
 +
ifup wwan0
 +
sleep 10
 +
ifup sixxs
 +
</code>
 +
=== /etc/wvdial.conf===
 +
<code>
 +
[Dialer hardreset]
 +
Modem = /dev/ttyUSB1
 +
Init1 = AT+CFUN=1,1
 +
Dial Attempts = 10
 +
</code>
 +
== /etc/network/interfaces ==
 +
<code>
 +
#ipv4 4G
 +
iface wwan0 inet dhcp
 +
      pre-up /usr/bin/qmicli -d /dev/cdc-wdm? --wds-start-network=internet --client-no-release-cid
 +
      post-up shorewall start
 
</code>
 
</code>

Revision as of 10:41, 20 October 2014

/etc/network/interfaces

auto lo eth0 wwan0 sixxs
# The primary network interface
iface eth0 inet static
       address 192.168.0.40
       netmask 255.255.255.0
       broadcast 192.168.0.255
       dns-nameservers 192.168.0.40 192.168.0.41
       dns-search mpi2.kurrola.dy.fi mpi2.kurrola.dy.fi
       dns-domain mpi1.kurrola.dy.fi mpi2.kurrola.dy.fi
       network 192.168.0.0
# routes to wifi hot spots
       up route add -net 192.168.1.0 netmask 255.255.255.0  gw 192.168.0.41
# it's me up route add -net 192.168.1.0 netmask 255.255.255.0  gw 192.168.0.40
       up route add -net 192.168.1.0 netmask 255.255.255.0  gw 192.168.0.254
# or?
#      up ip route add 192.168.1.40/24 via 192.168.0.254
#      up ip route add 192.168.1.40/24 via 192.168.0.41
# GiganetEthernet IPV6
iface eth0 inet6 static
       pre-up sleep 10
       address 2001:14b8:100:8363::40
       netmask 64
       dns-nameservers 2001:14b8:100:8363::40 2001:14b8:100:8363::41
#ipv4 4G
iface wwan0 inet dhcp
       pre-up /usr/bin/qmicli -d /dev/cdc-wdm? --wds-start-network=internet --client-no-release-cid
       post-up shorewall start
#ipv6
iface sixxs inet manual
       pre-up invoke-rc.d aiccu start
       up sleep 1
       up ip link set mtu 1280 dev $IFACE
       post-down invoke-rc.d aiccu stop
       post-up shorewall6 start
# wifi
iface wlan0 inet static
       address 192.168.1.40
       netmask 255.255.255.0
       broadcast 192.168.1.255
       network 192.168.1.0
#      up ip route add 192.168.1.40/24 via 192.168.0.40

shorewall

shorewall6

keepUP script to cron tab

- prerequsite: sudo apt-get wvdial aiccu glib-networking-common libqmi - first if IPV4 dose not work start's Huawei E398 reset and setup - if aiccu ipv6 tunnel not respond restart's IPV%

bug's: dose not detect problem's in DNS and BIND, DNS and BIND need's

own restart and cheking as weel !

crontab

#!/bin/bash
DATE=`date`
PASS="`ping -I wwan0 -c 2 195.197.95.175 | grep -oP '\d+(?=% packet loss)'`"
echo "PASS IPV4: $PASS"
if [ "0" != "$PASS" ] ; then
   echo "$(date) [KeepWwan0OnD] Warning: IPV4 connection lost at -- restart"  >> /var/log/syslog
       /home/joni/wwanREPAIR
       sleep 60
       if ! ['0' -eq "$(ping -I wwan0 -c 2 195.197.95.175 | grep -oP '\d+(?=% packet loss)')"]; then
            echo "$(date) [KeepWwan0OnScript] Waiting for IPV4 connection going up" >> /var/log/syslog
       else 
            echo "$(date) [KeepWwan0OnScript] IPV4 Connection ON" >> /var/log/syslog
       fi
    fi
# IPV6
DATE=`date`
PASS6="`ping6 -I sixxs -c 2 2a00:1450:400f:804::1009 | grep -oP '\d+(?=% packet loss)'`"
echo "PASS IPV6: $PASS6"
if [ "0"  != "$PASS6" ]; then
       echo "$(date) [KeepWwan0OnScript]  Warning: IPV6 connection lost -- restart" >> /var/log/syslog
       ifdown sixxs
       sleep 10
       ifup sixxs
       sleep 10
       webon
       if ! ["0" -eq "$(echo ping6 -I sixxs -c 2 2a00:1450:400f:804::1009 | grep -oP '\d+(?=% packet loss)')"]; then
            echo "$(date) [KeepWwan0OnScript]  Waiting for IPV6 connection going up" >> /var/log/syslog
       else 
            echo "$(date) [KeepWwan0OnScript]  IPV6 Connection on" >> /var/log/syslog
       fi
   fi

wwanREPAIR

#!/bin/sh
ifdown sixxs
ifdown wwan0
wvdial hardreset
sleep 30
usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1 -W
sleep 40
ifup wwan0
sleep 10
ifup sixxs

/etc/wvdial.conf

[Dialer hardreset]
Modem = /dev/ttyUSB1
Init1 = AT+CFUN=1,1
Dial Attempts = 10

/etc/network/interfaces

  1. ipv4 4G

iface wwan0 inet dhcp

      pre-up /usr/bin/qmicli -d /dev/cdc-wdm? --wds-start-network=internet --client-no-release-cid
      post-up shorewall start