Network Configuration in minimal Linux installs

By default, the new Centos 6.0 distro performs a “minimal” install, as I mentioned last time. This is good because you end up with a very small footprint O/S (no Gnome, for example), leaving the server more resources to run the things you actually use servers for (like Oracle).

The downside to it, however, is that a feature of Red Hat Enterprise Server 6 (and therefore of all its clones -so this stuff applies to Scientific Linux 6, too) is that it defaults to managing your network connections with NetworkManager, which isn’t actually installed as part of a minimal install. The net result (no pun intended) is that your network doesn’t work when you first boot into your new, slimline O/S.

The fix is to run the command system-config-network-tui, which allows you to specify a fixed IP address manually. In Centos 6, however, even this tool is not installed as part of a minimal install (I guess they took the word ‘minimal’ literally), so you’ll end up having to edit by hand the /etc/sysconfig/network-scripts/ifcfg-eth0 file.

You’ll need to end up with something looking like this:

IPADDR=192.168.0.33
BOOTPROTO=none
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=192.168.0.1
DNS2=192.168.0.2
USERCTL=yes

Obviously, you replace those specific IP addresses with whatever suits your local environment. The USERCTL=yes line is optional: it lets non-root users control the interface. Once the file has the appropriate entries, a reboot will do to make the new settings take effect.

In Scientific Linux 6, the system-config-network-tui tool exists, so you could use that… or you can achieve all these edits with the nano text editor. The Centos 6 minimal install is less forgiving, however, and you’ll have to use vi (because nano is not installed as part of its minimal install option).

Print Friendly

29 thoughts on “Network Configuration in minimal Linux installs

  1. Marc D

    Thanks for these instructions. I found also that if you are connected to a network with DHCP, you may do:

    dhclient eth0 (or whatever the alias of your connected adapter is)
    yum install system-config-network-tui

    Reply
        1. dizwell Post author

          I don’t really understand the question, I’m afraid. In a minimal Centos 6 install, you have to manually edit the ifcfg-eth?? file as I describe in the main post before the network will function. If you’re asking something else, though, I’m sorry that I can’t work out what it is. By all means re-phrase the question, though.

          Reply
    1. Blair

      I was doing a manual minimal CentOS install using VMware Player, and these instructions with the dhclient eth0 helped big time.

      Thanks all.

      Reply
  2. Frans S

    Hello all, great page with ideas how to work around the minimal install. I stumbled on the same setup, no network setup (in a vmware host).

    One has to realise though that this _is_ a minimal install, so it can be considered by design that we don’t have the network running. I mean, if you install minimal, you ought to have some basic or advanced linux knowledge ;-)

    yum install’ing missing tools as suggested is a good option – it’s your choice.
    however the system will not be as minimal anymore, if you see how much extra is installed just to have a configuration tool installed.

    I found Marc’s suggestion ‘dhclient eth0 (or whatever the alias of your connected adapter is)’ a very good suggestion. As good as fixed configuring the settings. It depends what servers you best. Then install the packages you _really_ need, if it is your goal to keep the system to minimal.

    /etc/init.d/network restart should be sufficient when editing ifcfg-eth0 file.

    Thank you for this page, it confirmed that it was not just me running into this :-)

    Reply
  3. dizwell Post author

    Thank you Frans. Not quite sure what “yum installing missing tools as suggested” means, though, since I don’t suggest installing anything at all in the original blog piece (by design, as you say)!

    I mention editing ifcfg-eth0 by hand, or with system-config-network-tui, **if it’s installed already**, as it is on Scientific Linux, though not on Centos.

    I also specifically mention ‘having to use vi’ on Centos, because nano is not installed as part of a minimal install -and I **don’t** anywhere suggest installing nano as a workaround.

    So where all these ‘suggestion to install missing tools’ are, I have no idea!

    Reply
  4. Ed

    I just finished installing CentOS 6.2 Minimal and run yum update, yum install httpd, and yum install nmap for starters.

    I ran it with nmap -sT -O localhost and the only ports open were:

    22/tcp – SSH
    111/tcp – rpcbind

    I have made sure ifcfg-eth0 is configured properly #1
    I have set resolv.conf with both DNS servers and entered (at the top) search local #2
    I modified /etc/sysconfig/hosts with the following:

    192.168.1.108 areacomputer.local areacomputer #Added by NetworkManager
    127.0.0.1 localhost.localdomain localhost
    ::1 areacomputer.local areacomputer localhost6.localdomain6 localhost6

    I also configured an index.html page in /var/www/html so I can test httpd.

    when I go to one of my local boxes I can view the web page via the browser by entering the servers ip address only (I want to enter the hostname “areacomputer.local” to bring up the index.html page).

    What am I doing wrong (again, this is a Minimal build)?

    I have another server running CentOS 6 that has a KDE desktop (there were 928 package in this build installed) I have configured this server the same way and I can access the web page via the hostname “areacomputer.local”.

    Yes, I did disable iptables and ip6tables so this would work.

    Also, the minimal build there were only 209 packages installed.

    I would really like to figure out what package(s) I need to add to the minimal build so I can duplicate what I am doing on the full install (any help would be appreciated).

    Reply
    1. dizwell Post author

      Trying to summarise. You can get to the Apache test page if you visit http://192.168.1.108, but not when you visit http://areacomputer.local, right?

      I would say that’s a names resolution issue, not a package installation problem. I don’t think you’ll need to install any additional packages to get it working, in other words; you just have to make sure the networking stack is configured right and is resolving its names correctly, from the correct sources.

      You say you’ve got the resolv.conf configured correctly. Just check it has something like:

      search areacomputer.local
      nameserver 192.168.1.253 (or whatever your DNS server is)

      (That is, I would start by restricting yourself to just one nameserver. When that’s working, then you can switch to the second, and when that’s working, you can have both).

      Have you got Network Manager controlling this network connection? That can wreak havoc if so. Try setting NM_CONTROLLED=”no” in the /etc/sysconfig/network-scripts/ifcfg-eth0 file to disable the Network Manager shenanigans (i.e., you then take responsibility for configuring the entire network stack).

      The other thing I’d just check, though it shouldn’t make a difference: check the /etc/hosts on the KDE box that you say is working properly and see whether it has a local entry for the web server that’s allowing it to resolve the name. Hopefully it hasn’t, and it’s correctly using the DNS servers, but I’d check it to be sure. I would also specifically add in a local /etc/hosts entry for this minimal Centos box, just to see whether that ‘fixes’ the problem (though obviously, you want proper DNS server resolution working eventually). If it does, for example, then it’s a clear indication that your Centos box doesn’t correctly know how to find the DNS servers.

      Incidentally, you mention a file called /etc/sysconfig/hosts… I take it that’s a slip-up on your fingers’ part, because the right file to edit for these purposes is just /etc/hosts.

      Finally, use nslookup to check where your names are being resolved. Make sure you see your DNS server’s IP address in the response. You don’t say, I think, whether the DNS servers themselves can ping the web server via name rather than just by IP address… I presume they can, but check that’s so.

      Reply
  5. sampiale

    This particular problem was giving me nightmares until I realized that the network can be configured during installation when entering in the hostname. There is a button labelled Configure Network at the left button corner. It edits /etc/sysconfig/network-scripts/ifcfg-eth0 for you.

    Reply
  6. dizwell Post author

    Fair enough. The button’s pretty obvious and it’s definitely usable. The point of this blog piece, however, is to explain how to rectify a borked network stack after the event, because (IMO) you are much more likely to be presented with one of those that needs fixing than a nice console, installation disk and permission to build your own server from scratch!

    Bear in mind, too, this blog’s whole ethos is that manual installs involving button-clicking are not what you should be doing in any case. The ‘house rule’ here, if you like, is to perform kickstart automated installs… which allow you to preset the network in a completely different way. But you still might need to dip into editing ifcfg-eth0 to fix things up even so (especially if you forget to edit your kickstart script between server builds!)

    In other words, the point here was to say, “Learn the fix that’s always available”, because guaranteeing you’ll never need the fix in the first place is practically impossible.

    Put it even more simply: you don’t want to go through the entire O/S installation process again just so you can click a button you forgot to click the first time through. Editing one text file means you never have to…

    Reply
  7. Radu Alexandru

    Thank you! I was struggling with this a lot on my virtual machines and I always had to install the first version just for simple tests. Due to the help of Marc D, I could use DHCP and from there everything went smoothly.

    It seems that the minimal version is so minimal that even vi could be removed someday :) .

    Reply
  8. dizwell Post author

    Yeah, but you don’t want *servers* running DHCP, really, do you?

    Well, I wouldn’t, anyway!

    Reply
  9. MattH

    Great details on where the conf file is and what to change on it. Maybe could add the ONBOOT section into your article as well.

    Might be nice to see a couple of tips on using vi. I struggled at first as I haven’t used vi for about 15 years but it all come shuddering back eventually.

    MarcD, fantastic tip. Maybe this info should be at the TOP of your article for those who want a quick and dirty solution.

    Reply
  10. Jebbo

    A more full ifcfg-eth[n] file:

    DEVICE=eth0
    BOOTPROTO=none
    HWADDR=00:25:90:64:2B:FC
    IPADDR=172.16.12.240
    NETMASK=255.255.255.0
    NETWORK=172.16.12.0
    GATEWAY=172.16.12.1
    BROADCAST=172.16.12.255
    IPV6INIT=no
    IPV6_AUTOCONF=no
    ONBOOT=yes
    TYPE=Ethernet
    PEERDNS=yes
    USERCTL=no

    The HWADDR can be found by doing a ‘find / -name *eth0*’
    This should bring a bunch of listings but one will be: /sys/devices/pci0000:00/[something]/[something]/net:eth0
    cd into here and look at the address file for the mac address of the network card the system has called eth0

    Reply
    1. dizwell Post author

      Yup, I think you’ve rather missed the point… which was to provide as near the *minimum* as necessary in order to get connected on the network. Because what you think ought to be in there isn’t necessarily what others think ought to be in there… and isn’t *functionally necessary* for getting the network interface working properly. You fancy disabling IPv6? Go right ahead -I’m not a fan of it myself, either-… but there’s a *reason* I didn’t mention it (i.e., not everyone should/would want to disable it). I explained, too, why I said USERCTL=yes… you want to do the opposite, fine by me, but that doesn’t make your “more full” version any better or more ‘correct’. And I really don’t think people should go around setting PEERDNS (which allows the /etc/resolv.conf to be over-written) without really knowing what they’re doing.

      Look, if you really want to spell out more than you need to, read /usr/share/doc/initscripts-*/sysconfig.txt: it’s got *all* of the parameters properly documented.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>