Linux study note _ 11_2_Linux network settings (below)

Source: Internet
Author: User

Linux network settings (below)



I. Internet addressing process (continued)



2. Internet addressing Process

6) Resolve the domain name to an IP address

A) Hosts resolution method [oldest]: Save the/etc/hosts file [saved in Windows]

Format: IP address host name/Domain Name alias

This file has been in use. For example, some anti-virus software will shield the IP address of an illegal website from 127.0.0.1.

B) NIS-Network Information System [developed by Sun]

Centralized File Management

C)DNS-Domain Name System# Domain name, domain

The entire Internet is DNS-based domain name resolution, among which BIND is the most popular domain name resolution software.

Domain delegate management



Recursive query


Client ----> www.csdn.net

1. Local DNS server [cache (generalized cache )]

Therefore, if you access a website slowly, (1) the bandwidth of the optical cable may be insufficient. (2) If the DNS server does not cache the website, recursive resolution is required first. (3) The server performance is poor.

2. root domain.

→. Net

3. top-level domain. net

→ Csdn.net → DNS server → Client


Cache Mechanism


Generalized cache: If www.csdn.net has been located, the root domain will not be asked again during the next visit to www.263.net 【. ], but directly located.. net server. If this is the attempt to access java.263.net, the server of 263.net is located instead of accessing it again. net Server


Appendix:

1. One MAC address can correspond to multiple IP addresses

Ifconfig eth0: 1 192.168.1.1

2. One IP Address can correspond to multiple MAC addresses

For example, cluster technology performs round-robin load, and performs average load based on different MAC addresses.

On Linux, You can bind two NICs to one IP address for acceleration.

3. a domain name can correspond to multiple IP addresses

4. One IP Address can correspond to multiple domain names


Ii. Network Configuration File

1,/etc/sysconfig/network-scripts/ifcfg-eth0 [Save the IP address and gateway]

IPADDR = new IP address # This option sets the IP address. If BOOTPROTO = dhcp is set and the IP address is automatically obtained, this option is not available. Otherwise, it is BOOTPROTO = no.

GATEWAY = GATEWAY # specify a GATEWAY

BROADCAST = BROADCAST address

NETMASK = Subnet Mask


2./etc/sysconfig/network saves the local host name

HOSTNAME = host name # specify the host name. If dhcp is specified for automatic allocation, this option is not available because the host names are all localhost.


3./etc/rc. d/ini. d/network start/stop/restart network Startup Script

If two configuration files are changed, restart the computer, or re-load the following STARTUP script. The settings will take effect. However, we recommend that the latter because the server cannot be restarted frequently!


4./etc/hosts # Save the host name database


5./etc/services # stores network service information, such as ports and transmission protocols.

The service program may not use a fixed port, but the WebServer exposed to the outside will not change the port

However, we recommend that you change SSH to avoid scanning.

Nmap IP address # scan the other host to enable those services, but it only scans the Hidden Port or the port of the well-known service



6./etc/resolv. conf # specify the DNS server address

NameserverDNS Server IP address # You can add spaces to specify multiple DNS server addresses.Use3



3. network management commands

1. ifconfig # view network port settings

Ifconfig eth0 up/down # enable/disable the NIC



2. ethtool Nic name # detect Nic line connection

Ethtool eth0

The ethtool command is very important when multiple NICs exist on a server!



3. arp # view ARP table information, as shown in the preceding figure.

4. ping # detect remote hosts

Ping-c 10-s 1000 IP address #-c specifies the number of ping requests, and-s specifies the size of sent packets. Pay attention to the packet loss rate during ping.



5. route # operate the route table

Route add default gw 192.168.14.100 # add a gateway without modifying the configuration file [but it is best to modify the configuration software]

Zerba routing software]



6. traceroute # view the route path

Traceroute www.163.com # it lists all the routers and latencies that pass through the host.

7. netstat # monitor the network status

Netstat-an # view all connections

Netstat-an | grep: 80 # Check whether the Apache service is started

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.