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:
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
$ ifup eth0
Then, to deactivate it, use one of the following commands:
ifconfig eth0 down
$ 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
$ 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. ]