In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will take you to understand what network commands are commonly used in the Linux system. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about "what are the common network commands in the Linux system?"
1. Network configuration 1.1 ip functions the ip command is used to configure the network, which is powerful enough to completely replace ifconfig,netstat,route,arp and so on.
Common option
Objects: the names of all objects can be written in full or abbreviated form, for example, address can be abbreviated to addr or just a.
Link network equipment
Protocol (IP or IPv6) address on address Devic
Label configuration for addrlabel protocol address selection
Neighbour ARP or NDISC cache entry
Route routing table entry
Rules in rule routing Policy Database
Maddress Multicast address
Mroute Multicast routing Cache entry
Tunnel IP tunnel
Xfrm IPSec protocol framework
Option
-VMagneWhile version displays instruction version information
-smam quotient stats statistics output details
-rmaine copyright uses the system name resolver to print the DNS name instead of the host address
Human readable output statistics and suffixes for human readability
-fmam house family FAMILY specifies the protocol family to be used. The protocol family identity can be one of inet, inet6, ipx, dnet, or link. If this option does not exist, the protocol family is inferred from other parameters. If the rest of the command line does not provide enough information to speculate about the family, ip returns to the default value, usually inet or any. Link is a special series identifier that indicates that no network protocol is involved
-4-A shortcut to family inet
-6-A shortcut to family inet6
-0-A shortcut to family link
Each record is output to one line, replacing the newline character with the'\ 'character
Example usage: set the ip address and view the ip address:
View routing tabl
View the source of the routing packet for the specified ip address (the native ip I entered in this example):
Change default route: sudo ip route add default via default route
Display network statistics:
View the MAC address of the LAN device:
Address Resolution Protocol (ARP) is used to translate an IP address into its corresponding physical address, commonly known as MAC address.
View netlink messages:
The monitor option allows you to view the status of network devices. For example, a computer in the local area network can be classified as REACHABLE or STALE according to its status.
Activate and stop network devices:
1.2 ifconfig function ifconfig is a network card configuration tool (configure a network interface), which can be used to view network card information (IP address, number of packets sent, number of packets accepted, number of packets lost, etc.) and configure network card (enable / disable network card, modify network mtu, modify IP address, etc.).
Common option
Up starts the specified network device / network card
Down closes the specified network device / network card. This parameter can effectively block IP traffic through a specified interface. If we want to permanently shut down an interface, we also need to delete all routing information for that interface from the core routing table.
Arp setting specifies whether the network card supports 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
Configure the largest transmission unit of the network card
Mtu sets the maximum transmission unit (bytes) of the network card
Netmask sets the subnet mask of the network card. The mask can be a 32-bit hexadecimal number with the prefix 0x or four decimal digits separated by dots. If you are not going to divide the network into subnets, you can ignore this option; if you are using subnets, keep in mind that every system in the network must have the same subnet mask.
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
Use examples to view the status of network interfaces
The first line: ens33 represents the first network card, UP (represents the network card's open status), RUNNING (the network cable representing the network card is connected), MULTICAST (supports multicast) MTU:1500 (maximum transmission unit): 1500 bytes
The second line: the IP address, subnet mask, and broadcast address of the network card (an address dedicated to sending to all workstations in the network (usually the same subnet) at the same time. The IP address of this network card is 192.168.93.132, the subnet mask is 255.255.255.0, and the broadcast address is 192.168.93.255.
Third line: IPv6 address
The fourth line: ether represents the physical address of the network card. You can see that the current physical address (MAC address) of this network card is 00Rom 0cRV 29Rd 3eRose b9RO 3eMadtxqueuelen is the length of the transmission buffer; the connection type is Ethernet
Line 5-8: statistics of receiving and sending packets
Lo is the bad address of the host, which is generally used to test a network program, but does not want users of the local area network or external network to view it, so it can only run and view the network interface used on this host. For example, assign the HTTPD server to the bad address and type 127.0.0.1 in the browser to see your WEB site. But only you can see, other hosts or users of the local area network do not know. Line 1: statistics of receiving and sending packets
Turn off / turn on the network card:
Sudo ifconfig ens33 down sudo ifconfig ens33 up 122. Connectivity Test 2.1The ping function is used for network connectivity and speed testing.
Common parameters
For example, by default, this command will send ICMP packets until the user terminates manually. You can use the-c command to specify the number of packets to send, and use-W to specify the maximum waiting time. If there are multiple network cards, you can also specify the network card to send the packet through-I. Pressing ctrl+ during ping will print out the current summary information and count the number of packets currently sent, the number of packets received, packet loss rate, and so on.
2.2 traceroute functions as the traceroute command to trace the routing path of network packets.
There are many common options, which you can check for yourself when you use them.
Common option
-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.
Usage example packet routing path for native connection to qq website:
3. Network connections 3.1 netstat functions to view all currently established network connections.
Common option
Examples of usage
3.2 nc functions as nc (netcat), a powerful network tool that can be used as a debug analysis of network applications to create different types of network connections. There are many functions, such as implementing simple chat tools, simulating ssh login to remote hosts, remote file transfer, port scanning and so on.
Common option
For example, scan port 192.168.0.1 for port 1168.0.1:
Nc-zv 192.168.0.1 1-100 1
4. Traffic Statistics iftop functions as a tool for viewing network traffic (display bandwidth usage on an interface by host).
Common option
Usage examples use the sudo iftop command directly:
Thank you for your reading, the above is "what are the common network commands in the Linux system" all the content, learn friends to hurry up to operate it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
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.