3

I have this server for a while, and was present on other questions.

A while ago, I've changed the network and the gateway IP was changed too.
Since then, there is no internet on this machine.

I need access to the internet to update the machine and (sometimes) to install packages I need for development.

What I've tried:

  • route add default gw 192.168.1.1 (https://unix.stackexchange.com/a/259046/133591)
  • ip route replace default via 192.168.1.1 (https://unix.stackexchange.com/a/199070/133591)
  • ip route add default via 192.168.1.1 dev eth0 (https://unix.stackexchange.com/a/259048/133591)
  • Editing the file /etc/network/interfaces, to look like below:

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto eth0
    allow-hotplug eth0
    #iface eth0 inet dhcp
    iface eth0 inet static
        address 192.168.1.205
        netmask 255.255.255.0
        gateway 192.168.1.1
        broadcast 192.168.1.1
    

And this is the result of all my attempts:

root@webtest:~# route add default gw 192.168.1.1
SIOCADDRT: Network is unreachable
root@webtest:~# ip route replace default via 192.168.1.1
RTNETLINK answers: Invalid argument
root@webtest:~# ip route add default via 192.168.1.1 dev eth0
RTNETLINK answers: Invalid argument
root@webtest:~#

The most bizarre thing is the SIOCADDRT: Network is unreachable error, when I'm clearly connected using SSH, which used the network.

What else should I try? I don't even know what else to do.

My system is running Debian 8.2 x64, with a single interface network.


Note:

I have read How can I change the default gateway? and How to set the Default gateway (which is where I got all those tries from).

The accepted answer on How can I change the default gateway? is a FreeBDS-exclusive answer.


Running ip addr and ip route gives the following:

root@webtest:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1a:92:47:00:b5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.205/24 brd 192.168.1.1 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::21a:92ff:fe47:b5/64 scope link
       valid_lft forever preferred_lft forever
root@webtest:~# ip route
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.205
root@webtest:~#

Edit 1:

After the change that @Johan Myréen suggested, the result is still the same.

Below is the updated ip addr with 2 pings:

root@webtest:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1a:92:47:00:b5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.205/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::21a:92ff:fe47:b5/64 scope link
       valid_lft forever preferred_lft forever
root@webtest:~# ip route
default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.205
root@webtest:~# ping google.com
ping: unknown host google.com
root@webtest:~# ping facebook.com
ping: unknown host facebook.com
root@webtest:~#
Ismael Miguel
  • 241
  • 4
  • 15

3 Answers3

5

Your broadcast address should be 192.168.1.255, not 192.168.1.1.

Johan Myréen
  • 12,862
  • 1
  • 32
  • 33
  • Does that require a shutdown? Or restarting the network is enough? – Ismael Miguel Nov 15 '16 at 11:36
  • @Johan Myréen Might be a stupid question, but do we **need** a `broadcast` entry? I only have `address`, `netmask` and `gateway` in my `/etc/network/interfaces` and it works fine! – maulinglawns Nov 15 '16 at 11:45
  • Sadly, it didn't fix it. There's no internet on it. Maybe I screwed something? I've updated the question anyway. For a good measure, I've edited the file `/etc/network/interfaces` and rebooted the machine. – Ismael Miguel Nov 15 '16 at 11:51
  • I would say you have made progress. The route is in place, but now you have a DNS problem. Is `/etc/resolv.conf` ok? – Johan Myréen Nov 15 '16 at 12:42
  • It is showing me this: http://pastebin.com/bkfS9MT9 (vodafonemobile.cpe is the address of the configuration page used by the router) – Ismael Miguel Nov 15 '16 at 13:12
  • Could you try `ping 8.8.8.8` or `traceroute 8.8.8.8`? – Johan Myréen Nov 15 '16 at 13:45
  • @JohanMyréen Weirdly, that works. I can ping it with a ping of ~72ms. – Ismael Miguel Nov 15 '16 at 15:22
  • This confirms that your internet connection is probably perfectly fine, but your DNS is not set up correctly. Are you sure 192.168.1.254 is the correct address of your name server? – Johan Myréen Nov 15 '16 at 15:32
  • @JohanMyréen It isn't. That's the old gateway. The new one is 192.168.1.1. – Ismael Miguel Nov 15 '16 at 15:36
  • Your old router apparently also functioned as a name resolver. You will have to edit `/etc/resolv.conf` and add the IP address of your new name server, which is not necessarily to address of your new router. – Johan Myréen Nov 15 '16 at 19:25
  • @JohanMyréen I'm so sorry for taking so long to answer. I didn't get the notification of the comment. Yes, editing the file `/etc/resolv.conf` and changing every instance of `192.168.1.254` to `192.168.1.1` solved it. I've marked your answer as accepted. – Ismael Miguel Nov 21 '16 at 09:44
1

Since your "Edit 1" comments, you would notice that route -n now shows a default gateway. Having ping replying with unknown host may just be related to your DNS configuration. Try ping-ing IPs instead.

Note: in your /etc/network/interfaces, the allow-hotplug eth0 may not be necessary.

SYN
  • 2,793
  • 12
  • 19
0

From configuration you have done on ip and netmask, Assuming your subnet is /24. Then you broadcast will be 192.168.1.255

suhas
  • 161
  • 1
  • 1
  • 4