Storm installation Note:
sudo ln -s /usr/local/share/aclocal/pkg.m4 /usr/share/aclocal/pkg.m4
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Headers/ /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/include
Storm installation Note:
sudo ln -s /usr/local/share/aclocal/pkg.m4 /usr/share/aclocal/pkg.m4
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Headers/ /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/include
发表在 生活随笔 | Leave a Comment »
Markdown (http://en.wikipedia.org/wiki/Markdown)
local action = ngx.ctx.action
local cgi = ngx.ctx.cgi
for k, v in pairs(cgi.params) do
print(v)
end
顶
> This text will be enclosed in an HTML blockquote element. > Blockquote elements are reflowable. You may arbitrarily > wrap the text to your liking, and it will all be parsed > into a single blockquote element.
短短的
发表在 生活随笔 | Tagged markdown | Leave a Comment »
发表在 苹果技巧 | Tagged mac software | Leave a Comment »
sudo apt-get update
sudo apt-get install subversion git openssh-server gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev
#include
int main(void)
{
printf("Hello world!\n");
return 0;
}
download
download all source tarballs (from the selected packages and it’s dependencies) at once before starting the build
prereq
checks if you have all prerequisites installed on the host-system for building the selected packages
world
build everything
tools/install toolchain/install
only build the tools and the toolchain
clean
cleans the packages (NOT the tools and toolchain)
distclean
cleans up everything expect $(TOPDIR)/.config and $(TOPDIR)/dl/
package/-{clean,compile}
rebuild a single package
package/index
updates $(TOPDIR)/bin/packages/Packages
V=99
turns on debugging
make kernel_menuconfig
If you want, you can also modify the kernel config for the selected target system. Simply run “make kernel_menuconfig”
and the build system will unpack the kernel sources (if necessary), run menuconfig inside of the kernel tree, and then
copy the kernel config to target/linux//config so that it is preserved over “make clean” call.
Also look at the OpenWrt Kamikaze documentation at
- http://nbd.name/openwrt.html#x1-250002.1 or
- http://nbd.name/openwrt.pdf
Some more useful URLs:
- Free VMware Player (enough for most users, no need for the VMware Server)
- Download VMDK and VMX files for VMware Player
- Ubuntu (for the Ubuntu ISO image)
- Free VMware Server (also includes the VMware Tools)
发表在 生活随笔 | Tagged openwrt | Leave a Comment »

1) 在NW300R上编辑openvpn client配置如下:
cat /etc/config/openvpn
config 'openvpn' 'client' option 'enable' '1' option 'client' '1' option 'dev' 'tun' option 'proto' 'udp' option 'keepalive' '10 120' option 'resolv_retry' 'infinite' option 'nobind' '1' option 'persist_key' '1' option 'persist_tun' '1' option 'comp_lzo' '1' option 'verb' '3' option 'tun_ipv6' '0' option 'remote' ' ' option 'ca' '/etc/openvpn/client.ca' option 'cert' '/etc/openvpn/client.cert' option 'key' '/etc/openvpn/client.key' option 'max-routes' '3000'
注意your_openvpn_port在服务器端最好设置成非缺省端口1194,因为这个端口在实际使用时由于GFW监控而不稳定。
openvpn相关的CA证书/etc/openvpn/client.ca等需要通过scp传上去。
2) /etc/init.d/openvpn start启动openvpn
3)可以输入route命令来校验(注意如下的路由表显示所有外网流量都将经过vpn服务器,这是因为在服务器端有设置push “redirect-gateway def1″)
root@OpenWrt2:~# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.1 255.255.255.255 UGH 0 0 0 br-lan 10.8.0.5 * 255.255.255.255 UH 0 0 0 tun0 10.8.0.0 10.8.0.5 255.255.255.0 UG 0 0 0 tun0 192.168.1.0 * 255.255.255.0 U 0 0 0 br-lan default 10.8.0.5 128.0.0.0 UG 0 0 0 tun0 128.0.0.0 10.8.0.5 128.0.0.0 UG 0 0 0 tun0 default 192.168.1.1 0.0.0.0 UG 0 0 0 br-lan
或者通过ifconfig命令可以看到多了一个tun0接口
这时可以通过ping 10.8.0.1来确认openvpn已通
4) 修改NW300R的DNS服务器设置,确保DNS解析不被污染;否则DNS解析会走192.168.1.1而未经VPN保护
root@OpenWrt2:~# cat /etc/resolv.conf
search lan nameserver 127.0.0.1
root@OpenWrt2:~# cat /etc/config/dhcp
config 'dnsmasq' option 'domainneeded' '1' option 'boguspriv' '1' option 'localise_queries' '1' option 'rebind_protection' '1' option 'rebind_localhost' '1' option 'local' '/lan/' option 'domain' 'lan' option 'expandhosts' '1' option 'readethers' '1' option 'leasefile' '/tmp/dhcp.leases' option 'resolvfile' '/etc/openvpn/resolv.conf' config 'dhcp' 'lan' option 'interface' 'lan' option 'ignore' '1' config 'dhcp' 'wan' option 'interface' 'wan' option 'ignore' '1'
root@OpenWrt2:~# cat /etc/openvpn/resolv.conf
nameserver 8.8.8.8 nameserver 8.8.4.4
5) 设置智能路由
这里用到了chnroutes项目,点击下载openvpn版本,并找一台有python的机器执行生成最新的路由规则脚本然后上传到路由器。
该脚本会生成两个命令:vpnup, vpndown分别是启动和关闭openvpn时需要修改的路由规则(原理是把所有中国IP路由到192.168.1.1)。
执行vpnup命令后再用route命令列出路由表会发现多了2000多路由规则。。。
这时分别找一个中国和一个外国的IP来traceroute
root@OpenWrt2:~# traceroute tao123.com traceroute to tao123.com (121.14.24.241), 30 hops max, 38 byte packets 1 192.168.1.1 (192.168.1.1) 1.496 ms 1.322 ms 1.440 ms 2 61.130.120.156 (61.130.120.156) 2.910 ms 2.218 ms 3.183 ms 3 220.191.156.181 (220.191.156.181) 2.214 ms 2.136 ms 13.653 ms 4 61.164.19.205 (61.164.19.205) 5.299 ms 2.298 ms 2.576 ms 5 61.164.17.61 (61.164.17.61) 8.297 ms 7.966 ms 8.335 ms 6 202.97.56.241 (202.97.56.241) 24.566 ms^C root@OpenWrt2:~# traceroute facebook.com traceroute to facebook.com (69.63.189.11), 30 hops max, 38 byte packets 1 10.8.0.1 (10.8.0.1) 231.700 ms 210.645 ms 224.737 ms 2 184.105.143.85 (184.105.143.85) 239.952 ms 259.713 ms 266.340 ms 3 10gigabitethernet2-3.core1.fmt1.he.net (64.62.250.5) 273.158 ms 285.133 ms 285.376 ms 4 10gigabitethernet1-1.core1.pao1.he.net (66.160.158.242) 284.708 ms 277.205 ms 277.986 ms 5 paix.pr02.pao1.tfbnw.net (198.32.176.108) 275.467 ms 321.888 ms^C
可以注意到第一行走的路由正确了!
6) 设置iptable
iptables -I FORWARD -o br-lan -j ACCEPT #允许br-lan端口流量被转发
iptables -I FORWARD -o tun0 -j ACCEPT #允许tun0端口流量被转发
iptables -t nat -I POSTROUTING -o tun0 -j MASQUERADE #tun0出口的流量SNAT出去
7) 设置客户端
因为NW300R关掉了DHCP(如果开启NW300R就需要设一个不同的子网如:192.168.2.1,这样还需要特殊设置来使得两个子网的机器可以互相访问),所以使用DHCP连上的客户端的gateway和dns都是192.168.1.1,这样是不能自动翻墙的,需要要手工配一下需要自动翻墙的网络设备的gateway和dns都为192.168.1.2,当然如果你只有一个无线路由器,就没这个问题了。这个部分我还没找到有多个无线路由器时比较好的解决办法,还请高手指教一下。
发表在 数码产品 | Tagged openwrt openvpn 翻墙 | Leave a Comment »
服务器端的iptable设置
iptables -F iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o venet0 -j MASQUERADE iptables -A INPUT -p tcp -m state --state NEW --dport 22 -j ACCEPT iptables -t nat -A PREROUTING -p udp -m udp --dport 53 -j DNAT --to-destination 8.8.8.8 iptables -A INPUT -p udp --dport 1194 -j ACCEPT iptables -A INPUT -s 10.8.0.0/24 -p all -j ACCEPT iptables -A FORWARD -d 10.8.0.0/24 -j ACCEPT iptables -A INPUT -i tun+ -j ACCEPT iptables -A FORWARD -i tun+ -j ACCEPT iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to-source
发表在 生活随笔 | Leave a Comment »
如果你家里需要多个无线路由器,并需要组成一个局域网,使得所有连上的电脑(有线或无线)都能互相访问,WDS就是最简单的一种配置方法,无线组网还有Client + AP(需要设置两个网络),或Bridaged Client(仅适用与Broadcom芯片)等方法,这里只讨论WDS。
使用WDS组网最好采用相同无线芯片的路由器,原因是各个厂商对WDS的实现不完全相同。
OpenWRT是一个强大的基于Linux的开源路由器操作系统。关于无线的配置文件在/etc/config/wireless。
假设你有两个路由器分别为A和B,其中A通过ADSL拨号上网,B则通过无线连接A。
假设A的mac地址是aa:aa:aa:aa:aa:aa,B的mac地址是:bb:bb:bb:bb:bb:bb
首先配置A的LAN IP为192.168.1.1/24,并开启DHCP服务;B的LAN IP为192.168.1.2/24,Gateway,DNS都设成192.168.1.1,并一定关闭DHCP服务。
config 'wifi-device' 'radio0' option 'type' 'mac80211' option 'macaddr' 'aa:aa:aa:aa:aa:aa' option 'hwmode' '11ng' list 'ht_capab' 'SHORT-GI-20' list 'ht_capab' 'SHORT-GI-40' list 'ht_capab' 'TX-STBC' list 'ht_capab' 'RX-STBC1' list 'ht_capab' 'DSSS_CCK-40' option 'channel' '3' option 'txpower' '20' option 'country' 'US' option 'htmode' 'HT20' option 'disabled' '0' option 'noscan' '1' config 'wifi-iface' option 'device' 'radio0' option 'mode' 'ap' option 'ssid' 'hugo' option 'wds' '1' option 'network' 'lan' option 'encryption' 'psk2' option 'key' 'password'
config 'wifi-device' 'radio0' option 'type' 'mac80211' option 'macaddr' 'bb:bb:bb:bb:bb:bb' option 'hwmode' '11ng' list 'ht_capab' 'SHORT-GI-20' list 'ht_capab' 'SHORT-GI-40' list 'ht_capab' 'TX-STBC' list 'ht_capab' 'RX-STBC1' list 'ht_capab' 'DSSS_CCK-40' option 'channel' '3' option 'country' 'US' option 'txpower' '20' option 'htmode' 'HT20' option 'noscan' '1' option 'disabled' '0' config 'wifi-iface' option 'device' 'radio0' option 'ssid' 'hugo' option 'mode' 'sta' option 'wds' '1' option 'network' 'lan' option 'essid' 'aa:aa:aa:aa:aa:aa' option 'encryption' 'psk2' option 'key' 'password' config 'wifi-iface' option 'device' 'radio0' option 'mode' 'ap' option 'ssid' 'hugo2' option 'network' 'lan' option 'encryption' 'psk2' option 'key' 'password'
修改配置文件后可以执行wifi命令使之生效,这样就基本可以了。
配置好后可以通过A的openWRT的web界面登录进去看已经连上的无线终端中是否有B的mac地址,如果不成功,请注意无线的加密方式,我采用WPA2中继成功,但采用WEP就不行。
发表在 生活随笔 | Tagged openwrt, wds | Leave a Comment »
mDNSResponder进程属于Mac的Bonjour服务,出现这种情况一般是切换网络或休眠后唤醒:
可以用下面命令重新启动Bonjour:
launchctl unload /path/to/relocated/com.apple.mDNSResponder.plist launchctl load /path/to/relocated/com.apple.mDNSResponder.plist
发表在 苹果技巧 | Leave a Comment »
1) 通过Keychain Access工具创建一个“iPhone Developer”自签名的证书; 2)sudo /usr/bin/sed -i .bak 's/XCiPhoneOSCodeSignContext/XCCodeSignContext/' /Developer/Platforms/iPhoneOS.platform/Info.plist
The maximum theoretical heap limit for the 32-bit JVM is 4G. Due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower. On most modern 32-bit Windows systems the maximum heap size will range from 1.4G to 1.6G. On 32-bit Solaris kernels the address space is limited to 2G. On 64-bit operating systems running the 32-bit VM, the max heap size can be higher, approaching 4G on many Solaris systems.
As of Java SE 6, the Windows /3GB boot.ini feature is not supported.
If your application requires a very large heap you should use a 64-bit VM on a version of the operating system that supports 64-bit applications. See Java SE Supported System Configurations for details.
发表在 生活随笔 | Leave a Comment »