7

I was given a rhel7 vmware template to use for provisioning rhel 7 test environments. When I created my vm, it booted up fine except that my network interface doesn't seem to come up. If I type ifconfig -a I get the following:

ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:50:56:XX:XX:XX  txqueuelen 1000  (Ethernet)
        RX packets 55  bytes 3300 (3.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 792  bytes 62296 (60.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 792  bytes 62296 (60.8 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

As you can see, I don't have an ip address for ens192. Being a programmer and not a sysadmin, I did some flailing around on Google and was told that I should edit a 70-persistent-net.rules file. I don't have this file. So I flailed around some more and learned that I should run the command /lib/udev/write_net_rules. I don't seem to have this either. I then read about a couple of udevadmn commands I can run. They don't seem to do anything. I tried activating the connection using nmtui, it crashes when I do.

I've also tried the "/etc/init.d/network restart" command. It fails and suggests that I try a couple of commands to see why. So when I typed in the suggested command "systemctl status network.service", I get the following output:

Jan 23 08:30:39 myhostname network[10858]: RTNETLINK answers: File exists
Jan 23 08:30:39 myhostname network[10858]: RTNETLINK answers: File exists
Jan 23 08:30:39 myhostname systemd[1]: network.service: control process exited, code=exited status = 1
Jan 23 08:30:39 myhostname systemd[1]: Failed to start LSB: Bring up/down networking
Jan 23 08:30:39 myhostname systemd[1]: Unit network.service entered failed state.

Is there anything I'm not trying that would help me get this interface to get an ipaddress?

Thanks!

Jason Thompson
  • 413
  • 2
  • 6
  • 16
  • 1
    I suggest trying [the documentation](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Configure_IP_Networking.html). – Michael Hampton Jan 22 '15 at 22:14
  • So in the documentation it suggests running nmtui. I ran this and then "clicked" Edit connection. I see my interface, "ens192", so I "clicked" that. It shows a profile name of ens192 and a device of 192 followed by my hw address. The ipv4 and 6 config are set to automatic. The checkboxes for automattically connect and available to all users are checked. I save it. I then go back into nmtui and "click" Activate a connection. It crashes. What else can I try? Sysadmin isn't my expertise, so I apologize if this question is beneath the usual serverfault user. – Jason Thompson Jan 22 '15 at 22:31
  • It "crashes"? How does that go? What output? Give us something to go on. – Michael Hampton Jan 22 '15 at 22:58
  • It looks similar to the scenario described here: https://bugzilla.redhat.com/show_bug.cgi?id=1119663 The only difference is that I have not deleted all of my connections as the bug suggests is the cause. Going to "Edit Connection" shows ens192. – Jason Thompson Jan 23 '15 at 14:27
  • I've updated my question to include more information based on me trying to get the system to tell me why this isn't working. This doesn't feel like it should be hard at all, but I'm not getting anything meaningful out of the system to tell me what's wrong. – Jason Thompson Jan 23 '15 at 14:38

4 Answers4

7

I figured it out and I can see why I got the "read the manual" type comment. The issue was rather simple and I'm sure any sysadmin would have figured it out right away. But for us programmer types who have to do sysadmin stuff out of necessity here's what was going on.

Short answer: My MAC address was incorrect in my /etc/sysconfig/network-scripts/ifcfg-ens192 configuration.

Long explanation: VMware generates a new mac address for each new virtual nic when you provision a new VM from a template. Seems reasonable. But when you look at the hardware address configured in the VMWare setting it only shows you the first four octet in a disabled text box that will not allow you to see the rest. My mac address in the configuration seemed to have the same first four octets so I assumed incorrectly that the mac address in the config was correct. After shutting down the VM, I could scroll to the right and see the rest of the mac address. Upon noticing it was different, I changed it in my config and everything worked.

If Redhat devs read this site, please put some meaningful error messages when things like this go wrong. Thanks!

Jason Thompson
  • 413
  • 2
  • 6
  • 16
2

If RHEL 7.2 is running as VMWare VM and relying on DHCP allocation ensure that your /etc/sysconfig/network-scripts/ifcfg-ens192 file has ONBOOT=yes. For some reason in my instance it was set to ONBOOT=no during installation.

The HWADDR line is not needed.

After modification you can restart your network using /etc/init.d/network restart or better still systemctl restart network and the instance will be allocated an IP address.

shonky linux user
  • 1,163
  • 10
  • 15
0

Ensure ifcfg-<name> is unix format. I have seen RTNETLINK answers: File exists errors caused by windows line endings. Fix with dos2unix /etc/sysconfig/network-scripts/ifcfg-*

thetoolman
  • 121
  • 2
0

You want to add a line like:

HWADDR=0A:0B:0C:0D:0E:0F

in /etc/sysconfig/network-scripts/ifcfg-ensXX (XX could be some number)

using vi - say.

then run /etc/init.d/network restart

and type ip route

and you should have an ip address and default gateway.

To get the address you should add, you want to go to virtual machine settings -> hardware -> network adapter -> advanced

Write down the MAC Address in there and put that in as the address for HWADDR= above.

tmx
  • 101