How can I bring up a non-boot (ONBOOT=no) network interface with iproute2?

13,883

Solution 1

In RHEL 7+, you'll have to use nmcli command for permanent change. nmcli command uses /etc/sysconfig/network-scripts/ifcfg-con_name file first, also when you modify connection properties with nmcli it will write to ifcfg-con_name file. So, to automatically start connection, you need to use following:

nmcli con mod enp0s3 connection.autoconnect yes

It will change ONBOOT property to yes.

In order, to load newly changed configuration file, you need to use (otherwise it will load during next boot):

nmcli con down enp0s3
nmcli con up enp0s3

Good luck!

Solution 2

ifup enp0s3 should bring up the interface and configure it.

You might want to review the Network Interfaces chapter of the RHEL manual. §10.3. “Interface Control Scripts” mentions using ifup.

ifconfig enp0s3 up should not load any configuration from ifcfg-enp0s3, by the way. See e.g., What is the difference between 'ifconfig up eth0' and 'ifup eth0'? on the RedHat Knowledge Base.

Share:
13,883

Related videos on Youtube

Belmin Fernandez
Author by

Belmin Fernandez

Learning and helping.

Updated on September 18, 2022

Comments

  • Belmin Fernandez
    Belmin Fernandez over 1 year

    Have a network interface that does not come up on boot-up:

    [belminf@tito ~]$ grep ONBOOT /etc/sysconfig/network-scripts/ifcfg-enp0s3
    ONBOOT=no
    

    I know I could do the following for DHCP:

     [belminf@tito ~]$ ip link set enp0s3 up
     [belminf@tito ~]$ dhclient enp0s3
    

    Or, for static IP:

     [belminf@tito ~]$ ip link set enp0s3 up
     [belminf@tito ~]$ ip addr add 192.0.2.11/24 dev enp0s3
    

    However, is there a way to load the configuration from /etc/sysconfig/network-scripts/ifcfg-enp0s3 like ifup ensp0s3 would have done?