Linux - How to fetch gateway ip address, Use iproute2

How to fetch gateway ip address


The below command will fetch the gateway ipaddress of your system.

  ip route list match 0.0.0.0/0 | cut -d " " -f 3

OUTPUT:
192.168.0.1

The above command will just fetch the gateway IP Address and will print it. You can also use iproute2 command to fetch the gateway IP address.

The topic on Linux - How to fetch gateway ip address is posted by - Math

Hope you have enjoyed, Linux - How to fetch gateway ip addressThanks for your time

Tech Bluff