CentOS virtualbox no icfg-eth1 when adding secondary network interface

22,989

Should icfg-eth1 have been generated when I added the host-only local connection in virtualbox?

No. Since you performed a minimal installation NetworkManager is not installed and so there's nothing on the system to detect new network interfaces and configure them for you. ifcfg-eth0 was created for you since the interface existed during installation.

If I have to create the icfg-eth* file myself, which tool should I use to generate it? Which package should I install to get it?

You could just create it by hand:

  1. Make a copy of the ifcfg-eth0 file and name it ifcfg-eth1
  2. Open ifcfg-eth1 in a text editor (e.g. vi)
  3. Update the DEVICE entry.
  4. Update (or remove) the HWADDR entry
  5. Remove the UUID entry (if it is there)
  6. Make any other changes you need.

Alternatively you could install and use the System-Config-Network tool:

yum install system-config-network-tui
system-config-network-tui

Should I ever manually edit the contents of /etc/sysconfig/network-scripts?

It is okay to do this, just make sure you're careful while doing so. Make copies of any files you are editing just in case you need to revert your changes. Also, ensure you have another way to access the system in case you completely break network access to it (e.g. console access).

It's a good idea to familiarise yourself with the structure and contents of that directory.

Share:
22,989

Related videos on Youtube

kyjelly90210
Author by

kyjelly90210

Updated on September 18, 2022

Comments

  • kyjelly90210
    kyjelly90210 almost 2 years

    I have a CentOS 6.7 minimal distribution which I created in virtual box. As an afterthought, I added a secondary network interface in virtualbox, so I have an NAT interface, and a host-only local network. When I log into my virtual machine and run:

    ip link show 
    

    Shows eth0 as UP and eth1 as DOWN. When I try:

    ifup eth1
    

    I get configuration for eth1 not found. When I look in /etc/sysconfig/network-scripts, I see an icfg-eth0 file, but no icfg-eth1 file.

    I have a few questions:

    1. Should icfg-eth1 have been generated when I added the host-only local connection in virtualbox?
    2. If I have to create the icfg-eth* file myself, which tool should I use to generate it? Which package should I install to get it?
    3. Should I ever manually edit the contents of /etc/sysconfig/network-scripts?
  • kyjelly90210
    kyjelly90210 almost 9 years
    great answer - thanks. I ended up creating the file as above and got the interface up.