__ __.______________.___
/ \ / \ \_ _____/| |
______ \ \/\/ / || __) | | ______
/_____/ \ /| || \ | | /_____/
\__/\ / |___|\___ / |___|
\/ \/
/ \ / \ \_ _____/| |
______ \ \/\/ / || __) | | ______
/_____/ \ /| || \ | | /_____/
\__/\ / |___|\___ / |___|
\/ \/
When i was work as sysadmin command line interface is a big friend, i always use command line in my live every day. I didn't feel heavy while using it. For the example, when i want to connecting my notebook to the wifi. Ofcourse unix/linux has so much tool for handling wireless connection which is run over GUI. But, connecting wifi using command line was more fun. Did you not believe? I will show you the tips.
It just for fun connecting notebook to wifi using command line interface. First of all, your wireless interface must be detected by your kernel. Unless, you must configure your wireless driver, for this issue see my article: "Howto configure ndiswrapper for broadcom driver in linux slackware".
Check your available network interface as shown bellow:
# ifconfig -a
eth0 Link encap:Ethernet HWaddr 54:04:A6:79:25:DB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:44 Base address:0x2000
eth0 Link encap:Ethernet HWaddr 54:04:A6:79:25:DB
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:44 Base address:0x2000
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:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1360 (1.3 Kb) TX bytes:1360 (1.3 Kb)
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:24 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1360 (1.3 Kb) TX bytes:1360 (1.3 Kb)
wlan0 Link encap:Ethernet HWaddr 78:92:9C:20:F5:DC
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
You can check your network interfaces, is there any wireless extension in your interfaces:
# iwconfig
lo no wireless extensions.
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=14 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Mode:Managed Access Point: Not-Associated Tx-Power=14 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Checking availability wireless network.
# iwlist wlan0 scanning
wlan0 Scan completed :
Cell 01 - Address: 04:18:0F:DB:1D:D0
Channel:3
Frequency:2.422 GHz (Channel 3)
Quality=70/70 Signal level=-39 dBm
Encryption key:on
ESSID:"AndroidTether"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000000014d7f180
Extra: Last beacon: 402ms ago
IE: Unknown: 000D416E64726F6964546574686572
IE: Unknown: 010882848B0C12961824
IE: Unknown: 030103
IE: Unknown: 0706555320010B1B
IE: Unknown: 2A0100
IE: Unknown: 32043048606C
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Cell 02 - Address: 00:1D:7E:58:F9:C7
Channel:11
Frequency:2.462 GHz (Channel 11)
Quality=43/70 Signal level=-67 dBm
Encryption key:on
ESSID:"KambingNet"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s
Bit Rates:9 Mb/s; 18 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=00000096f15cb83e
Extra: Last beacon: 304ms ago
IE: Unknown: 000A4B616D62696E674E6574
IE: Unknown: 010882848B960C183048
IE: Unknown: 03010B
IE: Unknown: 0706444520010D14
IE: Unknown: 2A0100
IE: Unknown: 32041224606C
IE: Unknown: 080A0001BD1E79228A000000
wlan0 Scan completed :
Cell 01 - Address: 04:18:0F:DB:1D:D0
Channel:3
Frequency:2.422 GHz (Channel 3)
Quality=70/70 Signal level=-39 dBm
Encryption key:on
ESSID:"AndroidTether"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s
Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=0000000014d7f180
Extra: Last beacon: 402ms ago
IE: Unknown: 000D416E64726F6964546574686572
IE: Unknown: 010882848B0C12961824
IE: Unknown: 030103
IE: Unknown: 0706555320010B1B
IE: Unknown: 2A0100
IE: Unknown: 32043048606C
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
Cell 02 - Address: 00:1D:7E:58:F9:C7
Channel:11
Frequency:2.462 GHz (Channel 11)
Quality=43/70 Signal level=-67 dBm
Encryption key:on
ESSID:"KambingNet"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s
Bit Rates:9 Mb/s; 18 Mb/s; 48 Mb/s; 54 Mb/s
Mode:Master
Extra:tsf=00000096f15cb83e
Extra: Last beacon: 304ms ago
IE: Unknown: 000A4B616D62696E674E6574
IE: Unknown: 010882848B960C183048
IE: Unknown: 03010B
IE: Unknown: 0706444520010D14
IE: Unknown: 2A0100
IE: Unknown: 32041224606C
IE: Unknown: 080A0001BD1E79228A000000
We will use AndroidTether as our wireless network. So, we must define the essid and password using tool wpa_passphrase bellow:
essid : AndroidTheter
password: abcdefghijklm
password: abcdefghijklm
# wpa_passphrase AndroidTheter abcdefghijklm >> /etc/wpa_supplicant.conf
This command updates /etc/wpa_supplicant.conf with following contens as follow:
network={
ssid="AndroidTheter"
#psk="abcdefghijklm"
psk=27847e70acd62edc138c4c859ef5df9ff21708bb7c5d8b033cca60951ca7ba10
}
ssid="AndroidTheter"
#psk="abcdefghijklm"
psk=27847e70acd62edc138c4c859ef5df9ff21708bb7c5d8b033cca60951ca7ba10
}
Then, we can start to lunch wireless adapter to request access to the network.
# wpa_supplicant -D wext -c /etc/wpa_supplicant.conf -i wlan0 -B
root@darkstar:~# dhclient wlan0
root@darkstar:~# dhclient wlan0
root@darkstar:~# ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 78:92:9C:20:F5:DC
inet addr:192.168.2.103 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::7a92:9cff:fe20:f5dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1008 (1008.0 b) TX bytes:6295 (6.1 Kb)
wlan0 Link encap:Ethernet HWaddr 78:92:9C:20:F5:DC
inet addr:192.168.2.103 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::7a92:9cff:fe20:f5dc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:42 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1008 (1008.0 b) TX bytes:6295 (6.1 Kb)
Ip address was gotten, so gateway and dns server would be obtained also.
root@darkstar:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.2.254 0.0.0.0 UG 0 0 0 wlan0
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.2.254 0.0.0.0 UG 0 0 0 wlan0
# cat /etc/resolv.conf
nameserver 192.168.2.254
nameserver 192.168.2.254
# ping binksh.blogspot.com
PING blogspot.l.google.com (209.85.175.132) 56(84) bytes of data.
64 bytes from nx-in-f132.1e100.net (209.85.175.132): icmp_req=1 ttl=39 time=218 ms
64 bytes from nx-in-f132.1e100.net (209.85.175.132): icmp_req=2 ttl=39 time=157 ms
64 bytes from nx-in-f132.1e100.net (209.85.175.132): icmp_req=3 ttl=39 time=157 ms
^C
--- blogspot.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 157.045/177.675/218.392/28.792 ms
PING blogspot.l.google.com (209.85.175.132) 56(84) bytes of data.
64 bytes from nx-in-f132.1e100.net (209.85.175.132): icmp_req=1 ttl=39 time=218 ms
64 bytes from nx-in-f132.1e100.net (209.85.175.132): icmp_req=2 ttl=39 time=157 ms
64 bytes from nx-in-f132.1e100.net (209.85.175.132): icmp_req=3 ttl=39 time=157 ms
^C
--- blogspot.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 157.045/177.675/218.392/28.792 ms