if required turn on wireless hardware switch
install wireless driver(module)
2. open terminal in su(super user)
sh -v up4.sh
browse internet
sh -v down4.sh
3. if wireless does not connect
clear browser history everything
restart browser
sh -v flush.sh
sh -v clear.sh
sh -v up4.sh
4. if wireless still does not connect
sh -v up4.sh
sh -v reconnect.sh
5. to find routers
sh -v scan_routers.sh
6. to connect laptop ethernet cable to router using dhcp
sh -v up4.sh eth0 cable
use browser 192.168.1.1 to connect to router
7. to connect laptop ethernet cable to router using static manual method
sh -v up_cable_static.sh
use browser 192.168.1.1 to connect to router
8. optional parameters examples (edit .sh file to set defaults)
sh -v up4.sh wlan1 wpa2_router1.conf 192.168.1.1
sh -v down4.sh wlan1
sh -v reconnect.sh wlan1 wpa2_router1.conf 192.168.1.1
sh -v scan_routers.sh wlan0
sh -v up_cable_static.sh eth0 192.168.1.1
9. copy/edit wpa2_router1.conf
ssid="router1"
10. generate psk(pre shared key), for router1 and passphrase = 123PASSWORD123
wpa_passphrase router1 123PASSWORD123 (generates psk, pre shared key, hex numbers, no quotes)
psk=e48caac91f09bedefb186f6e12e8fabe9a83fb43b310baba66b5a8eb380aca17
copy/paste psk= into wpa2_router1.conf
11a. download/install, if not using Debian 8.6.0 Jessie and if missing commands
https://packages.debian.org/wheezy/wireless-tools
dpkg -i libiw30_30~pre9-8_i386.deb (wireless tools - library)
dpkg -i wireless-tools_30~pre9-8_i386.deb
11b. download/install, if using Debian 9 Stretch, missing commands
installs missing ifconfig command --> dpkg -i net-tools_1.60+git20161116.90da8a0-1_i386.deb
installs missing rfkill command --> dpkg -i rfkill_0.5-1+b1_i386.deb
12. up4.sh
Code: Select all
#!/bin/bash
#terminal in su(super user)
#sh -v up4.sh (run script with -v to display lines)
#
#reboot laptop if error: SIOCADDRT: No such process
#
#see step8: if multicast required, comment line out
#
#run clear first if having problems
#
#---------.---------.
echo -n "Debian "; cat /etc/debian_version
cat /etc/os-release
echo "*********.*********.*********.*********.*********.*********."
echo "Install Debian net-tools if Debian version > than 8 since ifconfig removed in Debian9"
#echo -n "Check if net-tools installed "; dpkg -l net-tools
#
#---------.---------.
echo "Install Debian rfkill if not installed"
echo "Install Debian rfkill if wireless device blocked by rfkill"
echo "Install Debian rfkill if errors --> RTNETLINK answers: Operation not possible due to RF-kill"
#echo -n "Check if rfkill installed "; dpkg -l rfkill
echo " "
read -p "press <enter> to continue", keyin1
echo " "
rfkill list
echo "---------."
#unblock wireless device
rfkill unblock wifi
echo "---------."
rfkill list
#---------.---------.
#
#DEVICE="wlan0" #Debian8, wireless device (usb, internal), or ethernet cable(eth0), ifconfig -a
DEVICE="wlp6s0" #Debian9, wireless device (usb, internal), or ethernet cable(eth0), ifconfig -a
CONFIG="wpa2_ccmp_router1.conf" #run scan_routers to find router1
router_ip_address="192.168.1.1" #router setup
#
#optional command line parameters(wireless): sh -v up4.sh wlan1 wpa2_NETGEAR.conf 192.168.1.2
#optional command line parameters(cable): sh -v up4.sh eth0 cable
#cable parameter uses dhcp to get ip address
if [ "$1" != "" ]; then DEVICE=$1; fi
if [ "$2" != "" ]; then CONFIG=$2; fi
if [ "$3" != "" ]; then router_ip_address=$3; fi
echo $DEVICE
echo $CONFIG
echo $router_ip_address
#
#---------.---------.
#step1: set wireless device up
#
#enable hardware internal wireless switch which also controls usb wireless plugin adapter
#
ifconfig -a #show physical wireless device
ip link set $DEVICE down #set physical device down
ip link show $DEVICE #show down
echo "...waiting for --> ip link set "$DEVICE" up"
sleep 3 #wait fudge, (increase seconds, wait for ip link to go down)
ip link set $DEVICE up #set physical device up
sleep 3 #wait fudge, (increase seconds, wait for ip link to go up)
ip link set $DEVICE up #do again fudge, set physical device up
ip link show $DEVICE #show up
#
#cannot find device, plugin usb wireless device, lsusb
#
#---------.---------.
# step2: cleanup
#
service network-manager stop
dhclient -v -r $DEVICE #cleanup leftovers, remove lease, ip number that was assigned by router
ifconfig $DEVICE
rm /var/run/wpa_supplicant/$DEVICE #cleanup leftovers, OK if no such file
killall -v wpa_supplicant #cleanup leftovers, OK if no process found
/etc/init.d/networking restart
netstat -i #show counters at zero TX(transmit) RX(receive)----------
#
#---------.---------.
#step3: disable/enable overwriting of DNS /etc/resolv.conf by auto-generated system
#
#if overwriting "disabled" then edit DNS_not_auto_generated_resolv.conf to hardcode google DNS or other
#resolv_conf_overwrite="disabled"
resolv_conf_overwrite="enabled"
if [ $resolv_conf_overwrite = "disabled" ]; then
chattr -i /etc/resolv.conf # -Immutable, allow file modification
echo "...cp DNS_not_auto_generated_resolv.conf /etc/resolv.conf"
cp DNS_not_auto_generated_resolv.conf /etc/resolv.conf
chattr +i /etc/resolv.conf # +Immutable, file cannot be modified, therefore it cannot be overwritten by auto-generated system
fi
#---------.---------.
#step4: startup wireless wpa_supplicant password authorization, connect laptop to router
#
if [ $CONFIG != "cable" ]; then #---------.---------.---------.---------.---------.---------.
LOGFILE="$( mktemp /tmp/wpa_supplicant_log.XXXXXXXXXX)" #make temp log file
echo "LOGFILE: $LOGFILE"
echo "config file: $CONFIG"
ssid="router1"
echo "ssid: $ssid"
find ./ -iname "wpa2_router1.conf" -exec grep -Ein 'router1' {} \; #check config file, show ssid router name
echo "*********.*********.*********.*********.*********.*********"
echo "copy file y/n <enter>"
echo cp -i "$CONFIG" /etc/wpa_supplicant/"$CONFIG" #edited wpa2_router1.conf file must be copied to /etc/wpa_supplicant/
cp -i "$CONFIG" /etc/wpa_supplicant/"$CONFIG"
#
#---------.---------.
# run wpa_supplicant in background, connect to router and authorize password
# option, run wpa_cli in 2nd terminal window, help, quit
# -dd or -dddd (debug verbose), -K output keys for debug
# -B (background daemon mode)
# -f or -foutput
# documentation, /usr/share/doc/wpasupplicant/examples
#DRIVER="nl80211" #newer (net link) standard, not working for some usb wireless devices
DRIVER="wext" #older proven (Wireless EXTentions) standard, cfg80211-based wireless driver
echo "wpa_supplicant -B -dddd -t -K "-D$DRIVER" "-i$DEVICE" "-c$CONFIG" -f $LOGFILE"
wpa_supplicant -B -dddd -t -K "-D$DRIVER" "-i$DEVICE" "-c$CONFIG" -f $LOGFILE
#---------.---------.
sleep 3 #increase seconds, wait for wpa_supplicant to authorize
wpa_cli status #show
ip link show $DEVICE #must be after wpa_cli status otherwise shows as down
fi #---------.---------.---------.---------.---------.---------.
#---------.---------.
#step5: get ip number from router
#
dhclient -v $DEVICE #get ip number assigned by router, get new lease, /var/lib/dhcp/dhclient.leases
#
#if +Immutable has been set previously then this is OK and will show, mv: cannot move `/etc/resolv.conf.dhclient-new' to `/etc/resolv.conf': Operation not permitted
#dhclient adds the following line in --> ifconfig $DEVICE
#inet addr:192.168.1.xx Bcast:192.168.1.255 Mask:255.255.255.0
#laptop now connected to router's ip address 192.168.1.xx
#
#---------.---------.
#step6: DNS address check, yesterday www.google.com works, today no google!
#
#router_ip_address="192.168.1.1"
dig $router_ip_address | grep SERVER: #...wait, check1 DNS in router, DNS lookup utility
cat /etc/resolv.conf #check2 DNS auto generated file
cat DNS_not_auto_generated_resolv.conf #check3 DNS hardcoded file, +Immutable, this will get www.google.com working again!
#---------.---------.
#step7: show connection
#
ifconfig $DEVICE #check inet addr:192.168.1.xx that router has assigned
ip address #check inet addr:192.168.1.xx that router has assigned
if [ $CONFIG = "cable" ]; then
ping -c3 $router_ip_address
exit 0
fi
iwconfig $DEVICE #check ESSID name, check which router is now connected
wpa_cli status #show again after processes have been running
#---------.---------.
#step8: misc settings
#
ifconfig "$DEVICE" -multicast #Turn off multicast if not used
#---------.---------.
iwconfig "$DEVICE" key off #Turn off old unused message for iwconfig, not used--> WEP key encryption key/security mode open
iwconfig #show
#---------.---------.
iwconfig "$DEVICE" power off #Powersave can break a network link. Disable the powersaving in the device itself.
#---------.---------.
# stop usb wireless device from generating dmesg debug messages generated by every mouse click
# iwpriv $DEVICE set Debug=0 to 5 (will accept 0 to 5-very verbose)
# iwpriv $DEVICE set Debug=1 (repeat twice) (will turn off dmesg messages)
iwpriv $DEVICE set Debug=1 #first turn off dmesg messages
iwpriv $DEVICE set Debug=1 #second turn off dmesg messages
#---------.---------.
#iw - only supports the nl80211 (netlink) standard.
#iw - does not support the older WEXT (Wireless EXTentions) standard, displays not connected
iw $DEVICE link #show if connected to router, no ip number yet
#
#---------.---------.
#step9: test/enable connection to router"
#
ping -c3 $router_ip_address #if 0 packets received then enable_network router1
#---------.---------.
wpa_cli interface
#---------.---------.
wpa_cli list_networks
#if network disabled then ping shows --> From 192.168.1.211 icmp_seq=1 Destination Host Unreachable
#---------.---------.
wpa_cli enable_network 0 #edit if not network 0
#---------.---------.
ping -c3 $router_ip_address #increase from 3 pings to 20 pings if Destination Host Unreachable
#if ping not responding(Destination Host Unreachable) then run --> sh reconnect.sh
#if ping OK and no www.google.com browsing then reboot router"
#if ping OK and no ping www.google.com then check step3: enable/disable auto-generated overwrite of /etc/resolv.conf "
#---------.---------.
echo
echo "*********.*********.*********.*********.*********.*********"
echo "If not working:"
echo
echo "Unplug then plugin USB wireless device"
echo "Turn on hardware laptop wireless switch"
echo "ip link set "$DEVICE" up"
echo "Try again --> sh up4.sh"
echo "*********.*********.*********.*********.*********.*********"
echo
exit 0
#
#---------.---------.---------.---------.---------.---------.
#example
#ping 192.168.1.1
#browser 192.168.1.1
#browser(firefox 50): preferences, advanced, network, connection, settings, use system proxy settings(not manual)
#browser: must have java enabled (DD-WRT router)
#must reboot laptop if error: SIOCADDRT: No such process"
#---------.---------.---------.---------.---------.---------.
#example
# debug mode -x (expand variables)
# run --> sh -vx up4.sh
#---------.---------.---------.---------.---------.---------.
Code: Select all
#!/bin/bash
#terminal in su(super user)
#sh -v down4.sh run script with -v to display lines
#
#---------.---------.
echo -n "Debian "; cat /etc/debian_version
cat /etc/os-release
echo "*********.*********.*********.*********.*********.*********."
echo "Install Debian net-tools if Debian version > than 8 since ifconfig removed in Debian9"
#echo -n "Check if net-tools installed "; dpkg -l net-tools
echo " "
read -p "press <enter> to continue", keyin1
echo " "
#
#DEVICE="wlan0" #Debian8, wireless device (usb, internal), ifconfig -a
DEVICE="wlp6s0" #Debian9, wireless device (usb, internal), ifconfig -a
#
#optional command line parameters: sh -v down4.sh wlan1
if [ "$1" != "" ]; then DEVICE=$1; fi
echo $DEVICE #show
#
#---------.---------.
ifconfig -a #show all
#---------.---------.
iwconfig #show
#---------.---------.
netstat -i #show TX(transmit) RX(receive) counters
#---------.---------.
dhclient -v -r $DEVICE #remove
#---------.---------.
killall -v wpa_supplicant
#---------.---------.
ip link set $DEVICE down
#---------.---------.
ip link show $DEVICE #show
#---------.---------.
exit 0
Code: Select all
#terminal in su(super user)
#sh -v flush.sh (run script with -v to display lines)
#---------.---------.
ip route show
ip route flush table all
ip -s -s neigh flush all #neigh option = manage ARP or NDISC cache entries
exit 0
#
# after flush connect to wireless router or ethernet cable router
#---------.---------.
#additional note: if ping not working
#Gnome desktop, settings, network, wired, reset wired ethernet cable turn off/on if static manual no DHCP
#ping -c3 192.168.1.1
#---------.---------.
#keep flush in a separate script otherwise the followings errors show:
#route add default gw 192.168.1.1 eth0
#SIOCADDRT: Network is unreachable
#
#ping -c3 192.168.1.1
#connect: Network is unreachable
Code: Select all
# terminal in su(super user)
# sh -v clear.sh (run script with -v to display lines)
#
rm /tmp/wpa_supplicant_log*
rm /var/lib/dhcp/dhclient* #remove leases
rm /etc/NetworkManager/system-connections/*
rm /etc/network/run/ifstate
rm /var/lib/NetworkManager/NetworkManager.state
#
/etc/init.d/networking restart
#
#---------.---------.
# Reset device names, wlan0, wlan2, wlan3..., requires shutdown, startup, now udev mechanism assigns devices from clean start
# Remove the following file if hard disk or wireless cards have replaced
# rm /etc/udev/rules.d/70-persistent-net.rules
#---------.---------.
exit 0
Code: Select all
#terminal in su(super user)
#sh -v reconnect.sh (run script with -v to display lines)
#---------.---------.
#this reconnects when ping = Destination Host Unreachable
#some usb wireless devices require this reconnect immediately after up4.sh has been run
#must have wpa_supplicant running in background therefore up4.sh must be done first
#this is an disable, enable, reconnect sequence (note: starts working after the reconnect step)
#
echo -n "Debian "; cat /etc/debian_version
echo "If Debian version > than 8 then install net-tools since ifconfig removed in Debian9"
echo " "
#
DEVICE="wlan0" #wireless device (usb, internal), ifconfig -a
CONFIG="wpa2_router1.conf" #not used, however continued with key repeat from previous up4.sh
router_ip_address="192.168.1.1" #router setup
#
#optional command line parameters: sh -v reconnect.sh wlan1 wpa2_NETGEAR.conf 192.168.1.2
if [ "$1" != "" ]; then DEVICE=$1; fi
if [ "$2" != "" ]; then CONFIG=$2; fi #not used, however continued with key repeat from previous up4.sh
if [ "$3" != "" ]; then router_ip_address=$3; fi
echo $DEVICE
echo $CONFIG
echo $router_ip_address
#---------.---------.
#step1: set wireless device up
#
#enable hardware internal wireless switch which also controls usb wireless plugin adapter
ip link set $DEVICE up
ip link show $DEVICE
ifconfig -a #show all
#---------.---------.
#step2: run disable, enable, reconnect sequence
ping -c3 $router_ip_address #increase 3 pings to 20 pings if Destination Host Unreachable)
#---------.---------.
wpa_cli interface #list laptop wireless device interface
#---------.---------.
wpa_cli list_networks #list router network ssid name currently connected to
#---------.---------.
wpa_cli disable_network 0 #edit if not network 0
sleep 5 #wait 5 seconds
#---------.---------.
wpa_cli list_networks #list router network ssid name disabled not connected
#---------.---------.
wpa_cli enable_network 0 #edit if not network 0
sleep 15 #wait 15 seconds
#---------.---------.
wpa_cli list_networks #list router network ssid name currently connected to
#---------.---------.
wpa_cli status $DEVICE #list status of address MAC = laptop wireless device, bssid MAC = router
#---------.---------.
wpa_cli scan_results #enable --> status --> wpa_state=SCANNING --> wpa_state=COMPLETED --> scan_results of available routers
#---------.---------.
wpa_cli bss $DEVICE #list bss (Basic Service Set) connected to the router, bssid MAC = router
#---------.---------.
wpa_cli list_networks #list router network ssid name currently connected to
#---------.---------.
wpa_cli reconnect $DEVICE #reconnect laptop to router, this is when the ping starts working again
#---------.---------.
wpa_cli status $DEVICE #list status of address MAC = laptop wireless device, bssid MAC = router
#---------.---------.
ping -c3 $router_ip_address #increase 3 pings to 20 pings if Destination Host Unreachable
exit 0
Code: Select all
#terminal in su(super user)
#sh -v scan_routers.sh run script with -v to display lines
#---------.---------.
echo -n "Debian "; cat /etc/debian_version
echo "If Debian version > than 8 then install net-tools since ifconfig removed in Debian9"
echo " "
#
DEVICE="wlan0" #edit this, wireless device (usb, internal), ifconfig -a
#
#optional command line parameters: sh -v scan_routers.sh wlan0
if [ "$1" != "" ]; then DEVICE=$1; fi
echo $DEVICE #show
#
ip link set $DEVICE up
ip link show $DEVICE
ifconfig -a #show all
iwlist scan #show ESSIS router name, scan for wireless access points
#---------.---------
#sample scan output
# iwlist scan (
# Cell 06 - Address: 11:22:33:44:55:66
# Protocol:11g/n BW20
# ESSID:"router1"
# Mode:Managed
# Frequency:2.422 GHz (Channel 3)
# Quality=100/100 Signal level=-23 dBm Noise level=-92 dBm
# Encryption key:on
# Bit Rates:65 Mb/s
# IE: WPA Version 1
# Group Cipher : TKIP
# Pairwise Ciphers (2) : CCMP TKIP
# Authentication Suites (1) : PSK
# IE: IEEE 802.11i/WPA2 Version 1
# Group Cipher : TKIP
# Pairwise Ciphers (2) : CCMP TKIP
# Authentication Suites (1) : PSK
# IE: Unknown: DD0E0050F204104A0001101044000102
Code: Select all
#terminal in su(super user)
#sh -v up_cable_static.sh (run script with -v to display lines)
#
#reboot laptop if error: SIOCADDRT: No such process
#
#plugin ethernet cable from laptop port(eth0) to 1 of the 4 router ports (not the separate yellow ISP port)
#
echo -n "Debian "; cat /etc/debian_version
echo "If Debian version > than 8 then install net-tools since ifconfig removed in Debian9"
echo " "
#
ifconfig -a #show physical ethernet cable device
#---------.---------.
DEVICE="eth0" #ethernet wired cable, ifconfig -a
#DEVICE="enp8s0" #ethernet wired cable, ifconfig -a (Debian9 eth0 changed to enp8s0, install net-tools)(ip a)
router_ip_address="192.168.1.1" #router setup
#
#optional command line parameters: sh -v up_cable_static.sh eth0 192.168.1.1
if [ "$1" != "" ]; then DEVICE=$1; fi
if [ "$2" != "" ]; then router_ip_address=$2; fi
echo $DEVICE
echo $router_ip_address
#---------.---------.
#step1: set laptop ethernet device up
#
ifconfig -a #show physical ethernet cable device
ip link set $DEVICE down #set physical device down
ip link show $DEVICE #show down
ip link set $DEVICE up #set physical device up
sleep 3 #(increase seconds, wait for ip link to go up)
ip link show $DEVICE #show up
#---------.---------.
#step3A: show before connection setup
#
route -n #show laptop wireless/cable to router address, -n numeric address kernel routing table
#---------.---------.
ip route show #show
#
#---------.---------.
#step3B: setup connection from laptop to router
#
ifconfig $DEVICE 192.168.1.22 netmask 255.255.255.0 up #manual assign static laptop ip address, subnet mask
route add default gw $router_ip_address $DEVICE #manual assign gateway/router address
#
#---------.---------.
#step3C: show after connection setup
#
route -n #show laptop wireless/cable to router address, -n numeric address kernel routing table
#---------.---------.
ip route show #show
#---------.---------.
ifconfig $DEVICE
#---------.---------.#---------.---------.
ping -c3 $router_ip_address #increase 3 pings to 20 pings if Destination Host Unreachable
#---------.---------.
#
echo "*******************************"
echo "plugin ethernet cable from laptop port(eth0) to 1 of the 4 router ports (not the separate yellow ISP port)"
echo "connection: an ip number has been manually(static) assigned"
echo "ping " "$router_ip_address"
echo "browser: " "$router_ip_address"
echo "browser: must have java enabled"
echo "browser(firefox 50): preferences, advanced, network, connection, settings, use system proxy settings(not manual)"
echo "must reboot laptop if error: SIOCADDRT: No such process"
echo "*******************************"
exit 0
#---------.---------.
#example of using the cable_static_up and tftp to flash firmware(DD-WRT) into router (www.dd-wrt.com)
#caution, if this is done incorrectly then the router may never work again
#
#the following is a cable connection test only
#plugin ethernet cable from laptop port(eth0) to 1 of the 4 router ports (not the separate yellow ISP port)
#laptop, run --> sh -v cable_static_up4.sh
#check cable wired connection, ping 192.168.1.1, then cntl-c to stop it
#
#tftp 192.168.1.1
# tftp> status
# tftp> quit
#
#download/install, https://packages.debian.org/jessie/i386/tftp/download
#dpkg -i tftp_0.17-18_i386.deb
Code: Select all
nameserver 8.8.8.8
nameserver 8.8.4.4
Code: Select all
# file location --> /etc/wpa_supplicant
# cp wpa2_router1.conf /etc/wpa_supplicant/
#----------.----------
#
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
eapol_version=2
fast_reauth=1
network={
ssid="router1"
scan_ssid=1
key_mgmt=WPA-PSK
proto=WPA2
group=CCMP TKIP
pairwise=CCMP TKIP
psk=e48caac91f09bedefb186f6e12e8fabe9a83fb43b310baba66b5a8eb380aca17
}
#
#----------.----------
# generate psk(pre shared key), for router1 and passphrase = 123PASSWORD123
# wpa_passphrase router1 123PASSWORD123 (generates psk, pre shared key, hex numbers, no quotes)
# psk=e48caac91f09bedefb186f6e12e8fabe9a83fb43b310baba66b5a8eb380aca17
# copy/paste psk= into wpa2_router1.conf
Code: Select all
# file location --> /etc/wpa_supplicant/
#
#----------.----------
#Connecting wpa_cli to wpa_supplicant
#wpa_supplicant uses a named pipe (/var/run/wpa_supplicant) to communicate with wpa_cli (client interface using terminal window)
#ctrl_interface allows you to interact with a running instance of wpa_supplicant (see man wpa_cli)
#
ctrl_interface=/var/run/wpa_supplicant
#
#ctrl_interface_group=0 (By default, wpa_supplicant is configured to use gid 0 (root))
#ctrl_interface_group=wheel (allow non-root users to use the control interface, add a new group)
#
#----------.----------
#Tell the routers-access points to broadcast their names
#Modern access points are able to broadcast more than one network ID (SSID), and potentially respond to
#several more. To find these alternate SSIDs, the supplicant must poll access points.
#ap_scan=1 turns on this capability, and indicates that wpa_supplicant (not the driver) should handle AP scanning, Authentication Protocol.
#ap_scan=1 (Broadcast of ESSID)
#ap_scan=2 (Hidden broadcast of ESSID)
#
ap_scan=1
#----------.----------
#Authentication Protocol (send password between laptop and router)
#eapol(extensible authentication protocol, eap communicates between the laptop and router to authenticate the psk/password)
#eapol_version=1
eapol_version=2
#
#enable/disable EAP fast re-authentication for all EAP methods that support it)
#fast_reauth=0 (disable if long ethernet cable between laptop and router does not work)
#fast_reauth=1 (enable)
fast_reauth=1
#
#----------.----------
#ssid (service set identifier), https://en.m.wikipedia.org/wiki/Service_set_(802.11_network)
#
#----------.----------
#scan_ssid=0 (defines a network with an SSID name requiring authentication)
#scan_ssid=1 (local access points will probably not broadcast this network by default, therefore access points must be polled to see if they support this SSID.
#
#key_mgmt=NONE = Authentication will not be attempted (router without security password)
#key_mgmt=WPA-PSK = Authentication via pre-shared key (see key generation, wpa_passphrase)
#key_mgmt=WPA-EAP = Authentication via extensible authentication protocol (user name/password)
#
#proto=WEP (wired equivalent privacy, no TKIP, 1999)
#proto=WPA (WiFi protected access = (WEP with TKIP, 2004)
#proto=WPA2 (WiFi protected access 2, CCMP = AES in counter mode with CBC-MAC, 2006)
#
#----------.----------
#group=CCMP TKIP (used to broadcast to all routers(stations) to find the one with ssid=router1)
#pairwise=CCMP TKIP (used between laptop and one selected router1)
#
#----------.----------
#generate psk(pre shared key), for router1 and passphrase = 123PASSWORD123
#wpa_passphrase router1 123PASSWORD123 (generates psk, pre shared key, hex numbers, no quotes)
psk=e48caac91f09bedefb186f6e12e8fabe9a83fb43b310baba66b5a8eb380aca17
#copy/paste psk= into wpa2_router1.conf
#
#----------.----------
#
network={
ssid="router1"
scan_ssid=1
key_mgmt=WPA-PSK
proto=WPA2
group=CCMP TKIP
pairwise=CCMP TKIP
psk=e48caac91f09bedefb186f6e12e8fabe9a83fb43b310baba66b5a8eb380aca17
}
#----------.----------
#additional info, lists all available options
#http://web.mit.edu/freebsd/head/contrib/wpa/wpa_supplicant/wpa_supplicant.conf
Code: Select all
# file location --> /etc/wpa_supplicant/
#
#this will connect to the NETGEAR router without any password security
#since key_mgmt=NONE, no authentication will be attempted
#
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
eapol_version=2
fast_reauth=1
network={
ssid="NETGEAR"
scan_ssid=1
key_mgmt=NONE
}
Code: Select all
# file location --> /etc/wpa_supplicant/
#
#this will connect to any router without any password security
#since key_mgmt=NONE, no authentication will be attempted
#
ctrl_interface=/var/run/wpa_supplicant
ap_scan=1
eapol_version=2
fast_reauth=1
network={
key_mgmt=NONE
}
2021 Jan 23
Debian 9.4 Stretch, Synaptic package installer, install build-essential
-this will install g++, gcc, make, etc.
Debian 9.4 Stretch, Synaptic package installer, install linux-headers-686-pae
-this will install linux-headers-4.9.0-6-686-pae, etc.
-this will also install linux-headers-4.9.0-6-common, etc.
---
cd download_make
if required, edit manufacturer's MAKE file to point to:
for example, LINUX_SRC := /usr/src/linux-headers-4.9.0-6-686-pae
---
Problem: Debian 9.4 (stretch) MAKE will not complete if there are warning errors therefore the following edit will allow MAKE to run to completion. For example: MediaTek Ralink MT7601U usb wireless adapter
- MAKE generates --> date time warning error
- MAKE generates --> incompatible pointer types warning error
Solution: cd download_make/os/linux/
gedit makefile.6
line 45 ../../phy/rlt_rf.o
add the following new line after the existing above line. (after line 45)
EXTRA_CFLAGS += -Wno-incompatible-pointer-types -Wno-date-time
Now MAKE will run to completion
---
do patch fix before doing MAKE
see at end of step 25. Wireless driver(module) example
---
if required ./configure
MAKE
MAKE INSTALL
Reboot
---
for more debug verbose, MAKE -d
---
Remove the following file if hard disk or internal wireless cards have replaced, then shutdown, startup, now udev mechanism assigns devices from clean start.
rm /etc/udev/rules.d/70-persistent-net.rules
---
25. Wireless driver(module) example, and compile fail patch fix for Debian 9.4 Stretch
Code: Select all
MediaTek Ralink MT7601U usb wireless adapter,
-identify wireless device(chip), download mt7601U from http://www.mediatek.com
---
plugin usb wireless adapter
dmesg (goto end, to identify usb wireless adapter)
---
lsusb
Bus 008 Device 108: ID 148f:7601 Ralink Technology, Corp.
---
lsusb -v (alot more info)
Bus 008 Device 108: ID 148f:7601 Ralink Technology, Corp.
idVendor 0x148f Ralink Technology, Corp.
idProduct 0x7601
---
lsusb -t (Driver=rt2870)
Bus 008 Device 108: ID 148f:7601 Ralink Technology, Corp.
/: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M
|__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 4, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 2: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 4: Dev 108, If 0, Class=Vendor Specific Class, Driver=rt2870, 480M
---
therefore , idProduct 7601 = Driver=rt2870
---
family info: rt2800U, chips used: rt2870 + rt2820, interface: USB 2.0, PHY modes: bgn, 2009-01-19, MIMO config: 2x3:2, 2T3R:2, 2 transmitter x 3 receiver : 2 spatial streams
---
modprobe --show-depends rt2870
FATAL: Module rt2870 not found. (therefore find module that = rt2870)
---
reboot, plugin usb wireless adapter, find module name
lsmod (list kernel modules, find mt7601Usta at top of list)
mt7601Usta 738063 0 (therefore mt7601Usta = rt2870 driver)
---
modprobe --show-depends mt7601Usta
mt7601Usta.ko (this comes from the MAKE compiling)
---
modinfo mt7601Usta (list module info)
---
modprobe mt7601Usta (install module, load into kernel, MAKE INSTALL-reboot does this)
ls -l /sys/bus/usb/drivers/rt2870
---
modprobe -r mt7601Usta (remove module, remove from kernel)
ls -l /sys/bus/usb/drivers/rt2870 (now removed)
---
patch fix before doing MAKE
patch fix required for Debian9.4 (kernel 4.9.0-6-686-pae)
patch fix required for Debian8.6.0 (kernel 3.16.0-4-686-pa)
patch not required for Debian7.4.0 (kernel 3.2.0-4-686-pae)
find / -type f -iname "rt_linux.h"
gedit /include/os/rt_linux.h
copy paste the following
///removed 2016Dec3
///typedef struct _OS_FS_INFO_
///{
/// int fsuid;
/// int fsgid;
/// mm_segment_t fs;
///} OS_FS_INFO;
///start of patch 2016Dec3
typedef struct _OS_FS_INFO_
{
kuid_t fsuid;
kgid_t fsgid;
mm_segment_t fs;
} OS_FS_INFO;
///The issue is that one of the kernel headers / interfaces changed in a recent 3.x kernel (Debian 8.6.0 Jessie)
/// Where a UID / GID values were originally referred to as regular integers, they are now
/// structs with a single element. Any code relying on the older definition now will fail
/// to compile until updated to match the new kernel headers.
/// end of patch 2016Dec3