Page 1 of 1

How to add public static IP in CentOS 7

Posted: 2021/01/05 10:30:01
by Garmaz23
Hello,
I have a problem about setting up public static IP on my one server. I set up via nmtui edit vanjski_link(network name) IP, GW, MASK are correct and DNS are: 8.8.8.8 and 8.8.4.4. When I ping 8.8.8.8 it works but when I ping google.com it says name or service is unknown. However, I can't run yum update and yum install and I don't know why. It is fresh install of CentOS 7 Minimal.

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 12:32:37
by TrevorH
Does your /etc/resolv.conf contain valid nameserver x.y.z.a entries pointing to e.g. 8.8.8.8?

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 15:59:31
by Garmaz23
When I run vim /etc/resolv.conf nothing happen. I don't have nameserver, should I have it or? If I should how to set up it.

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 16:33:21
by TrevorH
You don't "run" /etc/resolv.conf, it's a config file and should have lines in it that look like

Code: Select all

search mydomain.com
nameserver 8.8.8.8
nameserver 8.8.4.4

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 19:21:39
by Garmaz23
What is the command to see that config file?

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 20:59:56
by TrevorH
Use your favorite editor.

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 21:46:31
by Garmaz23
I tried but it seems that I don't have etc directory and resolv.conf file in it. I can't ever run yum install or update :( . What you suggest?

Re: How to add public static IP in CentOS 7

Posted: 2021/01/05 23:29:59
by jlehtone
Garmaz23 wrote:
2021/01/05 21:46:31
it seems that I don't have etc directory

Code: Select all

ls -l /etc