How to add public static IP in CentOS 7

Issues related to configuring your network
Post Reply
Garmaz23
Posts: 4
Joined: 2021/01/05 10:20:20

How to add public static IP in CentOS 7

Post by Garmaz23 » 2021/01/05 10:30:01

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.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to add public static IP in CentOS 7

Post by TrevorH » 2021/01/05 12:32:37

Does your /etc/resolv.conf contain valid nameserver x.y.z.a entries pointing to e.g. 8.8.8.8?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Garmaz23
Posts: 4
Joined: 2021/01/05 10:20:20

Re: How to add public static IP in CentOS 7

Post by Garmaz23 » 2021/01/05 15:59:31

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.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to add public static IP in CentOS 7

Post by TrevorH » 2021/01/05 16:33:21

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
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Garmaz23
Posts: 4
Joined: 2021/01/05 10:20:20

Re: How to add public static IP in CentOS 7

Post by Garmaz23 » 2021/01/05 19:21:39

What is the command to see that config file?

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to add public static IP in CentOS 7

Post by TrevorH » 2021/01/05 20:59:56

Use your favorite editor.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Garmaz23
Posts: 4
Joined: 2021/01/05 10:20:20

Re: How to add public static IP in CentOS 7

Post by Garmaz23 » 2021/01/05 21:46:31

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?

User avatar
jlehtone
Posts: 4530
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How to add public static IP in CentOS 7

Post by jlehtone » 2021/01/05 23:29:59

Garmaz23 wrote:
2021/01/05 21:46:31
it seems that I don't have etc directory

Code: Select all

ls -l /etc

Post Reply