Strange IP address issue, Linux

binarysoulbinarysoul Member Posts: 993
Hello Linuxers,

I'm playing with CentOS and when I run 'ifconfig' I get 10.0.0.5 as IP. But when I look at /etc/sysconfig/network-scripts/ifcfg-eth0, it shows IP as 10.1.1.1. This is a VM in Virtualbox.

I had previously changed IP to 10.0.0.5, but it shouldn't be there. I've used ifconfig to change IP back, rebooted, but it doesn't change.

Any idea?

Comments

  • UnixGuyUnixGuy Mod Posts: 4,570 Mod
    is it CentOS 6.x ? The network might be controlled by "NetworkManager".

    in the file /etc/sysconfig/network/ifcfg-eth0
    NMCONTROLLED="yes" ?

    change it to "no"

    then do this:
    "server NetworkManager stop"
    "chkconfig NetworkManager off"

    or what I do is "yum remove NetworkManager" icon_lol.gif
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Learn GRC! GRC Mastery : https://grcmastery.com 

  • binarysoulbinarysoul Member Posts: 993
    Thanks for the tip. It worked, but after I rebooted, the problem is back! It's Centos 6.32.

    'ifconfig' shows 10.0.0.5 as IP

    /etc/sysconfig/network-scripts/ifcfg-eth0, shows IP as 10.1.1.1

    I get PING replies from 10.0.0.5.

    But when I ping 10.1.1.1, I get replies From ip 10.0.0.5 that 10.1.1.1 is unreachable!
  • darkerosxxdarkerosxx Banned Posts: 1,343
    Post your file.
  • UnixGuyUnixGuy Mod Posts: 4,570 Mod
    Sorry about the reboot. Instead of reboot, you needed to just reset the network service (service network restart).

    this is strange. Can you copy paste the contents of this file: "/etc/sysconfig/network-scripts/ifcfg-eth0" and the contents of this file "/etc/sysconfig/network"

    also, the outputs of "ifconfig" and "netstat -rn"


    try this command as well: "ifdown eth0", then "ifup eth0", it might post a message on why you're not acquiring the IP in the files
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Learn GRC! GRC Mastery : https://grcmastery.com 

  • ccnxjrccnxjr Member Posts: 304 ■■■□□□□□□□
    Can we see the full output of :
    ifconfig -a
    
    ip addr
    
    dmesg | grep eth
    
    

    Just a tiny peek :)
  • binarysoulbinarysoul Member Posts: 993
    Thanks everyone! I've attached the output of everything you asked for and put them in a screenshot. Please use this link:

    View image: output
  • ccnxjrccnxjr Member Posts: 304 ■■■□□□□□□□
    One more thing, can you give us the output of :
    cat /etc/udev/rules.d/70-persistent-net.rules
    

    I find it odd that there is a vlan assosciated with eth0 from the output of dmesg.


    here's mine for reference:
    [root@cacti ~]# dmesg|grep eth0
    e1000 0000:00:03.0: eth0: (PCI:33MHz:32-bit) 08:00:27:d6:33:0c
    e1000 0000:00:03.0: eth0: Intel(R) PRO/1000 Network Connection
    e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX
    [root@cacti ~]#
    

    Can you also run
    ls /proc/net/vlan/
    

    If there is a vlan of some sort configured let's start digging there.

    If a vlan is configured then vlan sub-interfaces *should* show up under the output of
    ifconfig -a
    
    But that *looks* ok, so I guess we'll have to put on our sleuthing hats for this after all !
  • binarysoulbinarysoul Member Posts: 993
    Here is the output. Actually, there is no VLAN, but it's a VM on a VirtualBox.

    View image: rules
  • UnixGuyUnixGuy Mod Posts: 4,570 Mod
    It looks alright, just change BOOTPROTO from "static" to "none". Static is no longer a valid option

    BOOTPROTO="none"

    Then do a "service network restart"

    Since it's a virtualbox, it's worth checking your VirtualBox network config, sometimes they result in funny errors
    Certs: GSTRT, GPEN, GCFA, CISM, CRISC, RHCE

    Learn GRC! GRC Mastery : https://grcmastery.com 

  • ally_ukally_uk Member Posts: 1,145 ■■■■□□□□□□
    might be worth also checking your virtual box network settings are set to bridged
    Microsoft's strategy to conquer the I.T industry

    " Embrace, evolve, extinguish "
  • binarysoulbinarysoul Member Posts: 993
    Bingo!

    I changed BOOTPROTO and played around with Virtualbox network settings. It's fixed!

    Thanks everyone. I could have rebuilt the box, but I often want to learn from such strange problems than quickly 'throwing the white towel at the ring'. :)
  • W StewartW Stewart Member Posts: 794 ■■■■□□□□□□
    Interesting. Didn't know static wasn't valid anymore. I haven't used a redhat based distro in awhile. Most supporting ubuntu these days.
Sign In or Register to comment.