centos icon

CentOS 7 – Network Modify Configuration

Network interface can be configured by control files of the specified interface. Those files are usually named /etc/sysconfig/network-scripts/ifcfg-<name>.

Looks like:

Static DHCP
BOOTPROTO=static BOOTPROTO=dhcp
IPADDR=172.16.128.129
PREFIX=24
GATAWAY=172.16.128.1
DNS1-172.16.128.254

The static route for each interface can be configured in file /etc/sysconfig/network-scripts/route-<name>, which is in format:

To remember:

NetworkManager runs by default and may cause conflicts with you custom network configuration. If you decided to manage network settings manually, add NM_CONTROLLED=no in the ifcfg-<name> file of each network interface.

In /etc/sysconfig/network you can set fully-qualified hostname and default gateway if you using Static configuration.

In my case is empty, but may look like:

If DHCP is in use, resolv.conf is rewritten automatically as interfaces are started unless you put PEERDNS=no in the ifcfg-<name> configuration file.

To turn on and off network interfaces you can use ifup <name> and ifdown <name>, like

And remember after each change you made to configuration files you may restart the network service.

About pavel