Linux ifconfig 命令
在centos6 自带ifconfig
在centos7 默认不带ifconfig,需要自己安装
ifconfig命令用来配置或查看网卡接口,常见用法如下:
安装ifconfig命令
[root@mysql ~]# yum install net-tools -y
查看所有网卡的信息
ifconfig (不包括down状态的网卡)
[root@mysql ~]# ifconfig
eth0: flags=<UP,BROADCAST,RUNNING,MULTICAST> mtu
inet 192.168.0.111 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::8c18:4c0c:35b:f89c prefixlen scopeid 0x20<link>
ether :0c::bf:7a:4b txqueuelen (Ethernet)
RX packets bytes (42.1 KiB)
RX errors dropped overruns frame
TX packets bytes (24.4 KiB)
TX errors dropped overruns carrier collisions lo: flags=<UP,LOOPBACK,RUNNING> mtu
inet 127.0.0.1 netmask 255.0.0.0
inet6 :: prefixlen scopeid 0x10<host>
loop txqueuelen (Local Loopback)
RX packets bytes (0.0 B)
RX errors dropped overruns frame
TX packets bytes (0.0 B)
TX errors dropped overruns carrier collisions
[root@mysql ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.111 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::8c18:4c0c:35b:f89c prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:bf:7a:4b txqueuelen 1000 (Ethernet)
RX packets 396 bytes 43132 (42.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 189 bytes 25028 (24.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 # eth0:网卡名称
# Link encap:网卡的接口类型,这里是以太网
# HWaddr:网卡的硬件地址,俗称的MAC地址
# inet addr:IPv4地址,如果是IPv6会写成inet6 addr
# Bcast:广播地址
# Mask:子网掩码
# UP:表示网卡是开启状态
# BROADCAST:表示网卡支持广播
# RUNNING:表示网卡的网线已经被接上
# MULTICAST:表示网卡支持组播
# MTU:网络最大传输单元
# Metric:到达网关的度量值,参考:http://m.chinabyte.com/network/191/12287691_gfh.shtml
# RX packets:网络从启动到现在为止接收的数据包大小,单位是字节,error 发生错误的数据包,dropped 被丢弃的数据包
# TX packets:网络从启动到现在为止发送的数据包大小,单位是字节,error 发生错误的数据包,dropped 被丢弃的数据包
# collisions:发生碰撞的数据包,如果发生太多次,表明网络状况不太好
# txqueuelen:传输数据的缓冲区的储存长度
# RX bytes:总接收字节总量
# TX bytes:总发送字节总量
# Memory:网卡硬件的内存地址
[root@mysql ~]# ifconfig -a // 查看所有网卡的信息(包括down状态的网卡 [root@mysql ~]# ifconfig eth0 // 查看指定网卡的信息 [root@mysql ~]# ifconfig eth0 up // 启用指定的网卡,等同于:ifup eth0 [root@mysql ~]# ifconfig eth0 down // 关闭指定的网卡,等同于:ifdown eth0 [root@mysql ~]# ifconfig eth0 arp // 开启网卡的ARP协议
[root@mysql ~]# ifconfig eth0 -arp // 关闭网卡的ARP协议 [root@mysql ~]# ifconfig eth0 192.168.0.100 // 设置/修改网卡的IP地址(临时生效)
[root@mysql ~]# ifconfig eth0 192.168.0.100/ // 设置/修改网卡的IP地址和子网掩码(临时生效)
[root@mysql ~]# ifconfig eth0 192.168.0.100 netmask 255.255.255.0 // 设置/修改网卡的IP地址和子网掩码(临时生效)
[root@mysql ~]# ifconfig eth0 192.168.0.100 hw ether ::::: // 设置/修改网卡的IP地址和MAC地址(临时生效),ether(以太网)表示网卡的接口类型
[root@mysql ~]# ifconfig eth0 mtu // 设置/修改网卡的最大传输单元(临时生效) [root@mysql ~]# ifconfig eth0: 192.168.0.50/ // 给网卡配置虚拟接口,相当于给网卡再配置一个IP地址(临时生效)
[root@mysql ~]# ifconfig eth0: 192.168.0.51/ // 给网卡配置虚拟接口,相当于给网卡再配置一个IP地址(临时生效)
[root@mysql ~]# ifconfig eth0: 192.168.0.52/ // 给网卡配置虚拟接口,相当于给网卡再配置一个IP地址(临时生效
Linux ifconfig 命令的更多相关文章
- linux:ifconfig命令
许多windows非常熟悉ipconfig命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config).通常需 ...
- linux ifconfig命令使用详解
Linux下网卡命名规律:eth0,eth1.第一块以太网卡,第二块.lo为环回接口,它的IP地址固定为127.0.0.1,掩码8位.它代表你的机器本身. 1.ifconfig是查看网卡的信息. if ...
- LINUX ifconfig 命令详解
ifconfig 配置和显示Linux系统网卡的网络参数 补充说明 ifconfig命令 被用于配置和显示Linux内核中网络接口的网络参数.用ifconfig命令配置的网卡信息,在网卡重启后机器重启 ...
- Linux ifconfig命令详解
ifconfig(interfaces config).通常需要以root身份登录或使用sudo来使用ifconfig工具 ifconfig 命令用来查看和配置网络设备.当网络环境发生改变时可通过此命 ...
- linux ifconfig命令配置ip地址
Linux下网卡命名规律:eth0,eth1. 第一块以太网卡.第二块. lo为环回接口,它的IP地址固定为127.0.0.1.掩码8位. 它代表你的机器本身. ifconfig [Interfa ...
- Linux ifconfig 配置网络接口
Linux ifconfig 可以用来配置网络接口的IP地址.掩码.网关.物理地址等:值得一说的是用Linux ifconfig 为网卡指定IP地址,这只是用来调试网络用的,并不会更改系统关于网卡的配 ...
- 【linux】命令-网络相关
目录 前言 1. ifconfig 1.1 语法 1.2 参数说明 1.3 例程 2. iw 2.1 扫描可用无线网络 2.2 WiFi连接步骤(教程A) 2.2.1 查看可以用无线设备信息 2.2. ...
- 使用 python 获取 Linux 的 IP 信息(通过 ifconfig 命令)
我们可以使用 python 代码通过调用 ifconfig 命令来获取 Linux 主机的 IP 相关信息,包括:网卡名称.MAC地址.IP地址等. 第一种实现方式: #!/usr/bin/pytho ...
- 每天一个linux命令(52):ifconfig命令
许多windows非常熟悉ipconfig命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config).通常需 ...
随机推荐
- Ubuntu安装redis缓存数据库
参考:http://blog.csdn.net/xiangwanpeng/article/details/54586087 1.在下载目录下 sudo wget http://download.red ...
- SSM框架整合搭建教程
自己配置了一个SSM框架,打算做个小网站,这里把SSM的配置流程详细的写了出来,方便很少接触这个框架的朋友使用,文中各个资源均免费提供! 一. 创建web项目(eclipse) File-->n ...
- c __cplusplus详解
Code:#ifdef __cplusplusextern "C" { #endif ... #ifdef __cplusplus} #endif 解释:1.c++中定义了__cp ...
- java.util.Queue(队列)的简单使用
import java.util.LinkedList; import java.util.Queue; import org.junit.Before; import org.junit.Test; ...
- U3D常用题
最先执行的方法是:1.(激活时的初始化代码)Awake,2.Start.3.Update[FixUpdate.LateUpdate].4.(渲染模块)OnGUI.5.再向后,就是卸载模块(TearDo ...
- nginx的80端口跳转到443
然后在80端口设置http跳转到https 在80端口location中加入rewrite ^(.*)$ https://$host$1 permanent; 如图,然后输入命令service ngi ...
- C++文件流操作
#include <iostream> #include <fstream> #include<iostream> using namespace std; int ...
- Flask web开发之路十三
g对象 ### 保存全局变量的g属性:g:global1. g对象是专门用来保存用户的数据的.2. g对象在一次请求中的所有的代码的地方,都是可以使用的. 项目结构: g_demo.py文件代码: f ...
- lxml基础
节点操作: from lxml import etree # 1.创建Element对象,参数即节点名称 root = etree.Element('root') print(root) # < ...
- php字符串操作
1.字符串的格式化 按照从表单提交数据之后,php处理的不同:接受,显示,存储.也有三种类型的格式化方法. 1.1字符串的接收之后的整理: trim(),ltrim(),rtrim() 当数据从表单中 ...