在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 命令的更多相关文章

  1. linux:ifconfig命令

    许多windows非常熟悉ipconfig命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config).通常需 ...

  2. linux ifconfig命令使用详解

    Linux下网卡命名规律:eth0,eth1.第一块以太网卡,第二块.lo为环回接口,它的IP地址固定为127.0.0.1,掩码8位.它代表你的机器本身. 1.ifconfig是查看网卡的信息. if ...

  3. LINUX ifconfig 命令详解

    ifconfig 配置和显示Linux系统网卡的网络参数 补充说明 ifconfig命令 被用于配置和显示Linux内核中网络接口的网络参数.用ifconfig命令配置的网卡信息,在网卡重启后机器重启 ...

  4. Linux ifconfig命令详解

    ifconfig(interfaces config).通常需要以root身份登录或使用sudo来使用ifconfig工具 ifconfig 命令用来查看和配置网络设备.当网络环境发生改变时可通过此命 ...

  5. linux ifconfig命令配置ip地址

    Linux下网卡命名规律:eth0,eth1. 第一块以太网卡.第二块. lo为环回接口,它的IP地址固定为127.0.0.1.掩码8位. 它代表你的机器本身.   ifconfig [Interfa ...

  6. Linux ifconfig 配置网络接口

    Linux ifconfig 可以用来配置网络接口的IP地址.掩码.网关.物理地址等:值得一说的是用Linux ifconfig 为网卡指定IP地址,这只是用来调试网络用的,并不会更改系统关于网卡的配 ...

  7. 【linux】命令-网络相关

    目录 前言 1. ifconfig 1.1 语法 1.2 参数说明 1.3 例程 2. iw 2.1 扫描可用无线网络 2.2 WiFi连接步骤(教程A) 2.2.1 查看可以用无线设备信息 2.2. ...

  8. 使用 python 获取 Linux 的 IP 信息(通过 ifconfig 命令)

    我们可以使用 python 代码通过调用 ifconfig 命令来获取 Linux 主机的 IP 相关信息,包括:网卡名称.MAC地址.IP地址等. 第一种实现方式: #!/usr/bin/pytho ...

  9. 每天一个linux命令(52):ifconfig命令

    许多windows非常熟悉ipconfig命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config).通常需 ...

随机推荐

  1. How do I convert an enum to a list in C#?

    How do I convert an enum to a list in C#? This will return an IEnumerable<SomeEnum> of all the ...

  2. python -u 启动python文件的作用,PYTHONUNBUFFERED环境变量的作用

    python -u 启动python文件的作用是不缓存,直接把输出重定向到文件,比如nohup启动什么的,如果不使用-u启动,那么程序中的print和日志什么的,可能不会非常及时的重定向到out文件, ...

  3. java遇见的问题分析

    下面就一些java的一些基本问题进行解释.其中蓝色部分为handsomecui的主观看法 一.synchronized(obj)里面的参数怎么解释? synchronized的参数代表的是“对象锁”代 ...

  4. Hadoop -- HDFS 读写数据

    一.HDFS读写文件过程 1.读取文件过程 1)       初始化FileSystem,然后客户端(client)用FileSystem的open()函数打开文件 2)       FileSyst ...

  5. error: style attribute '@android:attr/windowEnterAnimation' not found.

    在Project/gradle.properties中添加 android.enableAapt2=false

  6. eclipse无法连接到makertplace

    Eclipse需要安装一个Jcoco的插件,但是连接Eclipse Market的时候,总是出现如下的报错: Cannot open Eclipse Marketplace Cannot instal ...

  7. smartcrop.js 内容感知图像裁剪

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. react-native 搭建环境

    1.安装 nodejs 配置环境变量 node -v npm -v 2.安装 javaSE 1.8以上 http://www.oracle.com/technetwork/java/javase/ar ...

  9. 5:CSS元素类型

    5:CSS元素类型 学习目标 1.元素类型分类依据和元素类型分类 2.元素类型的转换 3.inline-block元素类型的应用 4.置换和非置换元素的概念和应用案例 一.元素类型分类依据和元素类型分 ...

  10. Android编译系统入门(二)

    Android.mk的使用方法 在上一篇Android编译系统入门(一)中我们只要介绍了Android系统使用make命令默认编译的依赖树是droid,而droid是一个伪目标,它有两个先决条件dro ...