Linux Getting Started-6 Linux network basic configuration

Source: Internet
Author: User
Tags domain name server network troubleshooting

    • 1. Network Basics
      • Network addressing
      • IP Addressing
      • Subnet mask
      • Communication--mac address between the same network host
      • Communication between different networks
      • Routing
      • Domain name
      • Dns
      • Basic network parameters
    • 2. Linux Network Infrastructure configuration
      • Ethernet Connection
      • Configure Network Information
      • Network-related configuration files
      • Network Test commands
      • Modify Host Name
      • Network troubleshooting
1. Network basic Knowledge Network addressing IP Addressing

A two-tier (network, host) addressing scheme, an IP address identifies a host (specifically a NIC interface)

    • IPV4 32 bits long, IPV6 128 bits long
    • IPV4 is divided into two parts: the network part and the host part
    • The network section is used to identify which host in the zone and the host part is used to identify the
    • expressed in dotted decimal notation
Subnet mask

The network part and host part length is not fixed , so the subnet mask to determine the network portion of the number of bits

    • 32 bits, and IP address one by one corresponds
    • The portion of Subnet mask 1 is the network part
Communication--mac address between the same network host

In the same network, the host is connected directly through the switch, and the communication relies on the Mac (Media Access Control) address

Network: 192.168.1.0
Subnet Mask: 255.255.252.0

    • The source host sends an ARP (address Resolution Protocol) message, and all hosts in the network receive it, but only the host of the destination IP responds, the destination host sends its MAC address to the source host, which then establishes the communication (three handshake)
Communication between different networks

You need a router or a gateway, or you can use a host with a routing capability.

Router for message forwarding

Routing

The ability to transfer data between different networks is called routing, and there are generally multiple interfaces that are connected to different networks and are forwarded through the routing table.

Domain name
    • Type: com, net, org, edu, gov, etc
    • Domain name: case insensitive, linuxcast
    • Host name ( server ): www, mail, FTP, etc

The convention www is a Web server, but you can use a different name, not mandatory ,

Dns

Domain Name Server

Basic network parameters
    • LAN Communication
      • IP Address
      • Subnet mask
    • Cross-Network segment
      • IP Address
      • Subnet mask
      • Gateway
    • Internet access available
      • IP Address
      • Subnet mask
      • Gateway
      • Dns
2. Linux Network Foundation Configuration Ethernet Connection
    • In Linux, the Ethernet interface is named: eth0, eth1, 0, 1 for the NIC number
    • By lspci viewing the NIC hardware information, the USB network card is lsusb viewed by command
    • ifconfig(interface configration) View interface information (This command will be deprecated and IP commands are currently recommended)
      • ifconfig -aView all interfaces
      • ifconfig eth0View Eth0
      • In addition to the hardware interface, there is a loopback interface called LO (loopback), 127.0.0.1
    • ifup, ifdownEnable, disable an interface
Configure Network Information

setup(CentOS)

Network-related configuration files
    • Nic configuration file: /etc/sysconfig/network-scripts/ifcfg-eth0 (CentOS)
    • DNS configuration file:/etc/resolv.conf
    • Hostname configuration file:/etc/hostname
    • static hostname configuration file:/etc/hosts
Network Test commands
    • Test network connectivity:ping
    • Test DNS resolution: host ,dig
    • Show route table:ip route
    • Trace the network path to the destination address: traceroute ( tracepath/traceroute6 )
    • Use mtr for network quality testing (combined traceroute and ping )
Modify Host Name
    • Real-time Modification:hostname name
    • Permanent: In the network configuration file ( /etc/hostname )
Network troubleshooting

Principles: from Bottom to top, from self to exterior

    • Check that the network configuration is correct first
    • Check to see if the gateway is connectedping gateway/ip
    • See if DNS resolution is normal host / traceroute traceable

Linux Getting Started-6 Linux network basic configuration

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.