Difference between revisions of "4gcanipv6"

From Radio Amteur Station OH5BZR - WIKI
Jump to: navigation, search
(HARWARE)
Line 2: Line 2:
 
=HARWARE=
 
=HARWARE=
 
- Huawei 3/4G stick E398
 
- Huawei 3/4G stick E398
- Chinese 2dollars wlan usb tongle's
+
- Chinese 2dollars wlan usb tongle's
 +
 
 +
=IPV4/IPV6 WIFI SUBNETWORK=
 +
 
 +
https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/<br>
 +
http://www.linuxhorizon.ro/iproute2.html<br>
  
 
=agreements needed=
 
=agreements needed=

Revision as of 12:59, 21 February 2015

HARWARE

- Huawei 3/4G stick E398 - Chinese 2dollars wlan usb tongle's

IPV4/IPV6 WIFI SUBNETWORK

https://kindlund.wordpress.com/2007/11/19/configuring-multiple-default-routes-in-linux/
http://www.linuxhorizon.ro/iproute2.html

agreements needed

- Elisa 3G/4G phone operators connection "Saunalahti 4G" - sixxs.prg IPV6 TUNNEL and subnet addressing

/etc/network/interfaces

- giganet ethernet 192.168.0.0/24
- wlan subnet 192.168.01.0/24, wlan wifi hotspots at 192.168.0.254 chanel 9, 192.168.0.40 chane 6, 192.168.0.41 chanel 3, hostapd

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

-masq needed

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

If modem stucks at most cases if hardreset done first and after delay it's driver and device itself re-installed it will go on. If computer harware/ubuntu can not detect modem you need to re-start whole machine.


#!/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

/etc/hostapd/hostapd.conf

interface=wlan0
driver=nl80211
macaddr_acl=1
accept_mac_file=/etc/hostapd.accept
ssid=KURROAIR
hw_mode=g
channel=3
wpa=2
wpa_passphrase=kovaamenee
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600