免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1084 | 回复: 0
打印 上一主题 下一主题

ifconfig的一些用法 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-14 09:01 |只看该作者 |倒序浏览
eth0      Link encap:Ethernet  HWaddr 00:58:7C:4C:3D:E1
          inet
addr:211.71.153.6  Bcast:211.71.153.255  Mask:255.255.255.0
          inet6 addr: fe80::258:7cff:fe4c:3de1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3863 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2138 errors:0 dropped:0 overruns:0 carrier:0
          collisions:345 txqueuelen:1000
          RX bytes:1687039 (1.6 MiB)  TX bytes:281320 (274.7 KiB)
          Interrupt:11 Base address:0xd000
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1967 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1967 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1965512 (1.8 MiB)  TX bytes:1965512 (1.8 MiB)
ifconfig工具用于在linux内核中配置网络接口。这个命令是在系统启动的时候供系统的启动脚本使用,也可以手动配置网络。以下介绍一下输出中的各个字段的含义。
Link encap:使用的网络类型,包括:PPP或以太网,lo是自环网络设备的名称(loopback)
HWaddr:NIC的硬件地址
Inet addr:分配给网络接口的IP地址,后面跟广播地址和子网掩码。
网络接口状态标志位:UP表示下在使用的网络接口,BROADCAST和MULTICAST表示支持该种IPk kkHWaddr:NIC的硬件地址
Inet addr:分配给网络接口的IP地址,后面跟广播地址和子网掩码。
网络接口状态标志位:UP表示正在使用的网络接口,BROADCAST和MULTICAST表示支持该IP地址寻址,LOOPPACK表示设备只用于内部。
RX和TX表示接口上各自收到和传输的数据包个数。第一个数字是总数。
停止,启动和重启以太网接口:
ifconfig eth0 down
ifconfig eth0 up
ifconfig eth0 restart
ifconfig的语法:
ifconfig device ip_address netmask netmask_info broadcast bd_info
例:
ifconfig eth0 211.71.153.6 netmask 255.255.255.0 broadcast 211.71.153.255
更改网卡的MAC地址:
ifdown eth0
ifconfig eth0 hw ether 00:58:7c:4c:3d:e2
ifup eth0
man文档:
hw class address
            
Set the hardware address of this interface, if the device driver
supports this operation.  The  key-
            
word  must  be  followed by the name of the hardware
class and the printable ASCII equivalent of the
            
hardware address.  Hardware classes currently supported include
ether (Ethernet), ax25 (AMPR AX.25),
              ARCnet and netrom (AMPR NET/ROM).
当系统重启以后,需要重新更改地址,所以,你可以将上面的内容写到/etc/rc.local中
将网卡设为混杂混模式:
ifconfig eth0 promisc
man文档中有这一段:
[-]promisc
            
Enable  or  disable  the promiscuous mode of the
interface.  If selected, all packets on the network
              will be received by the interface.
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/8860/showart_67791.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP