Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hello Everyone,
I have installed CentOS 8. Then I have installed Nagios core on it. I installed it on Vmware 6.5 in my company.
After complete installation of OS and Nagios Core I noticed "ifconfig -a" is showing IP address different than I saved in /etc/sysconfig/network-script/ifcfg-ens192. I gave static IP address on ifcfg0ens192 file.
The problem is "ifconfig -a" is showing one of our dhcp Ip that our user workstation is using.
The thing is both IP address are working on http://IPAddress/nagios without any issue.
I will appreciate if someone can help me why is it showing wrong IP Address.
Thanks,
Marjan
Did you reboot after changing the ifcfg-ens192 file? Are you sure that this file describes the connection that your system is using?
Use nmcli con to check the currently active connection, then nmcli con show CONNECTION to see its details, where CONNECTION is the name of the active connection.
Also use ip address to see all addresses for ens192. ifconfig might not be able to show them all.
Did you reboot after changing the ifcfg-ens192 file? Are you sure that this file describes the connection that your system is using?
Use nmcli con to check the currently active connection, then nmcli con show CONNECTION to see its details, where CONNECTION is the name of the active connection.
Also use ip address to see all addresses for ens192. ifconfig might not be able to show them all.
Hi berndbausch,
Thanks for your respond.
As you see in ifcfg-ens file, I only gave one static IP, but "ip a" is showing 2 IPs.( Please see the attachments)
Under the DHCP Ip address, time is decreasing. It seems like it is a temporary Ip Address.
Even when I remove the temporary dhcp IP with this command, “ip addr change IP address” and change valid life time to a lower number like 10 seconds, After 10 seconds it removes it, but after restarting machine, it shows up again.
I found this link: https://access.redhat.com/discussions/3206861 and did " omit_dracutmodules+="ifcfg" ", but it did not work.
Is the any other file can I check if my system set up to get dhcp IP from it, I can check and fix?
When I installed centos on physical machine, using same CentOS ISO file "CentOS-8.2.2004-x86_64-minimalCentOS-8.2.2004-x86_64-minimal", I did not have this issue. Is it possible on VMs, it creates temporary IP Address?
As you see in ifcfg-ens file, I only gave one static IP, but "ip a" is showing 2 IPs.( Please see the attachments)
Under the DHCP Ip address, time is decreasing. It seems like it is a temporary Ip Address.
Even when I remove the temporary dhcp IP with this command, “ip addr change IP address” and change valid life time to a lower number like 10 seconds, After 10 seconds it removes it, but after restarting machine, it shows up again.
On my system the ifcfg file does not have quotes around any of the values in that file. Mine currently is (partial)
In my experience I have never seen quotes in any ifcfg files on any systems, and I wonder if that might have an effect on how the IP is assigned. I also see that your ifcfg shows BOOTPROTO="static" while mine, configured with the network manager shows BOOTPROTO=none.
I am using fedora and you are on Centos, but that should not be an issue.
One thing that comes to mind from past lives is that the behavior you are describing is reminiscent of when I was using alias IPs for a web server, in that multiple IPs were assigned to a single nic on the host as it served multiple guest web sites. Each IP was fully capable independent of the others. IIRC, each IP required a separate ifcfg file to assign a separate interface name to the same device.
The disconcerting thing really is that it gets dhcp assigned IP as primary and static IP as secondary which, to me, would imply multiple ifcfg files with dhcp happening first.
Are you certain there is not another ifcfg file with a different name for the same interface. You would need to look at the line DEVICE=???? in each ifcfg file to find out.
You would also need to make certain the host for this vm is not assigning the dhcp address for you.
Last edited by computersavvy; 11-17-2020 at 06:23 PM.
In my experience I have never seen quotes in any ifcfg files on any systems, and I wonder if that might have an effect on how the IP is assigned. I also see that your ifcfg shows BOOTPROTO="static" while mine, configured with the network manager shows BOOTPROTO=none.
I am using fedora and you are on Centos, but that should not be an issue.
One thing that comes to mind from past lives is that the behavior you are describing is reminiscent of when I was using alias IPs for a web server, in that multiple IPs were assigned to a single nic on the host as it served multiple guest web sites. Each IP was fully capable independent of the others. IIRC, each IP required a separate ifcfg file to assign a separate interface name to the same device.
The disconcerting thing really is that it gets dhcp assigned IP as primary and static IP as secondary which, to me, would imply multiple ifcfg files with dhcp happening first.
Are you certain there is not another ifcfg file with a different name for the same interface. You would need to look at the line DEVICE=???? in each ifcfg file to find out.
You would also need to make certain the host for this vm is not assigning the dhcp address for you.
=========
Thank you very much. I had copied the original ifcfg file with another name "OLD" at the end, and I believe because the IP was the same that I had inside the ifcfg-ens192 file, system gave a dhcp IP to the nic card. I deleted the second file and I removed all double quotation. Now It is only showing my static IP.
Thanks for your help.
At least we see that the static address you configured has been made effective. Now show us the output of nmcli con and nmcli con show ens192.
Quotes should be fine.
By the way, if these are private addresses, there is no need of hiding them.
After deleting second ifcfg file, now it is showing one active connection ( Please see the attachment) , but before it was showing 2 connections.
My problem has been resolved. Thanks for your all helps!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.