Linux find gateway IP address command

I type route command but it says route command not found. How can I find gateway IP address in Linux using command line option?

  1. Open the terminal application
  2. Type ip route | grep default command to find your gateway IP in Linux. The output should be as follows:
    default via 192.168.2.254 dev enp0s31f6 proto static metric 100
    10.83.200.0/24 dev lxdbr0 proto kernel scope link src 10.83.200.1
    192.168.2.0/24 dev enp0s31f6 proto kernel scope link src 192.168.2.25 metric 100
  3. The route command removed from Linux and you need to use the ip command only.

See the following tutorial for info


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki