sudo route -n
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
– no Gateway IP. execute following command:
sudo route add default gw 192.168.1.1
where 192.168.1.1 is an IP address of router, which is connected to the outside network
Its easy if your raspberry pi has a static ip when you want to ssh into it, instead of it getting a dynamic one each time it boots up and joins your wifi network.
Add following (if 192.168.1.1 is the router address & 18.104.22.168 is static ip you want to assign to raspi)-
interface wlan0 static ip_address=192.168.1.101/24 static router=192.168.1.1 static domain_name_server=192.168.1.1