Donnerstag, 10. Juni 2010
ClientRunning.txt 100620910rh

NSLU2 Openwrt Backfire 10.03 Wlan-Client USB-Stick TL-Wn321G configuration tested/running

configuration :

root@OpenWrt:/etc/config# cat network

config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'

config 'interface' 'lan'
option 'ifname' 'eth0'
option 'type' 'bridge'
option 'proto' 'static'
option 'netmask' '255.255.255.0'
option 'ipaddr' '192.168.1.13'
# option 'gateway' '192.168.0.1'
# option 'defaultroute' '0'
# option 'peerdns' '0'
# option 'dns' '192.168.0.1'

config 'interface' 'wan'
option 'ifname' 'wlan0'
option 'proto' 'dhcp'
# option 'defaultroute' '0'
# option 'peerdns' '0'
# option 'dns' '8.8.8.8'

root@OpenWrt:/etc/config#


root@OpenWrt:/etc/config# cat wireless
config wifi-device radio0
option type mac80211
# option country DE
option channel 4
option macaddr 00:23:cd:b8:92:9a
option hwmode 11g

config wifi-iface
option device radio0
option network wan
option mode sta
option ssid 'LouiseHome'
option encryption psk
option key louise232323wlan
# option proto dhcp
root@OpenWrt:/etc/config#

root@OpenWrt:/etc/config# cat dhcp
config dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k '0' #enable for dial on demand
option localise_queries 1
option local '/lan/'
option domain 'lan'
option expandhosts 1
option nonegcache 0
option authoritative 1
option readethers 1
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.auto'
#list server '/mycompany.local/1.2.3.4'
#option nonwildcard 1
list interface br-lan wan
#list notinterface lo wan

config dhcp lan
option interface lan
option start 100
option limit 150
option leasetime 12h

config dhcp wan
option interface wan
option ignore 1
root@OpenWrt:/etc/config#

root@OpenWrt:/etc# cat rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
wifi up
exit 0
root@OpenWrt:/etc#

firewall enabled ! standard config

root@OpenWrt:/etc/config# cat firewall

config 'defaults'
option 'input' 'ACCEPT'
option 'output' 'ACCEPT'
option 'forward' 'ACCEPT'

config 'zone'
option 'name' 'lan'
option 'input' 'ACCEPT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'
option 'masq' '1'

config 'zone'
option 'name' 'wan'
option 'output' 'ACCEPT'
option 'masq' '1'
option 'mtu_fix' '1'
option 'input' 'ACCEPT'
option 'forward' 'ACCEPT'

config 'forwarding'
option 'src' 'lan'
option 'dest' 'wan'

config 'rule'
option 'src' 'wan'
option 'proto' 'udp'
option 'dest_port' '68'
option 'target' 'ACCEPT'

config 'rule'
option 'src' 'wan'
option 'proto' 'icmp'
option 'icmp_type' 'echo-request'
option 'target' 'ACCEPT'

config 'include'
option 'path' '/etc/firewall.user'

root@OpenWrt:/etc/config#

***********************************END config

TEST :

root@OpenWrt:/etc/config# ifconfig
br-lan Link encap:Ethernet HWaddr 00:18:39:25:50:36
inet addr:192.168.1.13 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::1c43:efff:fecc:a527/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5626 errors:0 dropped:0 overruns:0 frame:0
TX packets:7597 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:436042 (425.8 KiB) TX bytes:9851465 (9.3 MiB)

eth0 Link encap:Ethernet HWaddr 00:18:39:25:50:36
inet6 addr: fe80::218:39ff:fe25:5036/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5626 errors:0 dropped:0 overruns:0 frame:0
TX packets:7601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:436042 (425.8 KiB) TX bytes:9851765 (9.3 MiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:52 errors:0 dropped:0 overruns:0 frame:0
TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3861 (3.7 KiB) TX bytes:3861 (3.7 KiB)

wlan0 Link encap:Ethernet HWaddr 00:23:CD:B8:92:9A
inet addr:192.168.0.160 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::223:cdff:feb8:929a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8512 errors:0 dropped:0 overruns:0 frame:0
TX packets:5967 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:9958444 (9.4 MiB) TX bytes:629474 (614.7 KiB)

root@OpenWrt:/etc/config#

root@OpenWrt:/etc/config# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

br-lan no wireless extensions.

bond0 no wireless extensions.

wlan0 IEEE 802.11bg ESSID:"LouiseHome"
Mode:Managed Frequency:2.427 GHz Access Point: 00:1B:11:8B:92:CA
Bit Rate=48 Mb/s Tx-Power=14 dBm
RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=44/70 Signal level=-66 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

root@OpenWrt:/etc/config#


Laptop dhcp on NSLU2 ethernet IP: 192.168.1.185

connection to Internet / Browser ok

!!! CAVE : long init time on boot !
check if connection WIFI to Router ok should be done by script
**************************************************




Dienstag, 5. Mai 2009
from the 3zlCAP projekt
short example to create XML configuration file:


public class Cap {

String version="1.007d",
subvers="subv",
hostURL="http://192.168.0.1", // trizonia
port="8082",
fileXferDoc="/",
hsUsersDoc="/",
adminUserName="admin",
adminPassw="PPPPP",
operatorName="AnyName",
operatorPassw="yourpassword",
logFileName="caplog.txt"; // full path ?


public String getVersion(){
return(version+"."+subvers);
}
public String gethostURL(){
return (hostURL);
}
public void sethostURL(String url){
hostURL=url;
}



public void setXML(){
String testString="TEST";

XMLConfiguration xml_config = new XMLConfiguration();
xml_config.setRootElementName("Cap");
xml_config.setProperty("Class", this.getClass().getName());
xml_config.setProperty("logFileName", testString);
xml_config.setProperty("version", getVersion());
xml_config.setProperty("hostURL", gethostURL());

try {
String file_name="cap.XML";
xml_config.save(new File(file_name));
} catch (ConfigurationException ex) {
Logger.getLogger(Cap.class.getName()).log(Level.SEVERE, null, ex);
}
/*
* this creates the file "cap.XML" holding following

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

desktopapplication2.Cap
TEST
1.007d.subv
http://192.168.1.11


*/
}

}


*fin




Freitag, 1. Mai 2009
3zl project :
target : use the scripted HTML with form to download file to target dir using apatche.commons.HTTPClient


HTML code : ( as text wihtout HTML formatting !)
form method="POST" name="upload1" action="$SCRIPT_NAME" enctype="multipart/form-data"
input type="hidden" name="action" value="upload"
nput type="file" name="uploadfile" size="50" maxlength="$MaxDwnl" accept="*.*"/
input id="form_submit" type="submit" name="submit" value="target"
input type='hidden' name='upfilename' value="target"
/form


--------------------------------
JAVA Code snippet:
import org.apache.commons.httpclient.*;
........
.......
try {
mPost.addParameter("uploadfile", f1); // FORM type="file" name='uploadfile' .....
} catch (FileNotFoundException e2) {
e2.printStackTrace();
}
mPost.addParameter("upfilename","X/"+f1.getName());
mPost.addParameter("action","upload");

downloads file f1 to dir /X

*fin