想使用arduino在需要時發email通知。一開始找ethernet library,結果要使用的話必須要有public ip,後來找到的方法是利用arduino sdk寫code再利用外部網站API達到目的,不過那個需要付費並且掌握在別人手上。後來找到直接install apk在arduino linux上即可達到目的,為了這個還發現arduino出廠時是使用factory image,必須要自己upgrade才能獲取全部的arduino society support。看到download.linino.org就代表你是連到factory自己建的repository,不但常常掛資源也少,正確的應該是downloads.arduino.cc。
參考資料
ethernet lib
https://forum.arduino.cc/index.php?topic=126829.0
arduino sdk
http://tronixstuff.com/2013/11/23/tutorial-send-email-with-the-arduino-yun/
arduino linux
http://www.binarypower.com/2014/07/use-arduino-yun-to-send-emails-simple.html
download.linino.org
https://forum.arduino.cc/index.php?topic=286191.0
2017年11月7日 星期二
2015年12月2日 星期三
iptables
iptables 需要將ppp設為MASQUERADE偽裝IP才有辦法連到internet,但是這樣做會造成inner ip顯示全部變為gateway ip。修正方法為改用SNAT加指定EXTIP,但是就變成要有固定IP才可以使用。
出現錯誤訊息
Options error: server and client cannot be used together
代表conf檔案內有用到不是server指令的指令
iptables restart in ubuntu
sudo service ufw stop
sudo service ufw start
刪除單一chain下的規則
enable forwarding in ubuntu
echo 1 >/proc/sys/net/ipv4/ip_forward
如果要兩個網路能夠成功的達成路由﹐對方網路也必須有相應的路由設定指向本地網路才行
pfsense 內 openvpn檔案存放位置/var/etc/openvpn
traceroute
mac: traceroute
dos: tracert
linux: tracepath
terminate openvpn
sudo killall openvpn
參考資料
http://acman.bluenest.net/wordpress/archives/118
http://askubuntu.com/questions/298419/how-to-disconnect-from-openvpn
iptables
http://serverfault.com/questions/431593/iptables-forwarding-between-two-interface
http://askubuntu.com/questions/161551/how-to-start-stop-iptables
http://stackoverflow.com/questions/8239047/iptables-how-to-delete-postrouting-rule
http://s2.naes.tn.edu.tw/~kv/iptables.htm
https://gigenchang.wordpress.com/2014/04/19/10%E5%88%86%E9%90%98%E5%AD%B8%E6%9C%83iptables/
http://www.pcnet.idv.tw/pcnet/network/network_ip_routing.htm
pfsense存放位置
https://forum.pfsense.org/index.php?topic=13123.0
openvpn with two interface in and out
https://forums.openvpn.net/topic11033.html
https://forums.openvpn.net/topic14072.html
http://ubuntuforums.org/showthread.php?t=1606136
route
http://yinung2.blogspot.tw/2013/05/route_17.html
bridge vs routing
https://community.openvpn.net/openvpn/wiki/BridgingAndRouting
https://openvpn.net/index.php/open-source/documentation/miscellaneous/76-ethernet-bridging.html
chain using openvpn
http://serverfault.com/questions/512160/vpn-chaining-using-openvpn
dns server on openvpn
http://superuser.com/questions/637579/setting-dns-servers-using-openvpn-client-config-file
show route on mac
http://stackoverflow.com/questions/6782658/how-to-get-default-gateway-in-mac-osx
自己
出現錯誤訊息
Options error: server and client cannot be used together
代表conf檔案內有用到不是server指令的指令
iptables restart in ubuntu
sudo service ufw stop
sudo service ufw start
刪除單一chain下的規則
iptables -t nat -D POSTROUTING <number>
enable forwarding in ubuntu
echo 1 >/proc/sys/net/ipv4/ip_forward
如果要兩個網路能夠成功的達成路由﹐對方網路也必須有相應的路由設定指向本地網路才行
pfsense 內 openvpn檔案存放位置/var/etc/openvpn
traceroute
mac: traceroute
dos: tracert
linux: tracepath
terminate openvpn
sudo killall openvpn
參考資料
http://acman.bluenest.net/wordpress/archives/118
http://askubuntu.com/questions/298419/how-to-disconnect-from-openvpn
iptables
http://serverfault.com/questions/431593/iptables-forwarding-between-two-interface
http://askubuntu.com/questions/161551/how-to-start-stop-iptables
http://stackoverflow.com/questions/8239047/iptables-how-to-delete-postrouting-rule
http://s2.naes.tn.edu.tw/~kv/iptables.htm
https://gigenchang.wordpress.com/2014/04/19/10%E5%88%86%E9%90%98%E5%AD%B8%E6%9C%83iptables/
http://www.pcnet.idv.tw/pcnet/network/network_ip_routing.htm
pfsense存放位置
https://forum.pfsense.org/index.php?topic=13123.0
openvpn with two interface in and out
https://forums.openvpn.net/topic11033.html
https://forums.openvpn.net/topic14072.html
http://ubuntuforums.org/showthread.php?t=1606136
route
http://yinung2.blogspot.tw/2013/05/route_17.html
bridge vs routing
https://community.openvpn.net/openvpn/wiki/BridgingAndRouting
https://openvpn.net/index.php/open-source/documentation/miscellaneous/76-ethernet-bridging.html
chain using openvpn
http://serverfault.com/questions/512160/vpn-chaining-using-openvpn
dns server on openvpn
http://superuser.com/questions/637579/setting-dns-servers-using-openvpn-client-config-file
show route on mac
http://stackoverflow.com/questions/6782658/how-to-get-default-gateway-in-mac-osx
自己
2015年2月3日 星期二
linux架站
當http://localhost/phpmyadmin出現404 not found時
#cd /var/www
#ln -s /usr/share/phpmyadmin
mysql new account
參考資料
https://drupal.org/project/drupal
https://drupal.org/documentation/install/create-database
http://altinukshini.wordpress.com/2011/01/09/how-to-install-drupal-7-on-linux/
http://shaurong.blogspot.tw/2014/01/drupal-726-centos-65-x64.html
https://www.youtube.com/watch?v=WBFqlgt7kuI
http://linadonis.pixnet.net/blog/post/27585552-ubuntu-server-%E5%AE%89%E8%A3%9D-phpmyadmin
#cd /var/www
#ln -s /usr/share/phpmyadmin
mysql new account
- select
- insert
- update
- create
- alter
- index
- drop
- reference
- lock tables
drupal theme 教學
https://www.youtube.com/watch?v=6ekJOn2ocRE
https://drupal.org/node/83501
30個好用的themes
http://drupalchina.cn/node/1597
更改資料夾擁有者
sudo chown -R www-data:www-data /var/www/drupal
https://drupal.org/node/1036494
安裝smtp module讓mail功能正常
https://drupal.org/project/smtp
https://drupal.org/node/1108514
https://drupal.org/node/83501
30個好用的themes
http://drupalchina.cn/node/1597
更改資料夾擁有者
sudo chown -R www-data:www-data /var/www/drupal
https://drupal.org/node/1036494
安裝smtp module讓mail功能正常
https://drupal.org/project/smtp
https://drupal.org/node/1108514
參考資料
https://drupal.org/project/drupal
https://drupal.org/documentation/install/create-database
http://altinukshini.wordpress.com/2011/01/09/how-to-install-drupal-7-on-linux/
http://shaurong.blogspot.tw/2014/01/drupal-726-centos-65-x64.html
https://www.youtube.com/watch?v=WBFqlgt7kuI
http://linadonis.pixnet.net/blog/post/27585552-ubuntu-server-%E5%AE%89%E8%A3%9D-phpmyadmin
2014年1月13日 星期一
The locale codeset (cp1252) isn't one that perl can decode, stopped at Encode/Locale.pm line 94.
使用plexwatch web時出現標題的錯誤,查詢了一下發現是程式本身從linux轉換到windows時沒有轉換好,向作者反映他說沒時間處理,於是只好自力救濟。到控制台-地區及語言-系統管理-非unicode程式的語言-變更系統地區設定改成英文(美國)可以解決問題,但是會產生後遺症就是其他程式可能出現亂碼無法閱讀。因此最後我的解決方式是再建立一個VM-ubuntu來使用。
參考資料
http://forge.fusioninventory.org/issues/2197
http://contest-start.blogspot.tw/2009/12/apache-22-php531-mysql.html
http://www.luar.com.hk/flashbook/archives/001425.php
http://www.perlmonks.org/?node_id=981095
http://www.php5.idv.tw/html.php?mod=article&do=show&shid=39
http://blog.linym.net/archives/264
http://idaiwan.pixnet.net/blog/post/28156513-apache-%E5%8A%A0-php-%E5%AE%89%E8%A3%9D%E9%85%8D%E7%BD%AE%E6%95%99%E5%AD%B8%EF%BC%88windows%EF%BC%89
http://forums.adobe.com/message/2869206
http://www.luar.com.hk/flashbook/archives/001425.php
http://www.digglife.cn/articles/pp-the-locale-codeset-is-not-one-that-perl-can-decode.html
參考資料
http://forge.fusioninventory.org/issues/2197
http://contest-start.blogspot.tw/2009/12/apache-22-php531-mysql.html
http://www.luar.com.hk/flashbook/archives/001425.php
http://www.perlmonks.org/?node_id=981095
http://www.php5.idv.tw/html.php?mod=article&do=show&shid=39
http://blog.linym.net/archives/264
http://idaiwan.pixnet.net/blog/post/28156513-apache-%E5%8A%A0-php-%E5%AE%89%E8%A3%9D%E9%85%8D%E7%BD%AE%E6%95%99%E5%AD%B8%EF%BC%88windows%EF%BC%89
http://forums.adobe.com/message/2869206
http://www.luar.com.hk/flashbook/archives/001425.php
http://www.digglife.cn/articles/pp-the-locale-codeset-is-not-one-that-perl-can-decode.html
2011年11月26日 星期六
vpn
最近幾天自己架了一個openvpn server。然後在筆電上裝了openvpn client,最後在sensation上也裝了openvpn。因為過程實在有些複雜,po上來備忘兼給其他人參考。
首先openvpn server的部份,由於我的目標是讓外部網路可以透過vpn peer到我家內部網路,所以我是走tap而非tun。這部份主要是先安裝openvpn for windows然後bridge虛擬網卡與區域網路。openvpn server config部份要注意的是
proto udp
dev tap
dev-node tap-bridge
server-bridge 192.168.1.52 255.255.255.0 192.168.1.60 192.168.1.254
push "route 10.66.77.0 255.255.255.0"
# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp" 這邊好像是設定讓client端連外是server端ip的樣子
client-to-client
duplicate-cn
接著client部份
dev tap
proto udp
ca ca.crt
cert client1.crt
key client1.key
其他部份幾乎都是預設值,但是同樣的設定到阿璇那邊就變成不通,不知道為何。另外因為有開BT的關係中間有出現連不上,後來才查明是因為BT流量開太大所以導致vpn client連不進來。
所以後來使用xp vpn server之方法PPTP讓阿璇可以連進來。但xp vpn server只能允許同時一個使用者連入的樣子。設定方法
新增連線,序列埠,不選擇,允許私人連線及工作連線。最後設定分配的ip區段。但是阿璇說會無法上網,這點還要再測試。
最後是最麻煩的android openvpn設定。
首先sensation自己就有vpn設定,也是走PPTP,但是一開始設定好卻始終連不上,以為是server端問題但又不像。最後查到原來是3g會擋vpn PPTP,也難怪我使用筆電連手機上網要用xp vpn PPTP撥回來始終連不上。有看到有人說明可以走L2TP(xp要另外裝東西才能支援),不過最後決定用openvpn。
先在market上下載openvpn installer跟openvpn setting。要安裝openvpn之前要先安裝busybox。這邊要注意的是如果是用原廠的ROM則market上下載的busybox installer並不會去更改你的/system/bin/route & ifconfig。所以必須要手動去link busybox與route & ifconfig。
可用terminal終端機鍵入
ln -s /system/xbin/busybox /system/xbin/bb/route
ln -s /system/xbin/busybox /system/xbin/bb/ifconfig
前半要換成你busybox安裝的位置。
接下來就是tun.ko的部份,也是我花最久時間處理的部份。由於tun.ko必須配合你的kernel。所以我找了許久,最後甚至自己compile一個但是還是無法使用。最後是刷了PYR_UNITY_V13_OC1512_CIFS_TUN_NOOP_2WCR_VDD.zip這個kernel才解決。
compile的方法是先下載android-ndk-r4-linux-x86.zip,Pyramid_LE_CRC-2.6.35-877c198.tar.gz,另android-sdk因為只是用來取出手機內的/proc/config.gz所以我就沒下載
我是用vitualbox安裝utunbu在linux下操作,先將上面兩個及config.gz解壓縮並令裡面的CONFIG_TUN=m。接著改Pyramid_LE_CRC-2.6.35-877c198.tar.gz裡的Makefile,EXTRAVERSION = (為你的kernel最後小數點後面的字串)。最後設定變數
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:~/android/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/
cd至Pyramid_LE_CRC-2.6.35-877c198目錄下並下指令make modules,則可在Pyramid_LE_CRC-2.6.35-877c198/driver/net下找到tun.ko
2012/3/23補充
後來有查詢到一些資料即iptable導致wifi與3G衝突可能引起連不上openvpn,此時可下指令ip ru del table gprs可解決。
2019/7/12 update
其實就是android不支援tap(因為需要root權限)
2012/3/23補充
後來有查詢到一些資料即iptable導致wifi與3G衝突可能引起連不上openvpn,此時可下指令ip ru del table gprs可解決。
2019/7/12 update
其實就是android不支援tap(因為需要root權限)
參考資料
訂閱:
文章 (Atom)