Linux常用命令--网终设置

1、把自己(sa)添加到sudoers配置文件中,以便于获取权限

vim /etc/sudoers  编辑文件(部分centOS版本没有vim命令,则用vi即可)  
  
找到【root ALL=(ALL) ALL】语句,在下面添加:  
sa ALL=(ALL) ALL  
  
特别说明:sa添加到sudoers配置文件中后,才可以使用sudo命令。 

2、联网

ifconfig        查看网络状态  查看这个服务器最多可放多少网卡,如 eth0,eth1,eth2...
ifup eth0       激活网卡(eth0代表第一张网卡)  这是简写 ,如果没有效果可以改用 下面

 ifconfig eth0 down 停下网卡 eth0

 ifconfig eth0 up 启动网卡eth0

   

sudo ifup eth0  使用sudo命令,让自己暂时拥有管理员权限,来激活网卡  

  查看是否有网卡接通: ethtool    eth0; eth0是网卡的名字,当下面显示信息中Link detecte为 yes时说明这个网卡接通了,Speed 表示网卡的速度

[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   检查网络是否通畅,ping 域名 和 ip都行  
Ctrl+C组合键          终止大部分命令运行(可以用来退出ping状态)  

猜你喜欢

转载自www.cnblogs.com/flxy-1028/p/8980432.html