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:~#
6
  • What do ip addr and ip route say? Commented Nov 15, 2016 at 11:22
  • @JohanMyréen I've added that information to the question. Commented Nov 15, 2016 at 11:26
  • Please refrain from posting images, text is better. Best regards.
    – anon
    Commented Nov 15, 2016 at 11:52
  • @maulinglawns Should I remove the images? Commented Nov 15, 2016 at 11:53
  • Yes, please, they only make it harder to read your question.
    – anon
    Commented Nov 15, 2016 at 11:54

3 Answers 3

5

Your broadcast address should be 192.168.1.255, not 192.168.1.1.

11
  • Does that require a shutdown? Or restarting the network is enough? Commented Nov 15, 2016 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!
    – anon
    Commented Nov 15, 2016 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. Commented Nov 15, 2016 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? Commented Nov 15, 2016 at 12:42
  • It is showing me this: pastebin.com/bkfS9MT9 (vodafonemobile.cpe is the address of the configuration page used by the router) Commented Nov 15, 2016 at 13:12
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.

1
  • It actually was a mix of your answer and Johan Myréen's answer. Which includes a bit of yours. I've upvoted it. Commented Nov 21, 2016 at 9:45
0

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

1
  • 1
    That is exactly what @Johan Myréen said five minutes ago...
    – anon
    Commented Nov 15, 2016 at 11:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .