How to bring up static IP at startup with NO CARRIER

Issues related to configuring your network
Post Reply
nouser
Posts: 1
Joined: 2020/03/09 08:43:09

How to bring up static IP at startup with NO CARRIER

Post by nouser » 2020/03/09 09:29:02

OS:CentOS 8.1
My service that depends on the host's primary IP address, and that service fails to start if that address is not configured on the host.
But I need to use a static IP all the time, regardless of whether the network cable is plugged in。When using NetworkManager to manage the network,Is there any way to make NIC bring up static IP at startup with NO CARRIER。
LIKE THIS:

Code: Select all

5: enp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:80:64:03:01:03 brd ff:ff:ff:ff:ff:ff
6: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:80:64:03:01:04 brd ff:ff:ff:ff:ff:ff
    inet 20.20.20.20/24 scope global enp4s0
============================================
Although I can modify rc.local ,add ip addr add x.x.x.x dev xx to Bring IP UP ...

Code: Select all

6: enp4s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:80:64:03:01:04 brd ff:ff:ff:ff:ff:ff
    inet 20.20.20.20/24 scope global enp4s0
       valid_lft forever preferred_lft foreve
:?: :?: :?: :?: This is too ugly/丑陋Low。

User avatar
jlehtone
Posts: 2589
Joined: 2007/12/11 08:17:33
Location: Finland

Re: How to bring up static IP at startup with NO CARRIER

Post by jlehtone » 2020/03/09 12:32:57

Code: Select all

# dnf info NetworkManager-config-server
From repo    : BaseOS
Summary      : NetworkManager config file for "server-like" defaults
Description  : This adds a NetworkManager configuration file to make it behave more
             : like the old "network" service. In particular, it stops NetworkManager
             : from automatically running DHCP on unconfigured ethernet devices, and
             : allows connections with static IP addresses to be brought up even on
             : ethernet devices with no carrier.

aks
Posts: 2958
Joined: 2014/09/20 11:22:14

Re: How to bring up static IP at startup with NO CARRIER

Post by aks » 2020/03/09 17:06:58

No carrier means no physical/data-link layer.
Broken cable(s)/broken port(s)/plug it in/could not agree speed and duplex settings.

afewgoodman
Posts: 58
Joined: 2019/12/11 03:51:58

Re: How to bring up static IP at startup with NO CARRIER

Post by afewgoodman » 2020/03/10 08:23:45

Hi,
I guess If set static ip in /etc/sysconfig/network-scripts/ifcfg-$interface_name, it would be automatically brought up when it connect ?

BR.

Post Reply

Return to “CentOS 8 - Networking Support”