In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
What are the knowledge points of this article "what are the network configuration files in Linux?" most people do not understand, so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what are the network configuration files in Linux" article.
I. Network configuration file
1.1 system Network device profile / etc/sysconfig/network-scripts
] # vim / etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 / / indicates the name of the physical device of the network card
BOOTPROTO=dhcp / / indicates whether the Nic is configured with a static or dynamic IP address (none: does not need to start the protocol; bootp: indicates the use of BOOTP protocol
Dhcp: use dhcp protocol to obtain ip address dynamically; static: means to set static IP address manually)
ONBOOT=yes / / indicates whether the network card is activated when the system is started. If yes is activated, no is not activated.
TYPE=Ethernet / / Network Typ
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
PERSISTENT_DHCLIENT=1
HWADDR= / / indicates the MAC address of the network card
GATEWAY = / / indicates the gateway address
NETMASK / / indicates the subnet mask
IPADDR= / / indicates IP address
] # systemctl restart network (restart the service)
2. / etc/resolv.conf domain name resolution configuration file
Nameserver: indicates that the host specified by the resolution domain name using this IP address is the domain name server
Search: indicates the DNS search path
3. / etc/hosts hostname matches IP address
4. / etc/networks the mapping relationship between network name and network address
] # vim / etc/networks
Default 0.0.0.0
Loopback 127.0.0.0
Link-local 169.254.0.0
5. / etc/protocols defines the protocol used by the host, and the protocol number of each protocol and other related information
] # vim / etc/protocols
6. / etc/services defines the name, protocol type, service port number and other information of all services in the system. This file is a database file corresponding to the service name and service port number.
] # vim / etc/services
II. Linux network command
2.1 traceroute shows the path between the packet and the target host, which can be traced to the routing path of the network packet.
Command syntax: traceroute [option] [hostname | IP address] [packet size]
-d uses Socket-level troubleshooting capabilities.
-f sets the size of the survival value TTL of the first detection packet.
-F setting do not leave the break bit.
-g set source routing gateways. A maximum of 8 can be set.
-I send out packets using the specified network interface.
-I use ICMP responses instead of UDP data information.
-m sets the size of the maximum survival value TTL of the detection packet.
-n directly use the IP address instead of the host name.
-p sets the communication port of the UDP transport protocol.
-r ignores the normal Routing Table and sends the packet directly to the remote host.
-s sets the IP address of the packet sent by the local host.
-t sets the TOS value of the detection packet.
-v shows the execution of the instruction in detail.
-w sets the time to wait for a return from the remote host.
-x turns on or off the correctness check of the packet.
2.2 ifconfig can display and configure network interfaces, such as setting IP addresses, MAC addresses, activating or shutting down network interfaces.
Ssh login Linux server operation should be careful, the network card closed can not be connected to open, unless you have multiple network cards. ]
The Nic information set by the ifconfig command will expire after the system is rebooted.
Syntax format: ifconfig [API] [option | IP address]
Up starts the specified network device / network card.
Down closes the specified network device / network card.
The arp setting specifies whether the network card supports the ARP protocol.
-promisc sets whether the promiscuous mode of the network card is supported. If this parameter is selected, the network card will receive all packets sent to it in the network.
-allmulti sets whether multicast mode is supported. If this parameter is selected, the Nic will receive all multicast packets in the network.
-a displays all interface information
-s displays summary information (similar to netstat-I)
Add configures the IPv6 address for the specified network card
Del deletes the IPv6 address of the specified network card
Mtu sets the maximum transmission unit (bytes) of the network card
Netmask sets the subnet mask of the network card.
Tunel sets up tunnel
Dstaddr sets a remote address to establish point-to-point communication
-broadcast sets the broadcast protocol for the specified network card
-pointtopoint sets up a point-to-point communication protocol for the network card
Multicast sets the multicast flag for the network card
Address sets the IPv4 address for the network card
Txqueuelen sets the length of the transmission queue for the network card
2.3 connectivity between the ping test and the target host
Format: ping [options] [destination]
-t the computer specified by Ping until interrupted.
-a resolves the address to the computer name.
-n count sends the number of ECHO packets specified by count. The default value is 4.
-l length sends an ECHO packet containing the amount of data specified by length. The default is 32 bytes; the maximum is 65527.
-f sends the "do not segment" flag in the packet. The packet is not segmented by the gateway on the route.
-I ttl sets the time to Live field to the value specified by ttl.
-v tos sets the Service Type field to the value specified by tos.
-r count records the routes of outgoing and return packets in the record routes field. Count can specify at least 1 computer and up to 9 computers.
-s count specifies the timestamp of the number of hops specified by count.
-j computer-list routes packets using the computer list specified by computer-list. The maximum number of contiguous computers that can be separated by intermediate gateways (routing sparse sources) IP is 9.
-k computer-list routes packets using the computer list specified by computer-list. Contiguous computers cannot be separated by intermediate gateways (routing strict sources) the maximum number allowed by IP is 9.
-w timeout specifies the timeout interval in milliseconds.
Destination-list specifies the remote computer to ping.
-- analyze the reason based on the information returned by ping
1.Request timed out: the other party is powered off; does not have this address; the other party is not in the same network segment as himself; ICMP packet filtering is set (such as firewall setting); IP address is set incorrectly.
2.Destination host Unreachable: the other party is not in the same network segment as himself, and he has not set a default route; the network cable is out of order.
3.Bad IP address: may not be connected to the DNS server; maybe the IP address does not exist.
4.Source quench received: indicates that the other party or the halfway server is busy and unable to respond.
5.Unknown host-- unknown host: there may be a failure of the domain name server, or a failure of the communication line between the network administrator's system and the remote host.
6.No answer-- is not responding: the central host is not working; the local or central host network is not configured correctly; the local or central router is not working; the communication line is faulty; the central host has routing problems.
7.Ping 127.0.0.1 127.0.0.1 is a local circular address-- indicating that the native TCP/IP protocol is not working properly.
8.no rout to host: the network card is not working properly.
9.transmit failed, error code: 10043 Nic driver is not normal.
The 10.unknown host name:DNS is not configured correctly.
2.4 netstat is used to display network status information, such as network connections, routing tables, interface statistics, camouflage connections and multicast members.
It can be used to list all network socket connections on the system, including tcp, udp and unix sockets. It can also list sockets in the listening state (that is, waiting for access requests). (commonly used)
Format: netstat [options] [delay]
-an or-all: displays Socket; @ in all connections
-An or -: list the relevant addresses in the connection of this network type
-c or-continuous: continuously lists the network status; @
-C or-cache: displays the cache information configured by the router
-e or-extend: displays other relevant information about the network; (- I and-e match to output user-friendly information)
-F or-fib: displays FIB
-g or-groups: displays the list of group members of the Multicast function group; @
-h or-help: online help
-I or-interfaces: displays the form of network interface information; @
-l or-listening: displays the Socket; @ of the server under monitoring
-M or-masquerade: shows a camouflaged network connection
-n or-numeric: use the ip address directly, not through the domain name server; @
-N or-netlink or-symbolic: displays the symbolic connection name of the network hardware peripheral
-o or-timers: display timer
-p or-programs: displays the program identifier and program name that are using Socket; @
-r or-route: displays Routing Table kernel routing information; @
-s or-statistice: displays statistical tables of network work information
-t or-tcp: displays the connection status of TCP transport protocol; @
-u or-udp: displays the connection status of the UDP transport protocol
-v or-verbose: displays the instruction execution process
-V or-version: displays version information
-w or-raw: displays the connection status of the RAW transport protocol
-x or-unix: this parameter has the same effect as specifying the "- A unix" parameter
-ip or-inet: this parameter has the same effect as specifying the "- An inet" parameter.
2.5 arp is used to add, delete, and display ARP cache entries
ARP is an important TCP/IP protocol and is used to determine the physical address of the network card corresponding to the IP address.
The output uses "C" for ARP cache content, "M" for permanent table items, and "P" for common table items.
Format: arp [option] [IP address] [MAC address]
Arp: show all table items
-d address: delete an arp entry.
-s address hw_addr: sets an arp entry.
-an output in bsd form. (no fixed columns)
-n displays the ip address in numeric form instead of the default hostname form.
-D specifies not the hardware address but the name of a network interface, and the table entry uses the MAC address of the corresponding interface. It is generally used to set up the ARP proxy.
H type,-hw-type type: specifies to check for specific types of table items. The default type is ether.
-I If,-device If: specify the arp entry on which network interface to set.
-f filename: works like'- s address, but it specifies the binding of the IP address and the MAC address through a file.
The above is about the content of this article on "what are the network configuration files in Linux?" I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.