Disable the Network Interface on Boot in CentOS 8 - Step by step guide ?

The network interface which includes streaming files, browsing the web, and watching videos is very important in any Linux Distribution.

The network interface is a software interface to the network hardware.

ifconfig command is used to either display or config a network interface.

The IP address is, in simple words, called the digital address of any internet-connected device on the planet, and it is unique for every device with a string of numbers ranging between 0 to 255.

Gateway or LAN is required to connect the network to the system to communicate.

Here at LinuxAPT, we shall look into how to disable a network interface on boot in CentOS 8.


Steps to disable a Network Interface on Boot in CentOS 8

1. Interface Creation

To create an interface, run the following command (it is not necessary most of the time):

$ ifconfig eth0 192.168.2.1 netmask 255.255.255.0 up


2. Check and Assign IP address

Now, check and assign the IP address with the below command:

$ ifconfig

Next, run the following command to get more information, i.e., information about active and inactive interfaces:

$ ifconfig -a


3. Inspect Network Interfaces

Now, to see a table of all network interfaces, we will use the following command:

$ netstat -i

Once you see the network named "eth0", we will need to enable it by using one of the following commands:

$ ifconfig eth0 up

Or

$ ifup eth0

Then, to deactivate it, use one of the following commands:

ifconfig eth0 down

or

$ ifdown eth0

Note: Depending on your NIC (Network interface controller), there can be multiple ports. You can select any of them to be disabled individually. For example, if you want to disable "eth1", then you would execute the following command:

$ ifconfig eth1 down

or

$ ifdown eth1


How to Disable and Enable the Whole Network or All Interfaces ?

The below commands can be used if you want to disable all incoming and outgoing remote connections on all of your network interfaces:

$ /etc/init.d/network stop

Now, when you have disabled them, then you can enable them again using the following command:

$ /etc/init.d/network start


Important: Disabling and Enabling the network requires a password that is the same as your user password. Once you've entered the correct password, you will see the [ ok ] in front of your command in the terminal.


[Need to fix your Linux system issues ? We can help you. ]

This article covers the process of disabling the network interface, the use of the network interface, and the working of the network interface. In fact, in some situations, you might need any one of them to be disabled temporarily so that the other one can work properly. 


How do I delete an ifconfig interface ?

To delete an alias interface use:

$ ifconfig eth0:0 down 

Note: for every scope (i.e. same net with address/netmask combination) all aliases are deleted, if you delete the first (primary). 

'ifconfig eth0:0 up' flag causes the interface to be activated.


How do I restart NetworkManager in AlmaLinux ?

1. You can run the following command to restart the server networking service:

# nmcli networking off 
# nmcli networking on 

or 

# systemctl restart NetworkManager

2. Once this is done, use the following command to check the server network status:

# nmcli -o 

or

# systemctl status NetworkManager

Related Posts