Note:
Computer Model Lenovo y-560p
The dual-system is installed on the computer, respectively: win764-bit and centos6.064-bit
Network: China Telecom 4 m, TP-Link Wireless Router
After installation, the network and wireless network are as follows:
Ifconfig
View Nic and wireless Nic information: iwconfig
Remember the NIC to MAC address.
Run the setup command to configure the network.
In this/etc/sysconfig/network-scripts/directory, modify the ifcfg-eth0
Device = eth0
Bootproto = DHCP
Hwaddr = 60: EB: 69: FC: F5: 4E
Ipv6init = No
Ipv6_autoconf = No
Onboot = Yes
On the command line, enter:
[Root @ localhostnetwork-Scripts] # service network start
The following interface is displayed:
Eth0:
Deciding eth0
IP information... complete.
Closed link: ifdowneth0; enabled link: ifupeth0
Now you can access the Internet normally.
Appendix 1: network settings
1. Set the network
/Etc/sysconfig/network-Scripts
(1) set the IP address
<1> modify an IP address
Modify the configuration file of the corresponding Nic IP Address
#
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 a 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
Nameserver202.101.224.68 (Domain Name Server)
Nameserver202.101.224.69 (Domain Name Server)
<4> restart Network Configuration
# Servicenetwork restart
Or
#/Etc/init. d/network restart
<5> modify an 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 the ultgateway
Effective immediately:
# Route adddefault GW 192.168.0.1 Dev eth0
Start effective:
Modify/etc/sysconfig/Network
Modify DNS
Modify/etc/resolv. conf
The modification takes effect immediately and starts as well.
Modify hostname
Effective immediately:
# Hostnamecentos1
Start effective:
Modify/etc/sysconfig/Network
<6> network commands
Ifdowneth0 disable the network
Ifconfigeth0 down disable network
Ifupeth0 enable Network
Ifconfigeth0 up enable Network
Servicenetwork start // start the network service
Servicenetwork stop // STOP THE NETWORK SERVICE
Servicenetwork restart // restart the network service
Servicenetwork status // view the network service status
Appendix 2: configure the network in three ways:
1. Log On As root and run Setup to configure the network. Here, you can set the IP address, subnet mask, and DNS. The configuration does not take effect. Run/etc/rc. d/init. d/networkrestart to restart the NIC.
2. ifconfigeth0 x. x: Set ifconfigeth0 network x. x to set the subnet mask. This setting takes effect immediately, but is temporary.
3. Modify/etc/sysconfig/network-scripts/ifcfg-eth0
File. It does not take effect immediately. You need to restart the NIC to take effect. Run/etc/rc. d/init. d/networkrestart
Enable the NetworkManager service
First, we will set your centos system to automatically enable NetworkManager when it is turned on. You can do this:
Chkconfignetworkmanager on
Then we will guide it so that we can apply it without restarting it:
Servicenetworkmanager start
If you complete this step in the image environment (gnome), your local notification (usually in the upper right corner of the GNOME panel) will display a new icon. If you click this icon, you will see a list listing all the wireless networks that can be connected.
You may want to disable your network and wpa_supplicant services at startup, because NetworkManager will process them for you. In this case, you only need to execute:
Chkconfignetwork off
Chkconfigwpa_supplicant off
After starting NetworkManager, you can connect to the wireless network. You can use iwconfig to configure a wireless Nic.