What On CentOS Is Wiping Out My Eth0 IP Address Every 5 Minutes?

Home » CentOS » What On CentOS Is Wiping Out My Eth0 IP Address Every 5 Minutes?
CentOS 36 Comments

Why does my CentOS 6.4 laptop keep wiping out my eth0 IP Address?

a) I set the IP address of eth0
b) Everything works fine for 2 to 5 minutes c) Then, that eth0 IP address is (somehow?) wiped out I frustratingly repeat that abc process (over and over and over again)

My home network has been working perfectly and there is no problem with my home network, nor my wlan0 WiFi access from my CentOS
laptop to that home broadband network.

Inside the house, I never use the wired (eth0) NIC; but, I’m trying to set up a wired/wireless connection outside the house and that is where I’m running into this problem where CentOS (automatically?)
constantly and repeatedly wipes out the IP address I set on eth0.

I can easily (constantly) change the IP address of the eth0 NIC back to what I want it to be; but that IP address only stays set for about 2 to 5 minutes; and then it wipes itself out (again & again).

Why? How do I stop this?
(All I want is for eth0 to *stay* at the IP address I set it to!)

To give you more contextual detail, here’s a typical sequence.

Wireless NIC (wlan0) is turned off using a hardware switch on the outside of the laptop (so that only one NIC is in play).

STARTING POINT: (eth0 has no IP address)
$ ifconfig eth0
=> eth0 Link encap:Ethernet HWaddr A0:BE:C1:D8:E5:F1
=> inet6 addr: fe80::f2de:f1ff:fe38:8591/64 Scope:Link
=> RX packets:3139 errors:0 dropped:0 overruns:0 frame:0
=> TX packets:3230 errors:0 dropped:0 overruns:0 carrier:0
=> collisions:0 txqueuelen:1000
=> RX bytes:2403080 (2.2 MiB) TX bytes:547895 (535.0 KiB)
=> Interrupt:20 Memory:f2600000-f2620000

$ sudo ifconfig eth0
$ ifconfig eth0
=> eth0 Link encap:Ethernet HWaddr A0:BE:C1:D8:E5:F1
=> inet addr: Bcast: Mask:
=> inet6 addr: fe80::f2de:f1ff:fe38:8591/64 Scope:Link
=> etc.

At this point, I can now connect a wire from the RJ45 port of the laptop, to the device (which happens to be a radio set to

$ ping
=> PING ( 56(84) bytes of data.
=> 64 bytes from icmp_seq=1 ttld time=1.38 ms
=> 64 bytes from icmp_seq=2 ttld time=0.339 ms
=> 64 bytes from icmp_seq=3 ttld time=0.255 ms
=> — ping statistics –

36 thoughts on - What On CentOS Is Wiping Out My Eth0 IP Address Every 5 Minutes?

  • the interface is probably configured for DHCP via
    /etc/sysconfig/network-scripts/ifcfg-eth0 and your system is undoubtedly running network-manager.

  • I don’t know *how* to tell if I’m running network-manager, but, I’m running whatever everyone else runs on CentOS since the home broadband network has been working for a year or more with this laptop without problems.

    When I set the laptop back to normal (on the home wireless network), here is what shows up when I right click on the network icon:

    Interestingly, that ifcfg-eth0 file doesn’t exist in:
    $ ls /etc/sysconfig/network-scripts/ifcfg-eth0
    => ifcfg-Auto_eth0 ifdown-post ifup-ippp ifup-tunnel
    => ifcfg-lo ifdown-ppp ifup-ipv6 ifup-wireless
    => ifcfg-wlan0 ifdown-routes ifup-isdn init.ipv6-global
    => ifdown ifdown-sit ifup-plip net.hotplug
    => ifdown-bnep ifdown-tunnel ifup-plusb network-functions
    => ifdown-eth ifup ifup-post network-functions-ipv6
    => ifdown-ippp ifup-aliases ifup-ppp
    => ifdown-ipv6 ifup-bnep ifup-routes
    => ifdown-isdn ifup-eth ifup-sit

    But, that file does apparently exist elsewhere:
    $ sudo updatedb; locate ifcfg-eth0
    => /etc/sysconfig/networking/devices/ifcfg-eth0
    => /etc/sysconfig/networking/profiles/default/ifcfg-eth0

    $ cat /etc/sysconfig/networking/devices/ifcfg-eth0
    => DEVICE=”eth0″
    => NM_CONTROLLED=”yes”
    => ONBOOT=yes
    => TYPE=Ethernet
    => BOOTPROTO=none
    => DEFROUTE=yes
    => IPV6INIT=no
    => NAME=”System eth0″
    => UUID_b06ba0-0bb0-7ffb-45a1-d6edd65f3e03
    => HWADDR

  • $ sudo updatedb; locate ifcfg-eth0
    => /etc/sysconfig/networking/devices/ifcfg-eth0
    => /etc/sysconfig/networking/profiles/default/ifcfg-eth0

    $ grep NM /etc/sysconfig/networking/devices/ifcfg-eth0
    => NM_CONTROLLED=”yes”

    If I set this to “no” and reboot, will it have any negative implication for my normal wireless network (which I use all day)?

  • there ya go! (NM == NetworkManager)

    as root,

    service NetworkManager status

    will undoubtedly say its running (and its not something you want to stop as its required for wifi and such).

    so, set the above line to =”no” and you can manually configure that port.

    or, use the Network Manager GUI to configure it.

  • Hi John, It doesn’t even have to be queried as root; it *does* say it’s running:
    $ service NetworkManager status
    => NetworkManager (pid 2455) is running…

    Am I correct in “assuming” the file to change is this one?

    And not this one?

    I didn’t want to complicate things, but whenever I use the GUI from right clicking on the four bars, the same thing happens (eth0 disconnects after a few minutes):

  • That reference doesn’t say much about what to set the gateway to:

    Reading section “Configuring IPv4 Settings”:

    All it says about the “Gateway” is:
    Gateway — The IP address of the gateway leading to the network, sub-net or host. In my situation, I’m connecting a CAT5 cable from the RJ45 eth0 port of the laptop to a radio, which is a router, which is, by default, set up to *not* hand out DHCP addresses (Ubiquiti Nanobridge M2) and which is set up, by default, on IP

    Given that information, do you have any idea what I should set the gateway to in the suggested forms? (they won’t let me leave the gateway blank)

  • odd, the RHEL6 docs say that file should be in
    /etc/sysconfig/network-scripts and that the files in
    /etc/sysconfig/networking/devices shouldn’t be messed with

    https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-NetworkManager.html https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Configuring_Connection_Settings.html https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Network_Interfaces.html https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-interfaces.html etc etc (these are all links off that first page, or each other)

    on that 3rd link, note the last thing on the page about
    /etc/sysconfig/networking/… being deprecated.

    hmm, when you configured it with the GUI, did you set that eth0
    connection to ‘Manual’ ?

    btw re your other question about gateway, there should be ONE global default route to the internet regardless of the interface.

  • Maybe I was editing it wrongly.

    How does this look?

    The question is what to make the “gateway” since the GUI insists on having a gateway.

    In my case, I’m plugging in a Ubiquiti Nanobridge M2 radio/router, which is configured, by default, on

    So, I set the eth0 of the laptop to anything on that same subnet, e.g.,; but I don’t know what to set the Network Manager “gateway”

    Q: Should I set the NM gateway to the IP address of the radio/router?

    Note: The desired connection is:

    a) Laptop sitting 300 feet from the house b) It’s ok if the wireless wlan0 NIC is manually turned off c) The wired eth0 NIC is set to the subnet of the radio (e.g.,
    d) I don’t know *what* to set the eth0 gateway to (

    Then, a CAT5 cable is connected from the laptop RJ45 eth0 port to the one and only RJ45 port on the Ubiquiti Nanobridge M2 radio.

    At that point, I would ping the radio (at over that eth0 wire, and then connect over that same eth0 wire with Firefox to
    (the default login = ubnt, and the default password = ubnt).

    Once logged into the radio GUI, I can set it up to connect to my home broadband router access point (or to a local Starbucks five miles down the road, for that matter).

    Given that the Network Manager is insisting on me giving it a “gateway”, what would you suggest I set the “gateway” to in the Network Manager?

    Note: I realize this may no longer be a CentOS question…

  • The gateway would be the address of the device on your network that knows how to route packets outward. In my case, where we have some wired systems and some wireless, both managed by a home router at, the gateway for all systems is, since that system knows how to send packets outward, as necessary.

    your network sounds as if it may be slightly more complicated, so I’m not sure I can advise you, as my mental picture of your network is a bit fuzzy.

  • Yes. should be fine if you’re only using these settings to get the nanobridge configured.

    But why not just see what IP, Gateway and DNS Servers your home router gives eth0 via DHCP and duplicate those settings statically? (presuming it’s also the 192.168.1.x /24 network)… most home routers can be configured to reserve the same IP address for a particular MAC address
    (makes port forwarding via a DDNS account a lot easier), so those static settings wouldn’t mess up your network if you didn’t set eth0 back to DHCP.

  • I only partially understand what I *think* you’re trying to tell me as I
    am clearly not a network guru.

    I *think* you’re saying I should first plug the laptop, by cat5 cable from eth0 of the laptop to the home broadband router, and then write down whatever IP address I get, the gateway, and the DNS Server thru it’s DHCP assignments.
    [Note: I already have a WinXP PC attached to that home broadband router, so, maybe I can get that information from it?]

    Then, I think you’re saying I should take the CentOS laptop, instead of using the puny wireless NIC inside it, I should use the eth0 NIC connected to the
    23 dBm radio and its 18 dBi antenna, so that the laptop essentially has 41
    decibels of WiFi beamed at the house open guest access point, 300 feet away.

    Is that right?

  • Yes. You might also be able to set the home broadband router to give the laptop’s eth0 the same IP address every time it sees eth0’s MAC address ask for an IP. What brand/model is the home broadband router, by the way?

    Well, you could… but all you’ll get from that is the gateway and DNS
    settings. Note that setting the Gateway to match isn’t necessarily going to make it use that gateway if there’s no path to it (the nano would have to be connected to the home router to pass that traffic along)… you were asking what to put in that field so you could save the settings, and using an actual gateway IP is better than just picking a random IP in the network, in my opinion.

    Well, that would result in an EIRP of almost 13W, or about 30 times the legal limit for licensed HAMs on channel 6 and below in the 2.4GHz band, or 60 times the legal limit unlicensed, unless you use a highly directional antenna. But that also assumes you’re in FCC land (I don’t know for a fact there aren’t Starbucks worldwide :).

    Not necessarily… from I inferred you wanted to make the laptop talk to the ubiquiti nano through the RJ45 port in order to configure it. If I misunderstood the intent, I apologize.

    Otherwise, you didn’t really tell us any plans for it besides connecting to the Wayport Access network at Starbucks 5 miles away… which likely won’t work without lengthening the Ack wait times – *at both ends* – for what that info’s worth; most units will wait only long enough for the signal to travel between 400 and 1000 yards before giving up and resending the packets… (assuming they’re even able to exchange enough packets to actually negotiate and establish a connection). That’s one reason why “more power” is rarely the solution to wireless problems.

  • Netgear N600. I bought it in a moment of weakness; but it’s far too anemic to make it outside by the BBQ where I want to set up the computer.

    So, my goal is to connect the Nanobridge M2 to my laptop when I’m at the BBQ, and to beam that Nanobridge M2 at the house, to pick up the Netgear N600 open “guest” SSID access point.

    Does that sound workable?

  • I’m in the USA.

    The Ubiquiti Nanobridge M2 is a legally bought and sold radio in the US. I can’t imagine that using it would be illegal from a power standpoint.

    Maybe I got the numbers wrong?

    Shouldn’t that Nanobridge m2 be powerful enough to reach the 300 feet or so to go from my BBQ to my home broadband router open “guest”
    access point?

  • Well, that is a necessary evil, so, yes, that is the first step, to configure it.

    But, I’ll take up that configuration elsewhere, as that’s not a CentOS issue per se.

    Right now, I only want to know what to set the gateway to, as that is somewhat of a CentOS issue (regarding how it’s set anyway).

    When my CentOS laptop ( is connected wirelessly to my home network (192.168.1.x), on wlan0, the following is seen on CentOS:
    $ ifconfig wlan0
    => wlan0 Link encap:Ethernet HWaddr 0A:2B:DC:7D:8E:AF
    => inet addr: Bcast: Mask:
    => etc.

    The gateway is apparently set to the home broadband router IP
    address (
    $ route -n
    => Kernel IP routing table
    => Destination Gateway Genmask Flags Metric Ref Use Iface
    => U 2 0 0 wlan0
    => UG 0 0 0 wlan0
    Where the gateway is and it’s up (U) and it’s a gateway (G).

    This command confirms the current gateway, when acting through wlan0, is (which is the Netgear N600 broadband router):
    $ route (or netstat -r):
    => Kernel IP routing table
    => Destination Gateway Genmask Flags Metric Ref Use Iface
    => * U 2 0 0 wlan0
    => default UG 0 0 0 wlan0

    I think this shows similar information:
    $ ip route show
    => dev wlan0 proto kernel scope link src metric 2
    => default via dev wlan0 proto static

    And, I must have edited the gateway in the past, because of this comment:
    $ cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=rock

    Given that the CentOS Network Manager requires a gateway in its GUI, I’m wondering if I should use a gateway of the Nanobridge M2 (
    or a gateway of my N600 broadband router (

    PS: I really do not understand what a gateway is. :(

  • that thing has a pretty narrow beam, it will need to be aimed carefully and mounted on a stable bracket that will take wind load without moving.

    you should be able to get 300 feet of mostly open space with a simple panel antenna, something like this, http://www.microcom.us/ezgo0214pnl.html

    you can put a range of radio/router boards inside that enclosure/antenna, like… http://www.microcom.us/wireless-lan–access-point—client-bridge–oem-module.html

  • really? my N600 has great range. mine is a wndr3700v3, I’m using it as a bridge/access point rather than as a router. put it up high, on edge, with the big flat shiny side facing the space you want to cover best, and nothing around it. top of a bookcase is what I’m using.

  • A default gateway is the IP address of the device that routes traffic out of the current subnet that the computer is on. On a home network, it is usually the router that connects to the Internet.

    In any network subnet, a default gateway is required to talk to any other subnet … this is not a CentOS thing, it is a TCP/IP thing.

    If you can ping from your current location once you assign an IP address of 192.168.1.x to the computer, then you would use as the gateway. You can look at any other device that is on the current network that talks to the outside world and see what it’s default gateway is and use that on a manual setup.

    You will also need to assign a valid DNS server (or servers) to the device as well. If you do any local name lookups and if there is a local DNS server, then you have to use that. If you do not need to look up local names, you can use and as DNS servers (those are DNS servers provided by Google and usually fast from everywhere).

    This guide explains routing and subnets:


  • Mine is the WNDR3400.

    It’s in the center of the house and barely makes it to the front steps.

    In contrast, the Nanobridge M2 can go for five miles, at least according to what I’ve read.

    To garner a handle on this confusing “gateway” thing, I’ve run a few commands on CentOS while connected to that home broadband router on the wlan0 card of the laptop:

    This shows DHCP handed the laptop IP address
    $ ifconfig wlan0
    => wlan0 Link encap:Ethernet HWaddr 0A:2B:DC:7D:8E:AF
    => inet addr: Bcast: Mask:
    => etc.

    This shows the gateway is apparently set to the home broadband router IP address (which is
    $ route -n
    => Kernel IP routing table
    => Destination Gateway Genmask Flags Metric Ref Use Iface
    => U 2 0 0 wlan0
    => UG 0 0 0 wlan0
    Where the gateway is and it’s up (U)
    and it’s a gateway (G).

    This shows the same information:
    $ route (or netstat -r):
    => Kernel IP routing table
    => Destination Gateway Genmask Flags Metric Ref Use Iface
    => * U 2 0 0 wlan0
    => default UG 0 0 0 wlan0

    I’m not sure if this provides any additional value:
    $ ip route show
    => dev wlan0 proto kernel scope link src metric 2
    => default via dev wlan0 proto static

    This shows I once messed with the gateway long ago
    (currently commented out):
    $ cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=rock

    Do I have any other Linux commands which will give me needed information before I start connecting to the Nanobridge M2?

  • Understood. The Nanobridge M2 may be far more than I need. But, it should work as it’s advertised to go five miles. All I need is a few hundred feet.

    I’ll try to keep on topic though.

    I think my “original” problem was what you guys sensed from the start.

    It was supremely frustrating having my manually typed eth0
    IP address being wiped out – but – apparently that was what Network Manager was supposed to do.

    Apparently Network Manager was set to pick up a DHCP address for eth0, and, when none were forthcoming, it wiped out the existing IP address.

    I only need to figure out now how to switch gracefully between using wlan0 connected to the home broadband router inside the house, and using eth0 wired to the Nanobridge M2 outside the house.

    I tried setting eth0 as suggested and left wlan0 alone, but, that killed the inside-the-house connection immediately.

    I’m still debugging why that happened (I had figured they’re two totally separate cards); but maybe you can’t have to NICs connected to the same net at the same time?

    Is there an easy way to tell which NIC is being used for a connection? Or to tell one NIC to win over the other?

  • Rock wrote:

    Several thoughts:
    on the router, see if it will accept a fixed IP, rather than one assigned by DHCP; if so, you can set it on the laptop. I’d also check to see if you need to deal with NetworkManager to do that. I don’t know – I
    *loathe* NM, and am majorly annoyed that upstream decided to put a tool appropriate for a laptop as the default for *everything*… says the guy dealing with 150 or more servers and workstations that are hardwired.


  • I saved your wonderful explanation (so that I may re-read it whenever I need to make a gateway decision), and I agree, it’s not CentOS, other than the commands to set and determine it.


  • I assume you have a connection with your Nanobridge M2 and that is mostly working right now. If that is true, then you have setup the AirOS software.

    Reading the AirOS manual, there is a mode that you can use that will pass DHCP requests to and from the device back to your network, and settings that will not pass that info.

    Here is the AirOS manual:


    And if that is the software on your device, go to the “Network” tab and see what you have set for the “Network Mode” … that should be “Bridge”.

    Then look at the “Configuration Mode” … that should be “Simple”.

    The Management Network settings should be fine as is … (that is the IP
    address that you use to connect to the AirOS via your web browser).

    A Bridge/Simple setup should just connect you directly to the rest of you network, and the dhcp settings on the rest of the network should work on both sides of the bridge.

    You should then be able to setup eth0 to use DHCP and that should make it “just work” on both sides.

  • You need to get used to it; it’s not going away. I would hazard a guess that the ability to turn off NM will go away at some point, and NM will be there all the time even for clustered hosts.

    The only times where disabling NM are strictly necessary are for clustering and bridging; most everything else, including static, hardwired connections, can easily be done with NM; I’ve done more than a few, and NM just worked out of the box. One just needs to pay attention to the details and set it up properly.

    One of the features planned for Fedora 20 is finally fully CLI support for creating NM connections. But, you know where _that_ could go. The good news, I guess, is that RHEL7 should be based on F19 or so
    (according to some commit messages and recent traffic on the rhel lists), but might get the nmcli enhancements.

    Sorry, just facts.

  • note thats 5 miles in open space.

    you said the router is in the middle of the house, what all is between it and your ‘BBQ’ ? our kitchen casts a ‘shadow’ in my reception pattern, due to the refrigerator, ovens, cupboards full of canned foods, etc. the closet near the front door with the furnace casts another smaller shadow.

  • Hey there,

    You need to remeber the command “pkill”
    this will release CentOS or Fedora from any dhclient. if you do have networkmanager installed on the system just stop or kill it.

    it’s pretty simple and easy to understand. By the way the nanobridge is nice but since it has so much Dbm in it you should try to open the case and verify what bugs are inside to make sure it’s not “just works” like sisco.


  • Or in order to migrate just do a bond device on the machine and add both wlan and eth to the same bond and let the kernel check the HA of the network connection over the cable and the WIFI.. This way you can avoid deciding yourself what interface to use for a working traffic. Once you team the NIC and WIFI you will see it all from another angle and understand what happens on each interface with tcpdump.


  • The Negear N600 router is in the middle of the house, and it’s only about
    18 dBi and, I think, about 5 dBm for about 23 dB in toto.
    (I haven’t looked up the spec in a while though.)

    The NanoBridge M2 is pointed *at* the house, and has to go through two walls to get to the router, but, it has an 18 dBi antenna coupled to a 23 dBm transmitter with a sensitivity in the -90 dBm range.

    Assuming the numbers are close to correct (I do realize the manufacturers lie about this stuff), that’s 23 dB versus 41 dB, which is a whoppingly huge difference of 18 dB.

    Since every 3 dB is a doubling of the signal strength, that’s
    2 x 2 x 2 x 2 x 2 x 2 = 64 times the signal strength of the Netgear home broadband router (which is admittedly rather anemic).

    That’s a lot of signal, so, I’m *not* at all worried about going a few hundred feet, and through a couple of walls.