Linux entry record: 15, Linux network basic configuration

Source: Internet
Author: User
Tags get ip naming convention network troubleshooting

First, Ethernet (Ethernet)

Ethernet (Ethernet) is a computer LAN technology. The IEEE 802.3 standard of the Organization for the Standardization of Technology establishes the technical standard of Ethernet, which specifies the contents of the connection, electronic signal and media Access layer protocol including the physical layer. Ethernet is the most commonly used LAN technology, replacing other LAN standards such as Token Ring, FDDI and ARCNET.

Ethernet implements the idea of sending information to multiple nodes of a radio system on a network, and each node must pass through a cable or channel to transmit information, sometimes called an ether (ether). (the name derives from the 19th century physicist hypothesis of the electromagnetic radiation media-optical ether.) Later studies have shown that optical ether does not exist. Each node has a globally unique 48-bit address, which is the MAC address that the manufacturer assigns to the NIC to ensure that all nodes on the Ethernet network can identify each other. Because Ethernet is common, many manufacturers integrate Ethernet cards directly into the computer's motherboard. (This Ethernet section is referenced from Wikipedia)

Second, PCI (peripheral Component Interconnect, external components interconnection standard)

or Personal computer Interface (PC interface), the actual application of the abbreviation for PCI, is a computer motherboard and external equipment to connect the bus standard.

General PCI devices can be divided into the following two types:

    • An integrated circuit that is directly built into the motherboard, referred to in the PCI specification as an "embedded device" (planar);
    • Expansion interface card installed on the slot

PCI bus is common in modern PCs and has replaced the ISA and VESA local buses as standard expansion buses. PCI buses are also common in other computer types. The PCI bus will eventually be replaced by PCI Express and other more advanced technologies, which are now being used in the latest computers.

The PCI specification specifies the physical dimensions of the bus (including line widths), electrical characteristics, bus timing, and protocols. This specification can be purchased from the American Pci-sig Association.

Common PCI cards include network cards, sound cards, modems, TV cards, and hard disk controllers, as well as ports such as USB and serial ports. The original card is usually a PCI device, but soon its bandwidth is not enough to support the performance of the graphics card. PCI graphics cards are now used only when there are no AGP and PCI Express slots on the external monitor or motherboard that require extra. (The PCI section is referenced from Wikipedia)

Third, the network interface of Linux

The Linux Network Interface (interface) does not exist for a certain naming convention, but it is meaningful:

    • Eth0: Generally used for Ethernet (Ethernet) interface, 0 means the first NIC
    • Wifi0:wifi is a wireless LAN, so wifi0 generally refers to the wireless network interface
    • Ath0: Generally refers to the wireless network interface that the Atheros chip contains
    • Lo:local, generally referred to as the local loopback interface, is a virtual network interface , basically every Linux has this interface

The virtual network interface does not really accept and send packets from outside, but accepts and sends packets inside the system, so the virtual network interface does not need drivers.

The virtual network interface and the real network interface are consistent in use.

The command LSPCI can display all PCI bus information for the current host, as well as all connected PCI device information. (if it is a USB card, you may need to use the lsusb command).

The command ifconfig is used to view network interface information:

Ifconfig-a     View all interfaces ifconfig eth0   View specific interfaces

Command ifup , ifdown to activate, disable a network interface:

Ifup eth0    activation eth0ifdown eth0  disable eth0

Here are some hardware information for CentOS 6.9 in my vitual box.

PCI Device Information:

Network interface Information:

The parameter information for the NIC Eth0 is as follows:

Line 1th      Connection type (link encap): Ethernet (Ethernet), hardware address (MAC address): 08:00:27:85:37:B4 2nd row      IPv4 address (inet addr), subnet (bcast), Mask (mask) line 3rd      IPv6 address (Inet6 addr) line 4th      up: Network card is turned on; RUNNING: Network card has been connected; multicast: support multicast; MUT: Maximum throughput (units, bytes) 5th, 6 rows   Receive, send packet statistics on the 8th line      receive, send data byte count

There is only a workaround for IPv6 without IPV4 address after executing the ifconfig command:

1. First make sure your network card is activated (using the ifup eth0 command)

2. Use the Dhclient command to dynamically obtain the IP, and then execute the ifconfig command again to see the Ipv4 address.

However, after the system restarts, it will fail, and the method of permanent operation is:

1. Modify the configuration file of the corresponding network card/etc/sysconfig/network-scripts/ifcfg-eth0, set the Onboot property to Yes,

2. Execute the Service network restart command again. You can see Eth0 's IPv4 address at any time with the Ifconfig command.

To activate and disable an interface:

IV. Configuration of Network information

Use the Setup command to set up Linux with the class "Graphical" interface, enter Setup in the terminal, and enter into the interactive interface.

Linux is generally configured for network, the process is this:

, select Network Configuration, Run Tool, and go to the next step.

, select hardware Configuration "Device Configuration" and enter the next step.

, select Configure Eth0 nic, enter next.

, each parameter is in turn:

Name: Interface name devices: Device name Use DHCP: whether to obtain IP using DHCP (home computer is generally, server IP general No, need to configure static IP) static IP: Static ipnetmask: Subnet mask default gateway IP: Default gateway IP (typically 192.168.1.1, the same network segment as IP) Primary DNS server: Primary DNS server ipsecondary DNS server: Alternate DNS server Ippeer DNS: Whether to accept DHCP server assigned DNS server address on boot: whether to start controlled by NetworkManager: whether it is controlled by the image network manager NetworkManager.

Configure the network parameters as follows:

, after the configuration is complete, the basic is to determine the next save. "OK" next.

, "Save" goes to the next step.

, "Save&quit" goes to the next step.

, "Quit" Exits the Setup command environment.

Eth0 network parameters configured, and finally remember to use the ifup eth0 activation interface can:

As you can see, in the latest interface information, Eth0 's IP address has become the 192.168.1.210 we just set

If you use ifup eth0 cannot activate the Eth0 interface, then check your eth0 configuration parameters, most likely the IP mismatch, such as a happy with a 192.168.1.666. As for how I know, I will not say ~ ~

Five, network configuration related files
File Path
Configuration file for Nic Eth0 /etc/sysconfig/network-scripts/ifcfg-eth0
DNS configuration file /etc/resolv.conf
Host name configuration file /etc/sysconfig/network
Static Host name configuration file /etc/hosts

1. configuration file for Nic Eth0

/etc/sysconfig/network-scripts/ifcfg-eth0:

The parameters are explained as follows:

Devices: Device name HWADDR: Hardware address (MAC address) Type: connection type (e.g. Ethernet, Ethernet) UUID: Device identification number onboot: Activated with boot enabled NM_ Cotrolled: Whether the program is NetworkManager controlled by an image Bootproto: Start protocol (none|static|dhcp,static static get IP, DHCP dynamic get IP) Userctl: whether to allow ordinary users to control this interface Peerdns: whether to accept the DHCP server assigned DNS server address Ipv6init: Support Ipv6ipaddr:ipv4 address netmask: Subnet mask Gateway: Gateways DNS1 , DNS2: Two DNS

  

2. DNS configuration file

/etc/resolv.conf:

A one-line DNS configuration, which is the two DNS that we've just already worked with.

3. Host name configuration file

/etc/sysconfig/network:

4. Static Host name configuration file

/etc/hosts:

VI. Network Test commands

Test network connectivity:

Ping 192.168.1.210ping www.locallinux.com

To test DNS resolution:

Host Www.locallinux.comdig www.locallinux.com

Show route table:

IP route

Trace the network path that passes through the destination address:

Traceroute www.locallinux.com

Network quality testing using the MTR command (combined with traceroute and Ping , a dynamically updated routing table is displayed):

MTR www.locallinux.com

Vii. Modifying host Names

Temporarily modify host Name:

Hostname www.localhost.com

To permanently modify the host name:

To modify the hostname configuration file/etc/sysconfig/network:hostname=www.localhost.com

  

Eight, network troubleshooting

Network troubleshooting follows a process from the bottom to the top, from itself to the outside .

1. First check that the network configuration is correct:
IP Address Subnet Mask Gateway DNS

2. Check that the arrival gateway is connected:
Ping the Gateway IP

3. Check that DNS resolution is normal:
Host Www.locallinux.comhost Www.cnblogs.comhost www.runoob.com

  

Reference Links:

Ethernet-Wikipedia

External Component Interconnect Device (PCI)-Wikipedia

Literacy of Linux network interfaces

Solve the problem that Linux uses ifconfig output only with IPv6 address and no IPv4 address

RHEL7.0 Series-Set IP address, gateway, and DNS

Linux entry record: 15, Linux network basic configuration

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.