how to get ip address of centos 7 vm?

2

2

I have a centos 7 virtual machine on my mac. I'm trying to get its ip but can't find it.

ifconfig result

and

ip addr result

and etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcg-enp0s3

Vanddel

Posted 2016-05-10T11:35:09.490

Reputation: 121

I can see you have set ONBOOT='Yes' but have you tried running nmtui and see what it shows ? – pun – 2016-05-11T08:37:18.650

Answers

0

It only worked when I assigned it to a static ip address. added this to /etc/sysconfig/network-scripts/ifcg-enp0s3

IPADDR = <add-ip-addr>
PREFIX = <add-prefix>
GATEWAY = <add-gateway>
DNS1 = 8.8.8.8

Vanddel

Posted 2016-05-10T11:35:09.490

Reputation: 121

1

That's because you are not getting any IP to your interface enp0s3. It might be a missconfiguration on the DHCP server, your network settings for that vm or on the vm network configuration.

Make sure that:

  • your vm is on bridge or NAT mode, with the adapter connected.
  • /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcg-enp0s3 have the right settings.

After OP being updated:

Remove UUID=...

sysfiend

Posted 2016-05-10T11:35:09.490

Reputation: 417

my vm on a bridge mode. and I added the settings to the question, do you thinks there's anything missing? – Vanddel – 2016-05-10T12:00:08.343

remove UUID=... – sysfiend – 2016-05-10T12:01:37.440

Alex already provided the answer to why you're not getting a valid eth connection. Just like to mention that after you reboot your machine you can check the IP adress with either ip addr or hostname -i. – Jdeboer – 2016-05-10T13:27:05.260