If you want to change your networking configuration in CentOS, there are multiple ways to do it. Since all the configuration and settings are stored as text files in Linux, the quickest way is to simply type a couple of commands or edit the text files by hand. In this section, we'll take a look at the commands and text files which hold the relevant information.
ifconfig: The 'ifconfig' command allows you to view and edit network configuration from the command-line. The basic usage of the command is as follows:
- ifconfig [network_card] [ip_address] [options] [changes]
- ifconfig eth0
- ifconfig eth0 192.168.1.37 netmask 255.255.255.0
You can choose to simply type the 'ifconfig' command to view the configuration of all detected network cards on your system. If you'd rather have the information of a specific network card, just append its name at the end of the command. Almost all wired connections will be named ethX, where X can be a number from 0 onwards. If you cannot find any network cards, make sure your kernel supports it, and if the drivers are compiled as a module, then load them by typing 'modprobe <driver_name>'
The third command mentioned above will change the IP address of your network card 'eth0' to 192.168.1.37 with a subnet mask of 255.255.255.0.