Linux networks: Common commands (i)

Source: Internet
Author: User

1.ifconfig can view the network card status of Linux

Ifconfig eth0 to view eth0 information

Set multiple IP addresses for a network card: Ifconfig eth0:0 192.168.1.12 255.255.255.0

Turn off and turn on the NIC Ifdown eth0 ifup eth0

Turn off all network cards using/etc/init.d/network restart

Set the network card to take effect permanently:

Method 1. In CentOS or Rhel (Rad hat) You can use the Setup tool if it is not installed yum-y instll Setup

Method 2. You can modify the configuration file directly/etc/sysconfig/network-script/ifcfg-eth0

2.netstat Querying network status

netstat [options] Of course netstat-rn-r lists the routing list, with the same functionality as the route command

-t lists TCP protocol Ports-U lists UDP protocol Port-N uses IP address and port number to display-l lists all network links in the Listening state Network service-A


1[Email protected] ~]# netstat-Tuln2 Active Internet connections (only servers)3Proto Recv-q send-Q Local Address Foreign address state4Tcp0      0 0.0.0.0:35086               0.0.0.0:*LISTEN5Tcp0      0 0.0.0.0:111                 0.0.0.0:*LISTEN6Tcp0      0 127.0.0.1:631               0.0.0.0:*LISTEN7Tcp0      0 127.0.0.1: -                0.0.0.0:*LISTEN8Tcp0      0 0.0.0.0:1992                0.0.0.0:*LISTEN9Tcp0      0:::111:::*LISTENTenTcp0      0:::58614:::*LISTEN OneTcp0      0::1:631:::*LISTEN ATcp0      0::1: -:::*LISTEN -Tcp0      0:::1992:::*LISTEN -Udp0      0 0.0.0.0:111                 0.0.0.0:* theUdp0      0 0.0.0.0:631                 0.0.0.0:* -Udp0      0 0.0.0.0:931                 0.0.0.0:* -Udp0      0 0.0.0.0:951                 0.0.0.0:* -Udp0      0 0.0.0.0:37596               0.0.0.0:* +Udp0      0:::111:::* -Udp0      0:::42503:::* +Udp0      0:::931:::*
View Code

NETSTAT-RN Demo

1[Email protected] ~]# netstat-RN2 Kernel IP Routing table3 Destination Gateway genmask Flags MSS Window irtt Iface4 192.168.181.0   0.0.0.0         255.255.255.0U0 0          0eth05 169.254.0.0     0.0.0.0         255.255.0.0U0 0          0eth06 0.0.0.0         192.168.181.1   0.0.0.0Ug0 0          0Eth0
View Code

3.route command to view the list of routes (you can view the gateway)

1[Email protected] ~]# route-N2 Kernel IP Routing table3 Destination Gateway genmask Flags Metric Ref use Iface4 192.168.181.0   0.0.0.0         255.255.255.0U0      0        0eth05 169.254.0.0     0.0.0.0         255.255.0.0U1002   0        0eth06 0.0.0.0         192.168.181.1   0.0.0.0Ug0      0        0Eth0
View Code

4.nslookup Domain Name Resolution command

nslookup [host name or IP]

or run Nslookup directly after you enter the DNS server that server uses to view your current host

This command Windows DOS command line is also common because he is a network protocol command on some network devices is also common for example on Cisco routers

Linux networks: Common commands (i)

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.