Linux Basic Network Command list

Source: Internet
Author: User
Tags echo message nslookup

Linux Basic Network Command list

Organize the list of common network commands under Linux for quick access.

Connectivity of

Ping

Telnet

7--echo Port

25--SMTP, for sending mail

79--finger provides information about other users on 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 <ip_address> <mac_address> [pub]: Add 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] <destination> <gateway>: (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.

Rtquery-n

Other

Nslookup: Query to DNS server, turn IP to name, or vice versa. For example, Nslookup facebook.com will give Facebook.com IP.

FTP

Rlogin-l

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 <interface> <address> [up]: Start interface.

Ifconfig <interface> [Down|delete]: Stop 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.

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 and set the tag to 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 <socket id>

Recvfrom <socket id> <byte #>: Receives data from the 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

Close: Closes the connection.

Read <byte #>: 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: List Active status entries when combined with-s option

Linux Basic Network Command list

Related Article

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.