码迷,mamicode.com
首页 > 系统相关 > 详细

ifconfig命令--Linux命令应用大词典729个命令解读

时间:2016-11-13 20:14:26      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:命令   linux   rhel   

内容来源于人民邮电出版社《Linux命令应用大词典》

讲述729个命令,1935个例子

学习Linux系统的参考书、案头书,遇到不懂的命令或命令选项一查即可

争取每天都发布内容


ifconfig命令

使用ifconfig命令可以显示和配置网络接口,比如设置IP地址、MAC地址、激活或关闭网络接口。

命令语法:

ifconfig [接口] [选项| IP地址]

命令中各选项的含义如表所示。

                                   ifconfig命令选项含义

选项

含义

-a

显示所有网络接口的状态

add <地址>

设置网络设备的IPv6地址

del <地址>

删除网络设备的IPv6地址

media<类型>

设置网络设备的媒介类型

metric <数目>

指定在计算数据包的转送次数时,所要加上的数目

mtu <字节>

设置网络设备的最大传输单元(MTU

netmask <子网掩码>

设置网络设备的子网掩码

up

激活指定的网络设备

down

关闭指定的网络设备

hw <类型> <硬件地址 >

设置这个接口的硬件地址(MAC地址)。目前支持的硬件类型包括etherEthernet)、ax25 AMPR AX.25)、ARCnetnetrom AMPR NET/ROM

txqueuelen <长度>

设置设备发送队列的长度

tunnel<地址>

创建IPv4IPv6之间的隧道通信地址

 

例:配置网卡eth0IP地址,同时激活该设备。

[root@rhel ~]#ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up

例:配置网卡eth0的别名设备eth0:1IP地址。

[root@rhel ~]# ifconfig eth0:1 192.168.0.3

例:激活网卡eth0:1设备。

[root@rhel ~]# ifconfig eth0:1 up  

例:查看网卡eth0设置的配置。

[root@rhel~]# ifconfig eth0

eth0      Link encap:Ethernet  HWaddr 00:0C:29:FC:2F:E5

          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fefc:2fe5/64Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

          RX packets:11833 errors:0 dropped:0overruns:0 frame:0

          TX packets:14789 errors:0 dropped:0overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:953120 (930.7 KiB)  TX bytes:12258316 (11.6 MiB)

//eth0网卡的IP地址是192.168.0.2MAC地址是00:0C:29:FC:2F:E5

例:查看所有的网卡设备。

[root@rhel~]# ifconfig -a

例:关闭网卡eth0:1设备。

[root@rhel ~]# ifconfig eth0:1 down

    例:更改网卡eth0的硬件MAC地址为00:0C:29:18:2E:3D

[root@rhel ~]# ifconfig eth0 hw ether 00:0C:29:18:2E:3D

 


本文出自 “airfish2000” 博客,请务必保留此出处http://airfish2000.blog.51cto.com/10829608/1872272

ifconfig命令--Linux命令应用大词典729个命令解读

标签:命令   linux   rhel   

原文地址:http://airfish2000.blog.51cto.com/10829608/1872272

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!