diff --git a/README b/README deleted file mode 100644 index 9aaa049..0000000 --- a/README +++ /dev/null @@ -1,7 +0,0 @@ -OwrtXD -这是一个旨在方便西电等国内高校在校园网环境下用一个使用内置OpenWrt的路由器wifi共享上网的小项目 -第一步 -对手头RG100a路由器进行配置 提供可以快速配置锐捷认证的校园网wifi共享的脚本和二进制文件 使用mentoinit.sh mac ip username passwd 来自动配置mentohust -第二步 -搞定IPv6... -第三步... diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..3c4de55 --- /dev/null +++ b/README.txt @@ -0,0 +1,18 @@ +使用说明 +========================= +1、使用mr11u-v2.bin升级固件(仅适用于mr11u v2版本,以下方法也适用于wr703n与mr11u v1的路由器,固件大家可以自行寻找) +2、修改network文件中wan的ipaddr、gateway、hostname、macaddr +3、修改wireless文件中wifi-iface的ssid、key +4、修改start.sh文件中的学号、密码、IP地址、网关 +5、将文件拷贝到路由器中: +$scp m2 network rc.local start.sh wireless root@192.168.1.1:~ +6、登录路由器网页管理,设置默认密码,然后在终端中拷贝配置文件: +$ssh root@192.168.1.1 +#cp rc.local /etc/rc.local +#cp network /etc/config/network +#cp wireless /etc/config/wireless +#chmod +x start.sh +#chmod +x m2 +6、测试,先插上网线,然后再终端中执行:#./start.sh,稍等片刻看电脑能否上网 +如果6能上网则表示配置完成! + diff --git a/conf/default.script b/conf/default.script deleted file mode 100755 index 24f9747..0000000 --- a/conf/default.script +++ /dev/null @@ -1,162 +0,0 @@ -#!/bin/sh -[ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 - -. /etc/functions.sh -include /lib/network -RESOLV_CONF="/tmp/resolv.conf.auto" - -change_state () { - [ -n "$ifc" ] || return - uci_revert_state "$1" "$2" "$3" "$4" - uci_set_state "$1" "$2" "$3" "$4" -} - -set_classless_routes() { - local max=128 - local type - while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do - [ ${1##*/} -eq 32 ] && type=host || type=net - echo "udhcpc: adding route for $type $1 via $2" - route add -$type "$1" gw "$2" dev "$interface" - max=$(($max-1)) - shift 2 - done -} - -setup_interface () { - local old_ip - local old_broadcast - local old_subnet - local old_router - local old_dns - local user_dns - local user_router - local user_metric - - [ -n "$ifc" ] && { - old_ip="$(uci_get_state network "$ifc" ipaddr)" - old_broadcast="$(uci_get_state network "$ifc" broadcast)" - old_subnet="$(uci_get_state network "$ifc" netmask)" - } - - [ "$ip" != "$old_ip" ] \ - || [ "${broadcast:-+}" != "$old_broadcast" ] \ - || [ "${subnet:-255.255.255.0}" != "$old_subnet" ] && { - echo "udhcpc: ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+}" - ifconfig $interface $ip netmask ${subnet:-255.255.255.0} broadcast ${broadcast:-+} - - change_state network "$ifc" ipaddr "$ip" - change_state network "$ifc" broadcast "${broadcast:-+}" - change_state network "$ifc" netmask "${subnet:-255.255.255.0}" - } - - - # Default Route - [ -n "$ifc" ] && { - change_state network "$ifc" lease_gateway "$router" - old_router="$(uci_get_state network "$ifc" gateway)" - user_router="$(uci_get network "$ifc" gateway)" - user_metric="$(uci_get network "$ifc" metric)" - # [ -n "$user_router" ] && router="$user_router" - } - - [ -n "$router" ] && [ "$router" != "0.0.0.0" ] && [ "$router" != "255.255.255.255" ] && [ "$router" != "$old_router" ] && { - echo "udhcpc: setting default routers: $router" - - local valid_gw="" - for i in $router ; do - route add default gw $i ${user_metric:+metric $user_metric} dev $interface - valid_gw="${valid_gw:+$valid_gw|}$i" - done - - eval $(route -n | awk ' - /^0.0.0.0\W{9}('$valid_gw')\W/ {next} - /^0.0.0.0/ {print "route del -net "$1" gw "$2";"} - ') - - change_state network "$ifc" gateway "$router" - } - - # CIDR STATIC ROUTES (rfc3442) - [ -n "$staticroutes" ] && set_classless_routes $staticroutes - [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes - - # DNS - old_dns=$(uci_get_state network "$ifc" dns) - old_domain=$(uci_get_state network "$ifc" dnsdomain) - user_dns=$(uci_get "network.$ifc.dns") - # [ -n "$user_dns" ] && dns="$user_dns" - - [ -n "$dns" ] && [ "$dns" != "$old_dns" -o -n "$user_dns" ] && { - echo "udhcpc: setting dns servers: $dns" - add_dns "$ifc" $dns - echo "nameserver $dns" > /etc/resolv.conf - # echo "nameserver $dns" > /tmp/resolv.conf.auto - [ -n "$domain" ] && [ "$domain" != "$old_domain" ] && { - echo "udhcpc: setting dns domain: $domain" - sed -i -e "${old_domain:+/^search $old_domain$/d; }/^search $domain$/d" "${RESOLV_CONF}" - echo "search $domain" >> "${RESOLV_CONF}" - change_state network "$ifc" dnsdomain "$domain" - } - } - - [ -n "$ifc" ] || return - - # UCI State - change_state network "$ifc" lease_server "$serverid" - change_state network "$ifc" lease_acquired "$(sed -ne 's![^0-9].*$!!p' /proc/uptime)" - change_state network "$ifc" lease_lifetime "$lease" - [ -n "$ntpsrv" ] && change_state network "$ifc" lease_ntpsrv "$ntpsrv" - [ -n "$timesvr" ] && change_state network "$ifc" lease_timesrv "$timesvr" - [ -n "$hostname" ] && change_state network "$ifc" lease_hostname "$hostname" - [ -n "$timezone" ] && change_state network "$ifc" lease_timezone "$timezone" - - - # Hotplug - env -i ACTION="$1" INTERFACE="$ifc" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug-call iface -} - - -scan_interfaces -applied= -for ifc in $interfaces __default; do - if [ "$ifc" = __default ]; then - ifc="" - [ -n "$applied" ] && continue - else - config_get ifname "$ifc" ifname - [ "$ifname" = "$interface" ] || continue - - config_get proto "$ifc" proto - [ "$proto" = "dhcp" ] || continue - applied=true - fi - - case "$1" in - deconfig) - ifconfig "$interface" 0.0.0.0 - [ -n "$ifc" ] && { - env -i ACTION="ifdown" INTERFACE="$ifc" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug-call iface - - config_get device "$ifc" device - config_get ifname "$ifc" ifname - config_get aliases "$ifc" aliases - uci_revert_state network "$ifc" - [ -n "$device" ] && uci_set_state network "$ifc" device "$device" - [ -n "$ifname" ] && uci_set_state network "$ifc" ifname "$ifname" - [ -n "$aliases" ] && uci_set_state network "$ifc" aliases "$aliases" - } - ;; - renew) - setup_interface update - ;; - bound) - setup_interface ifup - ;; - esac -done - -# user rules -[ -f /etc/udhcpc.user ] && . /etc/udhcpc.user - -exit 0 diff --git a/conf/dhcp b/conf/dhcp deleted file mode 100644 index ede4246..0000000 --- a/conf/dhcp +++ /dev/null @@ -1,26 +0,0 @@ - -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 'authoritative' '1' - option 'readethers' '1' - option 'leasefile' '/tmp/dhcp.leases' - option 'resolvfile' '/etc/resolv.conf' - -config 'dhcp' 'lan' - option 'interface' 'lan' - option 'ignore' '0' - option 'start' '100' - option 'limit' '150' - option 'leasetime' '12h' - -config 'dhcp' 'wan' - option 'interface' 'wan' - option 'ignore' '1' - diff --git a/conf/network b/conf/network deleted file mode 100644 index c73cab1..0000000 --- a/conf/network +++ /dev/null @@ -1,34 +0,0 @@ - -config 'switch' 'eth1' - option 'reset' '1' - option 'enable_vlan' '1' - -config 'switch_vlan' - option 'device' 'eth1' - option 'vlan' '0' - option 'ports' '0 1 2 5*' - -config 'switch_vlan' - option 'device' 'eth1' - option 'vlan' '1' - option 'ports' '3 5*' - -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 'type' 'bridge' - option 'ifname' 'eth1.0' - option 'proto' 'static' - option 'ipaddr' '192.168.1.1' - option 'netmask' '255.255.255.0' - option 'nat' '1' - -config 'interface' 'wan' - option 'ifname' 'eth1.1' - option 'proto' 'dhcp' - option 'type' 'bridge' - diff --git a/m2 b/m2 new file mode 100644 index 0000000..ec5d21d Binary files /dev/null and b/m2 differ diff --git a/mentohust/mento b/mentohust/mento deleted file mode 100755 index 2bed756..0000000 Binary files a/mentohust/mento and /dev/null differ diff --git a/mentohust/mentohust/8021x.exe b/mentohust/mentohust/8021x.exe deleted file mode 100644 index 768fca5..0000000 Binary files a/mentohust/mentohust/8021x.exe and /dev/null differ diff --git a/mentohust/mentohust/SuConfig.dat b/mentohust/mentohust/SuConfig.dat deleted file mode 100644 index 3161049..0000000 Binary files a/mentohust/mentohust/SuConfig.dat and /dev/null differ diff --git a/mentohust/mentohust/W32N55.dll b/mentohust/mentohust/W32N55.dll deleted file mode 100644 index a5e7ed2..0000000 Binary files a/mentohust/mentohust/W32N55.dll and /dev/null differ diff --git a/mentoinit.sh b/mentoinit.sh deleted file mode 100755 index ceccc19..0000000 --- a/mentoinit.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -echo "copying and setting config files..." -cp conf/network /etc/config/ -mv /etc/config/dhcp /etc/config/dhcp.back -cp conf/dhcp /etc/config/ -mv /usr/share/udhcpc/default.script /usr/share/udhcpc/default.script.back -cp conf/default.script /usr/share/udhcpc/ -echo "copying and setting bin files..." -cp mentohust/mento /usr/sbin/ -chmod +x /usr/sbin/mento -cp -r mentohust/mentohust /etc/ -opkg install packages/libpcap.ipk -echo "generating config and start.sh..." -echo "[MentoHUST] -MaxFail=8 -Username=$3 -Password=$4 -Nic=eth1.1 -IP=$2 -Mask= -Gateway=0.0.0.0 -DNS=0.0.0.0 -PingHost=0.0.0.0 -Timeout=8 -EchoInterval=30 -RestartWait=15 -StartMode=1 -DhcpMode=1 -DaemonMode=2 -ShowNotify=5 -Version=4.60 -DataFile=/etc/mentohust/ -DhcpScript=udhcpc -r $2 -i br-wan -">>mentohust/mentohust.conf -cp mentohust/mentohust.conf /etc/ -echo "#!/bin/sh -ifconfig eth1.1 down -ifconfig eth1.1 up -ifconfig br-wan down -ifconfig br-wan up -ifconfig br-wan 0.0.0.0 -ifconfig eth1.1 hw ether $1 -ifconfig br-wan hw ether $1 -mento -">>start.sh -chmod +x start.sh -cp start.sh /usr/sbin/ -echo "done! just run start.sh to start" - \ No newline at end of file diff --git a/mr11u-v2.bin b/mr11u-v2.bin new file mode 100644 index 0000000..1e8e895 Binary files /dev/null and b/mr11u-v2.bin differ diff --git a/network b/network new file mode 100644 index 0000000..3470f80 --- /dev/null +++ b/network @@ -0,0 +1,26 @@ + +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 type 'bridge' + option proto 'static' + option ipaddr '192.168.1.1' + option netmask '255.255.255.0' + option ifname 'eth0' + +config interface 'wan' + option ifname 'eth0' + option _orig_ifname 'eth0' + option _orig_bridge 'false' + option proto 'static' + option ipaddr 'Your IP ADDRESS' + option netmask '255.255.255.0' + option gateway 'Your Gateway' + option dns '8.8.8.8' + option hostname 'Your Hostname' + option macaddr 'Your MAC ADDRESS' + diff --git a/packages/libpcap.ipk b/packages/libpcap.ipk deleted file mode 100644 index c502d80..0000000 Binary files a/packages/libpcap.ipk and /dev/null differ diff --git a/rc.local b/rc.local new file mode 100644 index 0000000..995553d --- /dev/null +++ b/rc.local @@ -0,0 +1,5 @@ +# Put your custom commands here that should be executed once +# the system init finished. By default this file does nothing. + +/root/start.sh & +exit 0 diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..7370def --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +ifup wan +/root/m2 -uѧ -p -neth0 -iIPַ -m255.255.255.0 -g -a1 -b0 diff --git a/wireless b/wireless new file mode 100644 index 0000000..43253df --- /dev/null +++ b/wireless @@ -0,0 +1,23 @@ + +config wifi-device 'radio0' + option type 'mac80211' + option channel '11' + option phy 'phy0' + option hwmode '11ng' + option htmode 'HT40-' + option noscan '1' + list ht_capab 'SHORT-GI-20' + list ht_capab 'SHORT-GI-40' + list ht_capab 'RX-STBC1' + list ht_capab 'DSSS_CCK-40' + option txpower '27' + option country 'US' + +config wifi-iface + option device 'radio0' + option network 'lan' + option mode 'ap' + option ssid 'Your SSID' + option encryption 'psk2' + option key 'Your AP's password,at least 8 character' +