0
root@prateek-desktop:~# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1

I have a network where my wireless router has static IP address 192.168.0.80 with subnet mask 255.255.255.0 and default gateway as 192.168.0.81. My pc has IP address 192.168.0.81 (same as gateway of my router). I have few other devices like smart phones n laptops connected to wireless router via DHCP connection. Now When I try to ping from my PC to my router static IP address (192.168.0.80) it does not respond anything. no message is being displayed but for other addresses it says destination host is unreachable.

What can be the reason and how can I trouble shoot ? Please help i am stuck in my master thesis at this point.

11
  • How are you assigning the gateway? This is normal netstat -rn output for a locally attached network. The route is up (U), but is directly accessed on the eth1 interface, not via a gateway (flags UG, and possibly others). Commented Jun 21, 2017 at 12:07
  • When I was assigning the IP address to my PC i assigned IP address (192.168.0.81), subnet mask (255.255.255.0) and default gateway (192.168.0.80). so under netstat -rn output i want for all destinations under 192.168.0.0 the gateway should be 192.168.0.80 which is my router's ip adress. Commented Jun 21, 2017 at 12:08
  • your comment repeats that you assigned a gateway, but not how you assigned it (what command? what tool?). What machine exists at address 192.168.0.80 on your local network? Why do you expect a non-zero gateway entry in the routing table for a locally attached network? Please edit your question with any additional information, rather than adding comments. Commented Jun 21, 2017 at 12:11
  • Hi guys I have updated my question please let me know if any further info u need so that you can help me better. I request you to help me out please. Commented Jun 21, 2017 at 12:21
  • @PrateekManocha I am assuming your question means, that you assigned the IP and Gateway, using the default GUI installed by Ubuntu Desktop. It might be called "Settings" or "Control Center" (I don't actually know :). Or, you might have reached it by clicking on some icon for the network in the top bar. Please let us know if I'm wrong!. 1) If you don't know what the underlying software is really called, you should still outline the steps you used, then we can generally work out what it is.
    – sourcejedi
    Commented Jun 21, 2017 at 12:24

1 Answer 1

1

Since we're struggling here, I think you would benefit from becoming familiar with some more direct hacks.

The ip route command can edit routes temporarily. ip route shows existing routes, it is a more recent equivalent of netstat -rn. ip route add default via $ROUTER_IP will add a default route which uses $ROUTER_IP. (I.e. replace it with the IP you apparently know the router to have, whatever that is). To remove it again, use ip route del default via $ROUTER_IP. Note that default is the same as writing 0.0.0.0/0.


Note you need to disconnect and reconnect to the network before the "gateway" in Network Settings window - or any other setting there - will take effect.

I tried disconnecting and reconnecting. The netstat -rn is same as above.

Thanks. I don't understand how this could happen - i.e. it suggests to me either a very annoying bug, or you're doing something slightly different, like editing a connection that's actually tied to eth0 instead of eth1. This would be possible to show by taking exhaustive screenshots. (Just for the record, you have given some information that was not quite right or contradictory already).

I can suggest looking at nmcli connection and nmcli connection show id NAME. NAME is taken from the NAME column of the first command. The output from the last command will be quite long.

I would also make sure you have ticked "Make available to other users", and then I would be able to look at a text configuration file written by NetworkManager. This is not as long as nmcli connection show, because it does not include unnecessary default values. On Ubuntu, the config files could be in /etc/network/interfaces, /etc/network/interfaces.d, or /etc/NetworkManager/system-connections.

When I try to ping from my PC to my router static IP address (192.168.0.80) it does not respond anything. no message is being displayed but for other addresses it says destination host is unreachable.

That's neither good nor bad. Some devices block ICMP ping. The fact that it does not say "destination host is unreachable", nor any other message, actually means that this IP address is reachable! As I mentioned in my previous answer, you can confirm it like this:

$ ip -4 neigh
172.16.8.1 dev wlp2s0 lladdr 74:44:01:86:42:d6 REACHABLE

there will also be entries saying INCOMPLETE or something, from any non-existent IP address which you have tried to ping.


I have assigned my PC gateway as 192.168.0.80

Yes, something did not work. In fact, you are showing no "default gateway" at all. You only have the automatic route for your local network, 192.168.0.*. (That's what 192.168.0.0 with mask 255.255.255.0 means). You will want this route for the local network to stay, and add a second route for your "default gateway".

I'm sorry to tell you that the "Apply" button you clicked in the NetworkManager graphical interface is misleading. (Or whatever it says on the button you used to close the NetworkManager settings window). Unlike most other "Apply" buttons in GNOME, this one does not take effect immediately. It only saves the setting for future use.

3
  • I tried disconnecting and reconnecting. The netstat -rn is same as above. Moreover I am not able to ping my gateway 192.168.0.81 though a router in my network to which my pc is directly connected has this IP address. It should ping but no message is being displayed. Commented Jun 21, 2017 at 12:38
  • @PrateekManocha I have added some temporary commands to add a default route, so you can investigate what needs to be done before you work out why NetworkManager is not doing what you tell it. And I have edited my answer, to explain why the ping results you shared so far do not show any problem. I have also included some suggestions that I would be using to try and look at the real problem with NetworkManager. I'm afraid I don't use the exact same Linux as you, so it's not as helpful as I'd like.
    – sourcejedi
    Commented Jun 21, 2017 at 13:39
  • @sourcejedi your answer is ok with +1, i am trying to know the problem .
    – GAD3R
    Commented Jun 23, 2017 at 11:31

You must log in to answer this question.

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