Solution: Route use to control the flow of all packages
+ Some command lines : we must use "ip route" to configure it.
- "ip route"
- "ip route replace default 10.1.0.1"
+ Download source code
+ How to rebuild and makefile
Problem 1 : We want to pulse in Wi-Fi Adapter via USB port , How to mange and control Wi-Fi on Linux OS
+ Detect WiFi device
+ Check status of device . Up device if it downs
+ Check connection to access external network.
Solution: when we want to use WiFi, Ethernet or Bluetooth , We have to do two steps . the first step , we have to be enable them by using "connect manger" tool or "Network manager" tool to permit them action . For Example : If you have Bluetooth device,we need to install "connman" package (sudo apt-get install connman) . After installing "connman" package , we will see new file in "/var/lib/connman/settings" .
Now we will open file settings" to check status of devices
cat /var/lib/connman/settingsWe will see something like this
[global] OfflineMode=false [Wired] Enable=true [WiFi] Enable=false [Bluetooth] Enable=false
Detect device via USB Port : + Using "lsusb" command
+ Download source
+ Build and makefile
Check status of device : using "ipconfig" command line
Thong LT
Referents: + https://www.netbsd.org
+http://michaelhleonard.com
//======================================================
Connection Manager
https://github.com/IntelOpenDesign/MakerNode/wiki/connman:-wifi-configuration
https://wireless.wiki.kernel.org/en/users/documentation/connman
https://software.intel.com/en-us/blogs/2014/04/25/wireless-galileo-on-yocto-linux-iot-devkit-image
https://01.org/connman/documentation
wpa_supplicant
https://blog.nelhage.com/2008/08/using-wpa_supplicant-on-debianubuntu/
https://together.jolla.com/question/56437/i-would-like-to-toggle-internet-connectivity-via-terminal-with-dbus/
copy from https://together.jolla.com/question/56437/i-would-like-to-toggle-internet-connectivity-via-terminal-with-dbus/
For wifi:
Turn off:
/bin/dbus-send --print-reply --type=method_call --system --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:false
Turn on:
/bin/dbus-send --print-reply --type=method_call --system --dest=net.connman /net/connman/technology/wifi net.connman.Technology.SetProperty string:Powered variant:boolean:true
For cellular:
(complex method but not sure what happens if you disable the technology.) First you need to find the service:
/bin/dbus-send --system --type=method_call --print-reply --dest=net.connman / net.connman.Manager.GetServices
Its service path will be something with cellular_<lots_of_numbers>_context1</lots_of_numbers>
/bin/dbus-send --system --type=method_call --print-reply --dest=net.connman /net/connman/service/cellular_<blah>_<blah> net.connman.Service.Disconnect
And same with Connect if you want it to reconnect
Otherwise:
off:
/bin/dbus-send --print-reply --type=method_call --system --dest=net.connman /net/connman/technology/cellular net.connman.Technology.SetProperty string:Powered variant:boolean:false
on:
/bin/dbus-send --print-reply --type=method_call --system --dest=net.connman /net/connman/technology/cellular net.connman.Technology.SetProperty string:Powered variant:boolean:false
There should also be a connman tool to make things easier.
http://linuxcommando.blogspot.com/2013/10/how-to-connect-to-wpawpa2-wifi-network.htmlhttp://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/README
IP Address Management
http://linux-ip.net/html/tools-ip-management.htmlip link
http://linoxide.com/linux-command/use-ip-command-linux/
ifconfig
http://linoxide.com/linux-command/use-ip-command-linux/
Android
http://osxr.org/android/source/external/iproute2/ip/ipaddress.c
wpa_supplicant
+ wpa_action
+ wpa_cli
+ wpa_supplicant
wpa_gui
|
is a graphical frontend program for interacting with wpa_supplicant.
|
is a daemon that can connect to a password protected wireless access point.
| |
takes an SSID and a password and generates a simple configuration that wpa_supplicant can understand.
| |
is a command line interface used to control a running wpa_supplicant daemon.
|
http://processors.wiki.ti.com/index.php/Connect_to_Secure_AP_using_WPA_Supplicant
Connect to secured network - WPA2
- make sure WPA supplicant is running that is "wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B" was called before (should be called only once)
- replace “ssid” value with the SSID of a real wireless network you want to connect to.
- replace pre-shared key argument (psk) with more appropriate one.
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK wpa_cli -iwlan0 set_network 0 psk '"12345678"' wpa_cli -iwlan0 set_network 0 proto RSN wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"Matterhorn"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link
change default
ip route replace default via 1.2.3.4
Where
1.2.3.4
is the new gateway IPDefault gateWay
http://stackoverflow.com/questions/23085876/a-simple-example-of-finding-default-gateway-by-getadaptersinfo
http://stackoverflow.com/questions/15118527/how-to-read-windows-default-gateway-ip-address-in-c
http://w3facility.org/question/how-to-read-windows-default-gateway-ip-address-in-c/
http://serverfault.com/questions/356165/forwarding-traffic-from-tun-device-c-backend-to-the-default-gateway
Thong LT
http://stackoverflow.com/questions/15118527/how-to-read-windows-default-gateway-ip-address-in-c
http://w3facility.org/question/how-to-read-windows-default-gateway-ip-address-in-c/
http://serverfault.com/questions/356165/forwarding-traffic-from-tun-device-c-backend-to-the-default-gateway
No comments:
Post a Comment