[Centos6, 7] network principle and network configuration

Source: Internet
Author: User
Part 1: Network principle: 1. network addressing (mainly using IP address addressing) 1. IP address addressing is a two-layer addressing solution. an IP address identifies a host (or a Nic interface) 2. Currently, IPv4 addressing is the most widely used address.

Part 1: Network principles:

1. network addressing (mainly using IP address addressing)

1. ip address addressing is a two-layer addressing scheme. an ip address identifies a host (or a Nic interface. IPv4 addressing is the most widely used address. it has begun to be converted to IPv6 addressing. the ipv4 address is 32-bit long and the ipv6 address is 128-bit long. an ipv4 address is divided into two parts: the network part and the host part. the network part is used to identify the region and the host part is used to identify the host in the region.

II. IP address:

1. ipv4 addresses are 32 bits in total, which are usually expressed in dotted-decimal format. 2. the entire IP address is divided into four parts, each of which is 8 bits. Example: IP address decimal and binary

III. subnet mask:


 

4. communication between hosts on the same network


1. the mac address must also be used for communication between the same network host (the unique expression on the NIC). if the host in the same network segment is connected through a switch or direct connection, the host will send the ARP protocol, obtain the mac address of the host to be connected, and then perform communication.

5. communication between different networks

1. use network management, routers, or hosts with routing functions. 6. routing: the function of transmitting data between different networks is called routing. Generally, there are multiple interfaces that connect to different networks and forward data through the route table.

VI. domain name:

VII. DNS

DNS server: provided by the carrier.
8. basic network parameters 1. computer for which you want to configure a LAN communication: IP address subnet mask 2. to configure a computer for cross-network communication: IP address subnet mask Network Management 3. to configure a computer that can access the Internet: IP address subnet mask network management DNS

Part 2: network configuration:

1. Ethernet connection:

1. in linux, the Ethernet interface is named eth0 and eth1. 0 and 1 represent the network card number 2. use the lspci command to view the hardware information of the NIC (if it is a usb Nic, you may need to use the lsusb command) 3. command ifconfig command is used to view the interface information ifconfig-a view all interfaces ifconfig eth0 view the specified interface 4. command ifup and ifdown are used to enable or disable an interface ifup eth0 ifdown eth0

2. use the setup command to configure the network information and enter the setup command:
Netmask is the static ip address of the subnet mask.
After the configuration is complete, use ifup to start the NIC and run the ifconfig command to view the information.
 

3. network-related configuration files

1. Nic configuration file/etc/sysconfig/network-scripts/ifcfg-eth0 example: [root @ localhost ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) TYPE = Ethernet # Nic type device = eth0 # Nic interface name or eth1, so the file name is also called ifcfg-eth1 ONBOOT = yes # whether to automatically load BOOTPROTO = static when the system starts # enable address protocol -- static: static protocol -- bootp protocol -- dhcp protocol IPADDR = 192.168.1.11 # nic ip address NETMASK = 255.255.255.0 # Nic network address GATEWAY = 192.168.1.1 # Nic GATEWAY address DNS1 = 8.8.8.8 # Nic DNS address HWADDR = 00: 0C: 29: 13: 5D: 74 # Nic device MAC address BROADCAST = 192.168.1.255 # Nic BROADCAST address

2. DNS configuration file/etc/resolv. conf example: [root @ uz23132 network-scripts] # cat/etc/resolv. conf nameserver 8.8.8.8 # DNS 3. host name configuration file/etc/sysconfig/network example: [root @ uz23132 ~] # Cat/etc/sysconfig/network NETWORKING = yes HOSTNAME = uz23132.uuzz.com # host name GATEWAY = 192.168.1.1 # GATEWAY NETWORKING_IPV6 = off 4. static host name configuration file/etc/hosts example: [root @ uz23132 network-scripts] # cat/etc/hosts 127.0.0.1 localhost. localdomain localhost4 localhost4.localdomain4: 1 localhost. localdomain localhost6 localhost6.localdomain6 192.168.1.11 uz23132.uuzz.com # ip address of the host name
 

4. network test command:

5. modify the host name:


1. modify the host name in real time: after the host name is changed using hostname, the host name will be restored after the host is restarted. 2. modify the host name permanently: modify the host name in the/etc/sysconfig/network file hostname = host name.

6. Troubleshooting:
 

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.