Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the centos minimal network configuration?

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the centos minimal network configuration, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Installation on the virtual machine found that the default is the command line interface all the way, and finally found to be the installation of Minimal, and the network card is not started by default. Dizzy. Search the Internet to know that the original Centos 6 under the Minimal, the network card default onboot= "no", and set the option to rely on NetworkManager, NM_CONTROLLED= "yes", because minimal does not install the default network management tool NetworkManger. So we need to change it to:

The code is as follows:

ONBOOT= "yes" MM_Controlled= "no".

Manually edit the configuration file (vi / etc/sysconfig/network-script/ifcfg-eth0) of the Nic in the following format:

Java code

The code is as follows:

ONBOOT= "yes"

MM_Controlled= "no"

IPADDR=192.168.0.33

BOOTPROTO=none

NETMASK=255.255.255.0

GATEWAY=192.168.0.1

DNS1=192.168.0.1

DNS2=192.168.0.2

USERCTL=yes

Or use to automatically obtain IP:

Java code

The code is as follows:

ONBOOT= "yes"

MM_Controlled= "no"

BOOTPROTO= "dhcp"

Now restart it.

Java code

# service network restart

The network card can be started randomly or ifup eth0 can start the network card.

Basic configuration after CentOS 6 minimal installation detailed explanation of the above configuration

1. Network configuration

(1) Command configuration

Java code

# ifconfig eth0 192.168.0.2 netmask 255.255.255.0 / / ip address, subnet mask

# route add default gw 192.168.0.1 dev eth0 / / Gateway

# hostname centos / / computer name

(2) File configuration

Modify IP address

Modify the configuration file of the IP address of the corresponding network card

Java code

# vi / etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0 (describes the device alias corresponding to the Nic, for example, eth0 in the file of ifcfg-eth0)

BOOTPROTO=static (set the way for the network card to obtain the ip address, the possible options are static,dhcp or bootp, corresponding to the statically specified ip address, the ip address obtained through the dhcp protocol, and the ip address obtained through the bootp protocol)

BROADCAST=192.168.0.255 (corresponding subnet broadcast address)

HWADDR=00:07:E9:05:E8:B4 (the physical address of the corresponding network card)

IPADDR=12.168.1.2 (if you set the way for the Nic to obtain the ip address statically, this field specifies the ip address corresponding to the Nic)

IPV6INIT=no (turn on or off IPv6; turn off no, turn on yes)

IPV6_AUTOCONF=no (turn on or off IPv6 auto configuration; turn off no, turn on yes)

NETMASK=255.255.255.0 (the network mask corresponding to the network card)

NETWORK=192.168.1.0 (the network address corresponding to the network card)

ONBOOT=yes (whether to set this network interface when the system starts, and activate this device when the system starts up when it is set to yes)

Generally speaking, DHCP only needs to add more BOOTPROTO, but I like to turn off the setting of IPV6.

Modify the gateway

Modify the configuration file of the gateway of the corresponding network card

Java code

# vi / etc/sysconfig/network

NETWORKING=yes (indicates whether the system uses a network, which is generally set to yes. If set to no, the network cannot be used, and many system services will not start)

HOSTNAME=centos (set the hostname of this machine, which corresponds to the hostname set in / etc/hosts)

GATEWAY=192.168.1.1 (sets the IP address of the gateway connected locally. For example, the gateway is 10.0.0.2)

Modify DNS

Modify the configuration file of the DNS of the corresponding network card

Java code

The code is as follows:

# vi / etc/resolv.conf

Nameserver 202.101.224.68 (Domain name Server)

Nameserver 202.101.224.69 (Domain name Server)

Restart the network configuration

Java code

The code is as follows:

# service network restart

# or

# / etc/init.d/network restart

The above is what the centos minimal network configuration is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report