08 June, 2013

Connecting to the Network

Information about NIC
root@bt:~# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 08:00:27:ca:5f:1b

          inet addr:192.168.1.201  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feca:5f1b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:569 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13962 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:87466 (87.4 KB)  TX bytes:765286 (765.2 KB)
          Interrupt:10 Base address:0xd020

Information about Wireless
root@bt:~# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.


Start Networking

root@bt:~# /etc/init.d/networking start
or
root@bt:~# start networking

Access to SSH

1) Generate Keys 

root@bt:~# sshd-generate

2) Start SSH service
root@bt:~# start ssh
or
root@bt:~# /etc/init.d/ssh start

Change IP address
root@bt:~# ifconfig eth0 192.168.1.202/24 up

root@bt:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 08:00:27:ca:5f:1b
          inet addr:192.168.1.202  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feca:5f1b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1723 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15311 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:183136 (183.1 KB)  TX bytes:916911 (916.9 KB)
          Interrupt:10 Base address:0xd020

Configure Default Gateway

root@bt:~# route add default gw 192.168.1.1

Verify DNS Configuration 

root@bt:~# cat /etc/resolv.conf

nameserver 192.168.1.1

Change DNS Configuration 

root@bt:~# echo nameserver 8.8.8.8 > /etc/resolv.conf
Verify DNS Configuration 
root@bt:~# cat /etc/resolv.conf

nameserver 8.8.8.8

How To save All Network Configuration
root@bt:~# vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Write Your Configuration And Save It 
auto eth0
iface eth0 inet static
address 192.168.1.202
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Activate SSH on Startup 
root@bt:~# update-rc.d -f ssh defaults
update-rc.d: warning: ssh stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (none)
 Adding system startup for /etc/init.d/ssh ...
   /etc/rc0.d/K20ssh -> ../init.d/ssh
   /etc/rc1.d/K20ssh -> ../init.d/ssh
   /etc/rc6.d/K20ssh -> ../init.d/ssh
   /etc/rc2.d/S20ssh -> ../init.d/ssh
   /etc/rc3.d/S20ssh -> ../init.d/ssh
   /etc/rc4.d/S20ssh -> ../init.d/ssh
   /etc/rc5.d/S20ssh -> ../init.d/ssh

##########################################################################################################