PDA

View Full Version : Connect To Internet via Command Line



0pt1k
2013-07-14, 00:38
Backup the file interfaces in etc/network/

killall network-manager
or service networking stop
killall wpa_supplicant if needed

ifconfig to check to see what all is up and down

ok, i don't like the wifi connecting during boot, i use eth0
and have it set to auto, so this is how the interfaces file looks


# The loopback network interface
auto lo
iface lo inet loopback


# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.105
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1

# The wireless network interface with dhcp
#auto wlan0
#iface wlan0 inet dhcp
# wpa-ssid AP_NAME
# wpa-key-mgmt WPA-PSK
# wpa-group TKIP CCMP
# wpa-psk AP_KEY

or you can just delete the whole wlan0 section
after a reboot eth0 is connected, if i'm going to do
testing using the alfa or onboard wifi i uncomment the
wpa2 and enter my target ap info
eth0 connects auto on reboot, so have to ifconfig eth0 down etc
to make sure no other net is connected etc or just unplug the cat 5 cable
;)

ok, now, if your ssid is hidden and you want to connect after cat 5 is unplugged you
ifconfig eth0 down killall wpa_supplicant service networking killall dhclient whatever you choose
you have to down your wlan0 and tell it your hidden APs info such as
ifconfig wlan0 down, then enter iwconfig wlan0 essid HIDDEN_AP
ifconfig wlan0 up
service networking start
that'll bring your net up to see if it's good ping -c3 google.com
remember to enter your info in the interfaces file according to the ap you are
testing on and if commented make sure to uncomment

to connect to WEP make sure kill all stuff
service networking stop killall wpa_supplicant service network-manager stop etc in case anything else is
running then:
ifconfig wlan0 down
iwconfig wlan0 essid AP_NAME
iwconfig wlan0 key AP_KEY
ifconfig wlan0 up
dhclient wlan0
ping -c3 google.com

now, since my essid is hidden the other reason i
comment it out is the hidden ap messes the boot up
meaning it tries to find the info needed and can't
anytime a goof occurs during boot coz forgot to edit the
interfaces file just boot into i think safe mode or whatchamacallit
nano to your interfaces file and edit the corrections

to do any scans iwconfig wlan0 then iwlist wlan0 scan
or whichever card you are using

can't remember if needed but just in case apt-get install wireless-tools

0pt1k