文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ifconfig的一些用法

ifconfig的一些用法

时间:2006-01-14  来源:coldrainsunc

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.
相关阅读 更多 +
排行榜 更多 +
哥布林弹球b服手游下载

哥布林弹球b服手游下载

休闲益智 下载
小马样式盒游戏下载

小马样式盒游戏下载

休闲益智 下载
异变小镇中文版下载安装

异变小镇中文版下载安装

冒险解谜 下载