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.

  • 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). – user4556274 Jun 21 '17 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. – Prateek Manocha Jun 21 '17 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. – user4556274 Jun 21 '17 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. – Prateek Manocha Jun 21 '17 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 Jun 21 '17 at 12:24
  • @PrateekManocha 2) Software changes a *lot* between some versions. *Please, please, always say what version of Ubuntu you are using*. 3) I think questions which involve the GUI on Ubuntu like this are really supposed to be asked on the "Ask Ubuntu" site. – sourcejedi Jun 21 '17 at 12:24
  • I am using Ubuntu 14.04 LTS 64 bit version. I have assigned IP address by going to network settings and editing the connections option. – Prateek Manocha Jun 21 '17 at 12:26
  • @user4556274 please consider the possibility that people use the GUI when they tag their question as Ubuntu and use phrases like "here my under network settings I have assigned". Then, they did not use a "command"; instead you want them to confirm which GUI tool they used. As Prateek Manocha has just done in their last comment. Generally you want to know a) exactly what Linux they installed, b) an outline of what they clicked on. – sourcejedi Jun 21 '17 at 12:31
  • @sourcejedi I tried doing the way u suggested but the netstat -rn is same as before. But main thing here is Why i am not able to ping from my pc to my router. and i have no message being displayed whether destination host is not reachable or what... – Prateek Manocha Jun 21 '17 at 13:06
  • @PrateekManocha it can be because what other users have written you already is 100% correct: some devices just block ICMP ping. Do you have any reason to expect that your router does not block ICMP ping? If not, then it is not a problem. Your missing default route (which should have the Mask of 0.0.0.0 and Destination 0.0.0.0) is definitely a problem, if you want to make connections to the wider internet, which is on the other side of your router. – sourcejedi Jun 21 '17 at 13:24
  • @PrateekManocha BTW this is not a sensible address to configure the router to use. Unless you have multiple routers plugged into each other, you want the router on this network to be 192.168.0.1, or possibly 192.168.0.254. I.e. the first, or possibly last, usable address. This simply helps avoid confusing people, when they try to troubleshoot the network. – sourcejedi Jun 21 '17 at 14:03

1 Answers1

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.

sourcejedi
  • 48,311
  • 17
  • 143
  • 296
  • 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. – Prateek Manocha Jun 21 '17 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 Jun 21 '17 at 13:39
  • @sourcejedi your answer is ok with +1, i am trying to know the problem . – GAD3R Jun 23 '17 at 11:31