In order to make the changes take effect, issue the command sudo systemctl restart network. If you have fewer or more DNS entries, add or remove them as needed. NOTE: All fields in bold, you will edit to reflect your networking needs. At the bottom of that file, add the following: IPADDR=192.168.1.200 Now you'll need to add the entries to set not only the IP address, but the netmask, gateway, and DNS addresses. So when you open up that file, you'll want to change: BOOTPROTO=dhcp We need to modify that file in order to not only change the protocol from dhcp to static, but to add the specific IP address. Open the correct file for editing with the command sudo nano /etc/sysconfig/network-scripts/ifcfg-enp0s3. It is important that you configure that file, and not the ifcfg-eth file. In my instance, the file is ifcfg-enp0s3. Within the directory /etc/sysconfig/network-scripts/ you should find the file ifcfg-INTERFACENAME (Where INTERFACENAME is the name of your interface). Now that we know the name of our interface, we can configure the static address. The output of this command ( Figure A) will include the name of the interface.Īs you can see, from my output, the name of my interface is enp0s3. To do this, log into your server and issue the command ip a. A static IP address cannot be configured without this name. The first thing we must do is find out the name of our ethernet interface. With that out of the way, let's set up that static IP address. I'll assume you already have the operating system installed and working properly, have access to the machine, and have an administrative account. Of course, by nature of what we're working on this is all done manually, so be prepared to type. But what if your server is a text-only machine? What do you do then? Fortunately, it's not all that hard to configure that GUI-less server with a static IP address-you just have to know where it's configured and know the syntax of the configuration. If your CentOS server uses a GUI, changing that IP address from dynamic to static is very simple. Jul 18 11:09:45 SevahoServer systemd: Started LSB: Bring up/down networking.You may have set up a CentOS server and, in the process, accidentally set it up with DHCP.
Jul 18 11:09:45 SevahoServer network: Could not load file '/etc/sysco.' Jul 18 11:09:45 SevahoServer network: ERROR : [/etc/sysconfig/netw…o1. Jul 18 11:09:45 SevahoServer network: Error: an inet prefix is expect…/". Process: 17162 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)
Process: 16836 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
Loaded: loaded (/etc/rc.d/init.d/network)Īctive: active (exited) since Mon 11:09:45 CEST 55s ago Jul 18 10:44:10 SevahoServer polkitd: Unregistered Authentication Agent for unix-process:14387:6411987 (system bus name :1.276, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_GB.UTF-8 Jul 18 10:44:10 SevahoServer systemd: Started LSB: Bring up/down networking. Jul 18 10:44:10 SevahoServer NET: /etc/sysconfig/network-scripts/ifup-post : updated /etc/nf Jul 18 10:44:10 SevahoServer network: Could not load file '/etc/sysconfig/network-scripts/ifcfg-eno1' Jul 18 10:44:10 SevahoServer NetworkManager: ifcfg-rh: loading "/etc/sysconfig/network-scripts/ifcfg-eno1" fails: Invalid IPADDR IP4 address '“192.168.0.2”'
Jul 18 10:44:09 SevahoServer /etc/sysconfig/network-scripts/ifup-eth: Error adding address “192.168.0.2” for eno1. Jul 18 10:44:09 SevahoServer network: ERROR : Error adding address “192.168.0.2” for eno1. Jul 18 10:44:09 SevahoServer network: Error: an inet prefix is expected rather than "“192.168.0.2”/". Code: Select all Jul 18 10:44:09 SevahoServer network: arping: unknown host “192.168.0.2”