CentOS Network Configuration
Turn on network functions
#vi/etc/sysconfig/network
Important Parameters:
Networking=yes, do you want Open Network function, of course Yes Ah
Whether Networking_ipv6=no supports IPV6
Hostname= Host Name
Configuration file for Nic
Related network configuration files and directories:
/etc/sysconfig/network-scripts/directory for the configuration file where the NIC is stored
Take/etc/sysconfig/network-scripts/ifcfg-eth0 as an example:
Network card eth0 configuration file, important parameters:
Device=eth0 the name of the NIC
BOOTPROTO=DHCP using DHCP
HWADDR=08:00:27:C7:FE:AC Network card number (MAC)
uuid= Global Unique identifier, virtual machine general hwaddr= ... This does not exist, only the UUID entry identifies the NIC, which can be manually added to the
hwaddr=mac then delete the UUID entry, Restart to use the Mac identity card
ipaddr=192.168.100.127 static IP address (cannot exist with BOOTPROTO=DHCP)
netmask=255.255.255.0 Subnet Mask
onboot= Yes to start this interface by default
gateway= Gateway ip If there are multiple network cards, there is only one configuration file for the network card, that is, gateway, which can have only one
peerdns=no /etc/Local settings are not allowed The DNS server in resolv.conf is changed to DHCP server Set, best to remove this,
you might not be able to get on the net.
Nm_controlled=yes/no Additional network management software (cancellation is recommended)
/etc/resolv.conf configuration file:
Format
NameServer DNS Server IP
This file configures our host to use the DNS server, can be manually modified, but if the use of DHCP to obtain IP address, then this file nameserver
will be modified to the DHCP server preset DNS, so if you want to use your own custom DNS but DHCP is the way to obtain IP,
then in the corresponding/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETHX NIC configuration file plus a line peerdns=no can .
VBox virtual machine Add a virtual network card, you will find that the use of the Ifconfig command did not find the newly added network card, and there is no corresponding configuration file/etc/sysconfig/network-scripts/. Check to see if your network card is recognized by the system:
#cat/etc/udev/rules.d/70-persistent-net.rules
The virtual network card can be added here is recognized, but no configuration file, so simply add a corresponding name of the IFCFG-ETHX (x is 1, 2 ... ) and then start the NIC or restart the network. You can copy a copy of the Ifcfg-eth0 configuration file for the newly added ethx ifcfg-ethx file, and then modify the parameters inside. And then
#ifup EHTX
or restart the network.
#/etc/init.d/network restart
Debian Network Configuration
Ubuntu is connected with two NICs, Eth0 and eth1. eth0 on the IP for automatic acquisition, eth1 on the manual set
Open Ubuntu Network adapter profile/etc/network/interfaces, modify the following
Auto Lo eth0 eth1
Iface Lo inet Loopback
Iface eth0 inet DHCP
Iface eth1 inet Static
Address 192.168.0.50
Netmask 255.255.255.0
Network 192.168.0.0
Broadcast 192.168.0.255
Gateway 192.168.0.1
Write the save, then open the terminal run the following command, restart the network card:
$/etc/init.d/networking restart
You can also restart the NIC for the new configuration to take effect without affecting other network interfaces:
$ sudo ifdown eth1
$ sudo ifup eth1
You can also get the address by typing the following command directly below the command line
$sudo dhclient eth0
My QQ space original http://user.qzone.qq.com/1475032202/blog/1418796293
VBox Virtual machine Centos/ubuntu Network configuration