网络相关配置

网络相关配置

ping:
作用:通常用于检测网络设备的连通性
格式:ping IP/域名
选项:-c 指定方式测试数据包的次数

ifconfig
作用:查看或设置网卡信息
实例:
ifconfig: 查看活动网卡信息
ifconfig eth0 down: 关闭网卡 等价于ifdown eth0
ifconfig eth0 up:开启网卡 等价于ifup eth0
服务
/etc/init.d/network start|stop|restart 开启|关闭|重启 网络服务
service network start|stop|restart 开启|关闭|重启 网络服务

网卡配置文件: /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=
...

添加域名服务器(DNS)地址: /etc/resolv.conf
8.8.8.8
114.114.114.114

添加本地域名解析服务 /etc/hosts
127.0.0.1 www.baidu.com

原文地址:https://www.cnblogs.com/weizaiyes/p/9177892.html