1 configure Nic modify the configuration file vietcsysconfignetwork-scriptsifcfg-eth0 for the IP address of the corresponding Nic modify the following content DEVICE = eth0 (describe the DEVICE alias for the NIC, for example, it is eth0 in the ifcfg-eth0 file) BOOTPROTO = 1. configure the NIC
Modify the configuration file of the corresponding nic ip address
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Modify the following content
DEVICE = eth0 (describe the DEVICE alias for the NIC, for example, it is eth0 in the ifcfg-eth0 file)
BOOTPROTO = static, IP addresses obtained through the bootp protocol)
BROADCAST = 192.168.0.255 (corresponding subnet BROADCAST address)
HWADDR = 00: 07: E9: 05: E8: B4 (corresponding Nic physical address)
IPADDR = 12.168.1.2 (if the IP address obtained by The NIC is set to static, the IP address corresponding to the NIC is specified in this field)
IPV6INIT = no
IPV6_AUTOCONF = no
NETMASK = 255.255.255.0 (network mask corresponding to the NIC)
NETWORK = 192.168.1.0 (NETWORK address corresponding to the NIC)
ONBOOT = yes (whether to set this network interface when the system starts. if it is set to yes, the device is activated when the system starts)
2. modify the Gateway
Modify the gateway configuration file of the corresponding Nic
# Vi/etc/sysconfig/network
Modify the following content
NETWORKING = yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot be started)
HOSTNAME = centos (set the host name of the local machine. the host name set here must correspond to the host name set in/etc/hosts)
GATEWAY = 192.168.1.1 (set the IP address of the GATEWAY connected to the local machine. For example, the gateway is 10.0.0.2)
3. modify DNS
Modify the DNS configuration file of the corresponding Nic
# Vi/etc/resolv. conf
Modify the following content
Nameserver 202.101.224.68 (domain name server)
Nameserver 202.101.224.69 (domain name server)
4. restart network configuration
# Service network restart
Or
#/Etc/init. d/network restart
5. modify the IP address
Effective immediately:
# Ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Start effective:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Modify gateway default gateway
Effective immediately:
# Route add default gw 192.168.0.1 dev eth0
Start effective:
Modify/etc/sysconfig/network
Modify dns
Modify/etc/resolv. conf
Modify host name
After modification, the modification takes effect immediately, and the startup is also effective immediately:
# Hostname centos1
Start effective:
Modify/etc/sysconfig/network
6. network commands
Ifdown eth0 disable network
Ifconfig eth0 down disable network
Ifup eth0 enable network
Ifconfig eth0 up enable network
Service network start // start a network service
Service network stop // stop a network service
Service network restart // restart the network service
Service network status // view the network service status
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.