Unable to connect to internet in debian squeeze

debian-squeezenetworking

I recently installed Debian squeeze on my development machine every things went well i was able to connect to the Internet yesterday i moved my hard disk to another machine ,i can't able to connect to the Internet in Debian,but i can connect to it using Windows XP.

i tried the following commands but no use not working

/etc/init.d/networking restart
/var/log/syslog        doesn't show any error
ping www.google.com    results no host found

More details

ifconfig

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:39 errors:0 dropped:0 overruns:0 frame:0
      TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:13737 (13.4 KiB)  TX bytes:13737 (13.4 KiB)

netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

cat /etc/resolv.conf

domain Home
search Home
nameserver 192.168.1.1
nameserver 192.168.1.1

/etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp

ifconfig -a

eth1  Link encap:Ethernet  HWaddr 6c:f0:49:f6:45:ae  
      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:26 Base address:0x6000 

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:70 errors:0 dropped:0 overruns:0 frame:0
      TX packets:70 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0 
      RX bytes:18029 (17.6 KiB)  TX bytes:18029 (17.6 KiB)

Best Answer

Your /etc/network/interfaces is configured foreth0 however, you don't have an eth0 but an eth1.

udev tries to statically name the ethernet cards, by assigning a semi-permanent name to cards the first time they are seen. You can get rid of the 'reservation' of eth0 from your previous ethernet card by deleting the line from /etc/udev/rules.d/70-persistent-net.rules which ends with name=eth0 and the line which ends with name=eth1. Then upon the next reboot (or when you run udevadm trigger), your ethernet card will be assigned eth0 semi-permanently.

You can also change eth1 to eth0 temporarily by running ip link set name eth0 dev eth1, after which /etc/init.d/networking stop ; /etc/init.d/networking start should get you back on the network.