# 网络查看

  • 网络状态查看
  • 网络配置
  • 路由命令
  • 网络故障排除
  • 网络服务管理
  • 常用网络配置文件
# net-tools
  1. ifconfig
  2. route
  3. netstat
//查看
ifconfig eth0
1
2
# iproute2
  1. ip
  2. ss

# 网络故障排除

  • ping
  • traceroute
  • mtr
  • nslookup
  • telnet
  • tcpdump
  • netstat
  • ss
//和电脑连接情况
ping www.baidu.com
//和电脑连接路径情况
traceroute -w 1 www.baidu.com
mtr
//域名解析
nslookup www.baidu.com
//端口连接情况
telnet www.baidu.com 80
//抓包
tcpdump -i any -n port 80
tcpdump -i any -n host 10.0.01 and port 80
//端口监听
netstat -ntpl
//端口监听
ss -ntpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

# 网络服务配置

# 管理网络两个命令

Syxv(network)和systemd(NetworkManager)

//当前状态
service network status
//还原初始化状态
service network restart
查看network
chkconfig --list network
关闭
chkconfig --level 2345 network off

//查看
systemctl list-unit-files NetworkManager.service
//开启关闭
systemctl disable NetworkManager
systemctl enable NetworkManager
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 配置文件
  • ifcfg-eth0
  • /etc/host
cd /etc/sysconfig/network-scripts/
ls ifcfg-*


hostname
hostname ymj
hostnamectl set-hostname ymj

1
2
3
4
5
6
7
8