linux网络管理/

linux网络管理

一、查看网络配置
1.)ifconfig 查看网卡信息

hao@hao-Satellite-M50-A:~$ ifconfig
enp2s0 Link encap:以太网 硬件地址 20:1a:06:d7:47:13
inet 地址:192.168.1.40 广播:192.168.1.255 掩码:255.255.255.0
inet6 地址: fe80::74f1:b52f:3011:61b8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:382718 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:190834 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:477076296 (477.0 MB) 发送字节:16505312 (16.5 MB)

lo Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 跃点数:1
接收数据包:1771 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1771 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1
接收字节:268223 (268.2 KB) 发送字节:268223 (268.2 KB)

2.)sudo ifconfig eth0 dowm 关闭网卡

hao@hao-Satellite-M50-A:~$ sudo ifconfig enp2s0 down
hao@hao-Satellite-M50-A:~$ ifconfig
lo Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 跃点数:1
接收数据包:1833 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1833 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1
接收字节:273421 (273.4 KB) 发送字节:273421 (273.4 KB)

3.)sudo ifconfig eth0 up 开启网卡
4.)给网卡设置动态临时IP(换言之重启之后就失效了)
sudo ifconfig eth0 192.168.1.123

hao@hao-Satellite-M50-A:~$ sudo ifconfig enp2s0 192.168.1.123
hao@hao-Satellite-M50-A:~$ ifconfig
enp2s0 Link encap:以太网 硬件地址 20:1a:06:d7:47:13
inet 地址:192.168.1.123 广播:192.168.1.255 掩码:255.255.255.0
inet6 地址: fe80::74f1:b52f:3011:61b8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:385269 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:191572 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:477292244 (477.2 MB) 发送字节:16567417 (16.5 MB)


lo Link encap:本地环回
inet 地址:127.0.0.1 掩码:255.0.0.0
inet6 地址: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 跃点数:1
接收数据包:2249 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:2249 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1
接收字节:302257 (302.2 KB) 发送字节:302257 (302.2 KB)

二、ping网络

ping IP地址  ping来测试网络是否通了

三、netstat 显示网络连接、路由表和网络接口信息,可以让用户得知目前都有哪些网络连接正在运

-a 显示所有socket,包括正在监听的。
-c 每隔1秒就重新显示一遍,直到用户中断它。
-i 显示所有网络接口的信息,格式同“ifconfig -e”。
-n 以网络IP地址代替名称,显示出网络连接情形。
-r 显示核心路由表,格式同“route -e”。
-t 显示TCP协议的连接情况。
-u 显示UDP协议的连接情况。
-v 显示正在进行的工作。

四、nslookup显示域名对应的IP地址

hao@hao-Satellite-M50-A:~$ nslookup
> baidu.com
Server: 127.0.1.1
Address: 127.0.1.1#53

Non-authoritative answer:
Name: baidu.com
Address: 220.181.57.217
Name: baidu.com
Address: 111.13.101.208
Name: baidu.com
Address: 180.149.132.47
Name: baidu.com
Address: 123.125.114.144

五、finger 用户名    查看用户登录了多长时间等登录信息

hao@hao-Satellite-M50-A:~$ finger hao
Login: hao Name: hao
Directory: /home/hao Shell: /bin/bash
On since Wed Oct 12 15:40 (CST) on tty7 from :0
2 hours 32 minutes idle
No mail.
No Plan.

 

posted @ 2016-10-12 18:18  上了发条的兔子  阅读(350)  评论(0编辑  收藏  举报