How can I check the IP address and gateway address on CentOS?

To view the IP address and gateway address of CentOS, you can use the following command:

  1. View IP address.
ifconfig

In the output, you can find lines that start with “inet”, and the value following it is the IP address.

  1. Check the gateway address:
route -n

Find the row in the output where the destination in the target column is 0.0.0.0, then locate the corresponding value in the gateway column, which will be the gateway address.

bannerAds