0

I'm trying to install nodejs on my Ubuntu server but it seems not to be able to reach the internet.

My server has two network interfaces:

  1. eth0 connected to my network
  2. eth1 used sometimes to be connected to a second network and usually not used.

My network gateway is 192.168.0.1 on a common class C network.

When I try to ping any host inside my network, everything goes fine but when I try to ping the gateway, I can't receive any response and the same happens when I try to ping any external domain, regardless of the correct name resolution provided by my DNS.

Here is my configuration:

ifconfig:

root:~# ifconfig

eth0      Link encap:Ethernet  HWaddr a4:5d:36:c3:44:18
          inet addr:192.168.0.168  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a65d:36ff:fec3:4418/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31531 errors:0 dropped:108 overruns:0 frame:0
          TX packets:6734 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3896820 (3.8 MB)  TX bytes:930411 (930.4 KB)
          Interrupt:16

eth1      Link encap:Ethernet  HWaddr a4:5d:36:c3:44:19
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP 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:17

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:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:68235 (68.2 KB)  TX bytes:68235 (68.2 KB) 

my routes:

root@:~# ip route show
default via 192.168.0.1 dev eth0
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.168
192.168.1.0/24 dev eth1  proto kernel  scope link  src 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

auto eth0
        iface eth0 inet static
        metric 0
        address 192.168.0.168
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 192.168.0.3 192.168.0.2

auto eth1
        iface eth1 inet static
        metric 1
        address 192.168.1.1
        netmask 255.255.255.0
        gateway 192.168.0.168
        dns-nameservers 192.168.1.1 192.168.0.168

Where is the problem?

  • So, you can ping, say, 192.168.0.77 (assume this IP address exists and live) but when you ping 192.168.0.1, it is not successful. Is that right ? If yes, what message are you getting on the terminal ? Did your machine connect to the internet before you installed the nodejs ? – MelBurslan Mar 30 '16 at 14:05
  • Yes, it is! Here is the terminal output root@:~# ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. ^C --- 192.168.0.1 ping statistics --- 11 packets transmitted, 0 received, 100% packet loss, time 10079ms – luca3003 Mar 30 '16 at 14:12
  • please update your original post with the ping out put first. Also add output from traceroute 192.168.0.1 command – MelBurslan Mar 30 '16 at 14:17
  • another command cat /proc/sys/net/ipv6/conf/all/disable_ipv6 ? what does it say ? 1 or 0 ? – MelBurslan Mar 30 '16 at 14:21
  • Sorry, it seems I'm not allowed to edit my own posts... I haven't traceroute, only traceroute6 but I'm not able to use it – luca3003 Mar 30 '16 at 14:22
1

Please edit /etc/sysctl.conf and add these lines to the bottom:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

then run command

sysctl -p

use sudo if you are not logged in as root. Then you should see this on the terminal:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

and

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

should give output of

1

Then try pinging the 192.168.0.1 IP address again again.

EDIT

Seems like commenting out the IPV6 entries in /etc/hosts file were also needed. Figured out after a chat session.

| improve this answer | |
  • this is the output: sysctl -p net.ipv4.ip_forward = 1 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 Cat's output now is 1 The ping is still without any response – luca3003 Mar 30 '16 at 14:33
  • Mel, why do you think it happens only with the gateway? It answer without any problem to ping from my windows pc. Have I to monitor some settings on the gateway? – luca3003 Mar 30 '16 at 14:40
  • go to the CHAT WINDOW please – MelBurslan Mar 30 '16 at 14:43
  • As suggested by MelBurslan, I: - deleted the route to the eth1 - disabled the ipv6 into the /etc/sysctl.conf - deleted the ipv6 lines into the /etc/hosts - restarted the networking service (service networking restart) This worked for me! Thank you very much, Mel! – luca3003 Mar 30 '16 at 16:09
  • Sorry to say that today the issue is back :( Despite of the ip route del 192.168.1.0/24 dev eth1 the route is up again but when I remove it, nothing change. IPv6 has been disabled according to what suggested by MelBurslan but even so the gateway is unreachable. any idea? – luca3003 Mar 31 '16 at 10:58
0

You cannot have two default gateways. Remove the gateway command under auto eth1.

If you can't ping your gateway and it is connected to the same switch (or is the switch) you have problem not associated with gateways. Can other machines talk to the gateway, or is it the problem?

Comment out eth1's setup to avoid issues until fixed.

| improve this answer | |
  • I commented the line and restart the network service but without any change... – luca3003 Mar 30 '16 at 14:10
  • Try rebooting. Try traceroute to see what is going wrong. – Robert Jacobs Mar 30 '16 at 14:12
  • I also rebooted the server :( I haven't traceroute, only traceroute6 but I don't understand how to use it – luca3003 Mar 30 '16 at 14:18
  • those in the output of ip route show command are not default gateways. They are just static routes and and they are okay as is. – MelBurslan Mar 30 '16 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.