In Windows Machine if want to check our IP Address or Gateway the easy method is use Command Prompt type ipconfig then it will lists down everything. But in LINUX it different.
In Linux, they call it ifconfig, open the terminal and type ifconfig it will lists down all the available network. But it didn’t print out the Gateway IP Address.
The easy way to print out Gateway IP Address command.
route -n | grep 'UG[ \t]' | awk '{print $2}'Or, you can use others command to print out the Gateway.
route -nee 192.168.1.100 0.0.0.0 255.255.255.0 U 1 0 0 eth0 0 0 0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0 0 0192.168.1.1 is gateway IP address. The flag U indicates that route is up and G indicates that it is gateway.