CentOS interface configuration - NathanStMarie/tech-journal GitHub Wiki
This is how you can set an interface's IP statically in CentOS 7:
- In order to change the settings of an interface, edit the interface's config file, located in the '/etc/sysconfig/network-scripts/' directory.
- To find the appropriate config file, you could use 'ls /etc/sysconfig/network-scripts/' and get a listing of the files, to which there should be found a 'ifcfg-interfaceName' file. interfaceName being the name of the interface you wish to change the settings of.
- For a static IP, you should have similar settings to these:
BOOTPROTO=none
ONBOOT=yes
IPADDR=10.0.5.200
PREFIX=24
GATEWAY=10.0.5.2
DNS1=10.0.5.5
DOMAIN=example.local
- However, generally speaking it should be understood that this file can have differing key and value pairs.