Thursday, February 16, 2012

Changing Mac address in linux

Firstly, type

sudo ifconfig -a | grep HWaddr
to find the mac address of your system .ie, you will get the output as below :

eth0      Link encap:Ethernet  HWaddr b0:f3:29:68:a6:0c 

wlan0     Link encap:Ethernet  HWaddr 11:00:22:a3:g4:20 

 where the eth0 is the address for wired lan and wlan0 for wireless ie wifi.
 Now to change the mac address, type the following

ifconfig eth0 down
ifconfig eth0 hw ether 11:20:48:BA:d1:30 
you can choose the mac id you want, i.e. 11:20:48:BA:d1:30
ifconfig eth0 up
ifconfig eth0 |grep HWaddr
Now the mac address is changed, but it is temporary one. If u reboot, you can see ur original mac id.
The mac address is burned into your lan and it can't be changed permanently. 

Saturday, February 4, 2012

Configuring ip for lan while connecting two users using ssh.

Firstly, while connecting lan between two users using an lan cable, you have to neccessarily set the ip for two users. for this, after connecting the lan cable between two systems, now type:

              sudo ifconfig
  to check whether ur ip is set or not. If the 'inet6 addr :' is blank as shown above. Then u have to set the ip. For this type,

              sudo ifconfig eth0
 the 3rd one ie, 'eth0' may be different in different systems, suppose 'eth1' is another one. As it is shown when u type ifconfig, now regarding ip, '192.168.1.' is general used for lans based on class addresses. Now rest you can decided, i have given '4' to last one. Each system should have different ip, one system with '' and another with '' as you like.

ssh :secure shell 
for sharing the files through lan or wifi, you need ssh. You need to check whether the connection is established between two users, ie, type ' ping ' followed by the ip of the other computer to which u have connected. for eg:


After that, type ssh in terminal to access the other systems terminal, following the ip of the other ie.

sudo ssh

Also graphical u can share a folder in you system or mount the other computer folders using the ssh, for this go to the 'connect to server' and choose the ssh and then type the ip of the other system.

if an error occurs indicating " host authentication or verification key failed" then, u have to remove the key, since changing lan connections with different system with ubuntu may arise this errors. Actually, the host key had been changed for the currently connecting system. so change the host key using the command :

ssh-keygen -f [path of hostkey filename] -R [ip of connecting system]

 sometimes, defaultly the hostkey filename would be in location '/home/[username]/.ssh/known_hosts'. Replace [username] with ur systems username.
you can also try the below one for the problem 
" ssh: connect to host port 22: Connection refused "

Actually , The above error looks more like sshd is not running on host .Try installing 'openssh-server' and if it doesnot work, then try below one:

#cd /root/.ssh

#vi known_hosts
*delete everyting on that file

#service sshd restart