Find the answer to your Linux question:
Results 1 to 9 of 9
I am setting up a Centos server in Virtual BOx. I want to set it up static since it will be a server eventually. Ideally I want it to connect ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2013
    Posts
    9

    My Centos server will not get its static ip address:(


    I am setting up a Centos server in Virtual BOx. I want to set it up static since it will be a server eventually. Ideally I want it to connect to my FreeBSD virtual box, which will act as a router to access the outside network. Centos will not get its static ip address though even though I have set it in the /etc/sysconfig/network-scripts/ifcfg-eth0 and /etc/sysconfig/network though.

    Here are my configurations.

    /etc/sysconfig/network-scripts/ifcfg-eth0
    Code:
    DEVICE="ETH0"
    NV_CONTROLLED="NO"
    ONBOOT="YES"
    BOOTPROTO="static"
    IPADDR=192.168.1.106
    NETMASK=255.255.255.0
    GATEWAY=192.168.1.105
    aND /ETC/SYSCONFIG/NETWORK
    Code:
    NETWORKING=YES
    HOSTNAME=localhost.localdomain
    GATEWAY=192.168.1.105
    /etc/resolv.conf
    Code:
    name-server=8.8.8.8  #for now

    When I do an ifconfig eth0, it makes no mention of an ip4 address.

    Am I missing something? THanks

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,275
    Are you sure it's still eth0? Modern versions of udev use a different system for naming network cards based on their bus location, and yours may now be called something beginning with "en". Check in /sys/class/net for the actual name of the interface.
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

  3. #3
    Just Joined!
    Join Date
    Aug 2013
    Posts
    9
    Quote Originally Posted by hazel View Post
    Are you sure it's still eth0? Modern versions of udev use a different system for naming network cards based on their bus location, and yours may now be called something beginning with "en". Check in /sys/class/net for the actual name of the interface.
    Nope. I looked and its eth0 and lo, the loopback adapter.

  4. $spacer_open
    $spacer_close
  5. #4
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,930
    Are you using Network Manager? It's more flexible than the network settings you're editing here.

    What do you get if you run this as root:

    Code:
    service NetworkManager status
    If it says that the service is active, then you can use the settings you've set above by disabling it with

    Code:
    service NetworkManager stop
    chkconfig NetworkManager off
    If you do this, you might need to turn on the static networking services (which might not even be available in the latest CentOS7 - I know they're deprecated, and they'll be going soon - but I don't have a CentOS7 server to check against):

    Code:
    service network start
    chkconfig network on
    I find it easier to use Network Manager, and you might choose to use that yourself in preference. The easiest way is to log into your desktop and edit the network settings through the NetworkManager widget.
    Linux user #126863 - see http://linuxcounter.net/

  6. #5
    Just Joined!
    Join Date
    Aug 2013
    Posts
    9
    I'm not using Network Manager. Is this what most administrators use on the job or did my professor teach me the most absolute difficult way to do things? lol
    I'll look into installing NM and see what happens!

  7. #6
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,930
    Quote Originally Posted by dragonix View Post
    I'm not using Network Manager. Is this what most administrators use on the job or did my professor teach me the most absolute difficult way to do things? lol
    I'll look into installing NM and see what happens!
    My thought was that it was already installed and perhaps you weren't aware that it was. CentOS uses it to control it's network and should be installed by default, and it could be responsible for overwriting your network settings.
    Linux user #126863 - see http://linuxcounter.net/

  8. #7
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    917
    Quote Originally Posted by dragonix View Post
    I'm not using Network Manager. Is this what most administrators use on the job or did my professor teach me the most absolute difficult way to do things? lol
    I'll look into installing NM and see what happens!
    No one uses Network Manager on production servers.

    You have a typo in your ifcfg-eth0 script
    NV_CONTROLLED="NO"

    Should be NM_CONTROLLED

    That line is also optional, I believe. It can also be NM_CONTROLLED=YES and still work fine.
    Try adding the MAC to the file if it still doesn't work for some reason:
    HWADDR=00:...

  9. #8
    Just Joined!
    Join Date
    Aug 2013
    Posts
    9
    With 6.2, Centos has decomissioned Network Manager or at least it's not installed by default. I would post a link to what I found, but this site does not let me post links til I post 15 or more posts lol

  10. #9
    Just Joined!
    Join Date
    Aug 2013
    Posts
    9
    Ok even if I add the hwaddr, it does not work still. I tried it with the hwaddress of the physical nic and also the one that Virtual Box gave to it.
    Now here's something funny I did not see til today. Under the eth0, there are suddenly 2 ipv6 addresses, one is scope local and the other is scope global.

    Now this just gets weirder. I just rebooted the virtual machine after putting the hw address of the nic to the laptop.
    Did ifconfig and only the loopback adapter is showing. Nothing from eth0 is outputted.
    So when I force it by doing ifconfig eth0, it has no ip addresses. It does not give me the hw address of my physical nic as I inputted, but it gives me the hw address of the virtual box. And it also has the output of broadcast, mtu, packets, collissions. I think the hwaddress just caused it to spit out information about the hw address.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •