Program ape must know basic Linux Network command

Source: Internet
Author: User
Tags echo message nslookup

in the embedded development, we often use a variety of Linux commands, today and everyone to share is the basic Linux Network command, which is inadvertently seen on the internet in a well-organized article, to share to everyone, I hope to help everyone.
The most important and basic Linux Network command collection that aspiring Linux system administrators and Linux enthusiasts must know. At It's FOSS we are not talking about the "command line aspect" of Linux every day. Basically, I'm more focused on the desktop side of Linux. But some of your readers in-house surveys (It's FOSS newsletter subscribers only) point out that you also want to learn some command-line tricks. The Quick check table is also popular with most readers.
to do this, I edited a list of basic network commands in Linux. It's not a tutorial that teaches you how to use these commands, but rather a collection of commands and their short explanations. So, if you've already used these commands, you can use it to quickly remember commands.
You can add this page as a bookmark for quick reference, or output a PDF version for offline use.
I had this list of Linux network commands when I was a student of communication systems engineering. It helped me get a high score on the computer network course. Hopefully it will help you in the same way.
Linux Basic Network Command list
I use FreeBSD on a computer network course, but these UNIX commands should also work on Linux.
Connectivity of
Ping: Sends an ICMP echo message (a package) to the host. This may continue to be sent until you press CONTROL-C. Ping means that a packet is sent out via ICMP from your machine and echoed in the IP layer. Ping tells you if another host is running.
Telnet[port]: communicates with the host on the specified port. The default Telnet port is 23. Press control-] to exit Telnet. Some of the other commonly used ports are:
7--echo Port
25--SMTP, for sending mail
79--finger (lctt: Wikipedia-Finger protocal, but for example Finger I'm afraid it's inappropriate, why not try 80? ) To provide information about other users under the network.
ARP
ARP is used to convert an IP address to an Ethernet address. The root user can add and remove ARP records. It can be useful to delete ARP records when they are contaminated or wrong. The ARP record that is explicitly added by root is permanent-the proxy setting is also. The ARP table is stored in the kernel and is dynamically manipulated. ARP records are cached and typically expire after 20 minutes and are deleted.
arp-a: Prints the ARP table.
Arp-s[pub]: Adds a record to the table.
Arp-a-D: Deletes all records in the ARP table.
Routing
netstat-r: Prints the routing table. The routing table is stored in the kernel and is used by the IP layer to route packets to non-local networks.
the route add:route command is used to add static (manually specified rather than dynamic) routing paths to the routing table. All traffic from that PC to that ip/subnet goes through the specified gateway IP. It can also be used to set a default route. For example, using 0.0.0.0 at the ip/subnet, you can send all packages to a specific gateway.
routed: BSD daemon that controls dynamic routing. Start up at boot time. It runs the RIP routing protocol. Only the root user is available. You cannot run it without root privileges.
gated:gated is another routing daemon that uses the RIP protocol. It supports both OSPF, EGP, and RIP protocols. Only the root user is available.
traceroute: The route used to track IP packets. It adds 1 hops each time it sends a packet, allowing all gateways from the source address to the destination to return a message.
NETSTAT-RNF inet: Displays the route table for IPV4.
sysctl net.inet.ip.forwarding=1: Enable packet forwarding (turn the host into a router).
Route Add|delete [-net|-host]: (such as route add 192.168.20.0/24 192.168.30.4) add a route.
Route flush: Removes all routes.
Route add-net 0.0.0.0 192.168.10.2: Adds a default route.
routed-pripv2-pno_rdisc-d [-s|-q]: Runs the routed daemon, uses the RIPV2 protocol, does not enable ICMP Autodiscover, runs in the foreground, provisioning mode, or Quiet mode.
route add 224.0.0.0/4 127.0.0.1: Defines a multicast route for the local address. (LCTT: The original is doubtful)
Rtquery-n (LCTT: Added host parameter): Queries the RIP daemon on the specified host (manually updating the routing table).
other
nslookup: Query to DNS server, turn IP to name, or vice versa. For example, Nslookup facebook.com will give Facebook.com IP.
Ftp[port] (lctt: The original water should be a clerical error): Transfer files to the specified host. You can usually log in using the login name "anonymous" and the password "guest".
Rlogin-l (LCTT: Added the host parameter): Log on to the host with a virtual terminal like Telnet.
Important Documents
/etc/hosts: Domain-to-IP-address mapping.
/etc/networks: Network Name-to-IP address mapping.
/etc/protocols: The mapping of the Protocol name to the protocol number.
/ETC/SERVICES:TCP/UDP The mapping of the service name to the port number.
Tools and network performance analysis
ifconfig
[up]: Start interface.
Ifconfig[down|delete]: Stop the interface.
Ethereal &: Open ethereal in the background instead of the foreground.
tcpdump-i-VVV: A tool for crawling and analyzing packages.
netstat-w [seconds]-I [interface]: Displays network settings and statistics.
Udpmt-p [Port]-s [bytes] target_host: Send UDP traffic.
udptarget-p [port]: Receive UDP traffic.
Tcpmt-p [Port]-s [bytes] Target_host: Sends TCP traffic.
tcptarget-p [port]: receives TCP traffic.
Switch
ifconfig sl0 SRCIP dstip: Configure a serial interface (Slattach-l/dev/ttyd0 before performing sysctl net.inet.ip.forwarding=1 thereafter)
telnet 192.168.0.254: Access the switch from a host in the subnet.
sh ru or show running-configuration: View the current configuration.
Configure terminal: Enter configuration mode.
Exit : Exits the current mode. (LCTT: The original is doubtful)
VLAN
VLAN N: Creates a VLAN with an ID of N.
no VLAN N: Delete vlan with ID N.
untagged y: Add port y to VLAN N.
ifconfig vlan0 Create: Creates the Vlan0 interface.
ifconfig vlan0 vlan_id vlandev em0: Add em0 to the Vlan0 interface (LCTT: The original is in doubt) and set the tag as ID.
ifconfig Vlan0 [up]: Enables the virtual interface.
tagged y: Adds tag frame support for Port y of the current VLAN.
udp/tcp
Socklab UDP: Runs Socklab using the UDP protocol.
sock: Creates a UDP socket equivalent to input sock UDP and bind.
SendTo: Sends a packet.
recvfrom: Receives data from a socket.
Socklab TCP: Runs Socklab using the TCP protocol.
Passive: Creates a passive-mode socket equivalent to Socklab,sock tcp,bind,listen.
Accept: Accepts incoming connections (can be performed before or after initiating a connection).
Connect: Equivalent to Socklab,sock tcp,bind,connect.
Close : Closes the connection.
Read : Reads n bytes from the socket.
Write : (for example, write Ciao, write #10) writes "ciao" or 10 bytes to a socket.
nat/Firewall
rm/etc/resolv.conf: Prohibit address resolution to ensure that your filtering and firewall rules work correctly.
ipnat-f file_name: Writes the filter rule to the file.
ipnat-l: Displays the list of rules for the activity.
ipnat-c-F: reinitialization of the Rules table.
map Em0 192.168.1.0/24, 195.221.227.57/32 em0: Map IP addresses to interfaces.
Map em0 192.168.1.0/24-195.221.227.57/32 portmap tcp/udp 20,000:50,000: Mapping with port number.
ipf-f file_name: Writes the filter rule to the file.
Ipf-f-A: Resets the rules table.
ipfstat-i: Lists the active status entries when combined with the-s option (LCTT: The original is in doubt).
I hope this basic Linux Network command collection is useful for you. Welcome to the various questions and suggestions

article source: Linux China

Program ape must know basic Linux Network command

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.