2

I have a problem. with the help from the people at this forum I managed to setup my network. To recapitulate i have two computers comp1 and comp2 connected like this

comp2(eth0) -> comp1(eth1)    
comp1(eth0) -> network

my interface looks like this:

comp1:

auto lo  
iface lo inet loopback  
auto eth0  
iface eth0 inet dhcp  
auto eth1  
iface eth1 inet static  
address 10.10.0.10  
netmask 255.255.255.0

comp2:

auto eth0  
iface eth0 inet static  
address 10.10.0.20  
netmask 255.255.255.0  
gateway 10.10.0.10  

comp2

$ route  
Kernel IP routing table  
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  
default         10.10.0.10       0.0.0.0         UG    100    0        0 eth0  
10.10.0.0        *               255.255.255.0   U     0      0        0 eth0 

comp1:

$ route  
Kernel IP routing table  
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    
default         g128.mp.l       0.0.0.0         UG    100    0        0 eth0  
10.10.0.0       *               255.255.255.0   U     0      0        0 eth1   
10.128.0.0      *               255.224.0.0     U     0      0        0 eth0 

Now: I can ssh into my comp2 and ping 8.8.8.8 and I get:

ping 8.8.8.8  
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.  
64 bytes from 8.8.8.8: icmp_req=1 ttl=43 time=42.6 ms  
64 bytes from 8.8.8.8: icmp_req=2 ttl=43 time=41.8 ms

But if I try to wget:

wget -O - 173.194.70.113 | grep google  
function n(){if(google.timers.load.t){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=e;google.kCSI.imc=c;google.kCSI.imn=b;
google.kCSI.imp=d;void 0!==google.stt&&(google.kCS...

which is OK but if i try it like this:

wget -O - http://www.google.com |grep google  
--2013-11-21 15:07:35--  http://www.google.com/  
Resolving www.google.com (www.google.com)... failed: Temporary failure in name   resolution.  
wget: unable to resolve host address `www.google.com'  

which implies to me that this is a DNS server problem .

my less /etc/resolv.conf on comp1 looks like this:

Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)  
DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN  
nameserver 127.0.0.1  
search xxx.xxx.xxx 

xxx are not important but on comp2 it looks like this :

Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)  
DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN  

how to set this up?

Mitch
  • 107,631
baxy
  • 77

2 Answers2

1

When you set a static IP address in /etc/network/interfaces, you are responsible to set DNS nameservers. I suggest you amend the file on comp2 to read:

auto lo  
iface lo inet loopback  

auto eth0  
iface eth0 inet static  
address 10.10.0.20  
netmask 255.255.255.0  
gateway 10.10.0.10  
dns-nameservers 8.8.8.8 8.8.4.4

Then get the system to re-read and use the change:

sudo ifdown eth0 && sudo ifup -v eth0

And test:

ping -c3 8.8.8.8
ping -c3 www.google.com
chili555
  • 60,188
1

I had a similar problem, in my case, ping/dig/nslookup were ok but wget/curl and Firefox did not work fine. And I edited the /etc/resolv.conf to use another namespace such as 114.114.115.115, everything was ok. I also tried to set the same DNS in Windows 7, everything still was ok which made me confused. But I found an article in which people discussed the issue caused by ipv6. Finally, I fixed the issue by disabling the IPv6 in Ubuntu using the sysctl utility with the following steps.

# show whether ipv6 is disabled or not
sudo sysctl -a | grep disable_ipv6
# disable all the ipv6
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
# also you can check the settings
sudo sysctl -a | grep disable_ipv6

After that, I could connect to the internet without problem. Hopefully it can help you!

Btw, if you need to make the above settings permanently, you should edit the file /etc/sysctl.conf and append the following lines:

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
muru
  • 197,895
  • 55
  • 485
  • 740