Linux common commands - network terminal settings

1. Add yourself (sa) to the sudoers configuration file for easy access

vim /etc/ sudoers edit file (some centOS versions do not have vim command, just use vi)  
  
Find the [root ALL = (ALL) ALL] statement and add it below:  
sa ALL=(ALL) ALL  
  
Special note: The sudo command can only be used after sa is added to the sudoers configuration file.

2. Internet

ifconfig View the network status to see how many network cards this server can put at most, such as eth0, eth1, eth2...
ifup eth0 activate the network card (eth0 represents the first network card) This is a shorthand, if it does not work, you can use the following instead

 ifconfig eth0 down stop the network card eth0

 ifconfig eth0 up start the network card eth0

   

sudo ifup eth0 Use the sudo command to temporarily have administrator privileges to activate the network card  

  Check if there is a network card connected: ethtool eth0; eth0 is the name of the network card. When the Link detecte in the following information is yes, it means that the network card is connected, and Speed ​​indicates the speed of the network card.

[root@lingdian03 /]# ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: Yes
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: no

3、ping

Ping www.baidu.com to check whether the network is smooth, ping both domain name and ip  
Ctrl + C key combination terminates most commands (can be used to exit the ping state)  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325169907&siteId=291194637