2024年4月28日发(作者:)

ifconfig 命令有以下两种格式:

※ifconfig [interface]

※ifconfig interface [aftype] option | address …

ifconfig 的第一种格式(或使用不带任何参数的ifconfig 命令)可以用来查看当前系统的网络配置

情况。

在刚刚安装完系统之后,实际上是在没有网卡或者网络连接的情况下使用Linux,但通过ifconfig 可

以使用回绕方式工作,使计算机认为自己工作在网络上。

硬件的MAC 地址52:54:AB:DD:6F:61,MAC 地址是生产厂家定的,每个网卡拥有的唯一地址。

不过我们可以手工改动网卡的MAC 地址,只要我们在/etc/rc.d/init.d/中的network 中加入:

ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx

eth0,eth1,eth2,代表网卡一,网卡二,网卡三

hw 代表hardware 硬件意思

ether 代表ethernet 以太网的意思

然后重启,此时再用ifconfig 命令查看一下,我们就会发现网卡的MAC 地址已经变成xx:xx:xx:x

x:xx:xx了。

直接通过setup—>network 进行设置。

ifconfig eth1 //设置设备1

ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //设置网卡子网及ip

man ifconfig 或 ifconfig --help 命令:查看帮助

down 关闭指定的网络设备。

up 启动指定的网络设备。

-arp 打开或关闭指定接口上使用的ARP协议。前面加上一个负号用于关闭该选项。

-allmuti 关闭或启动指定接口的无区别模式。前面加上一个负号用于关闭该选项。

-promisc 关闭或启动指定网络设备的promiscuous模式。前面加上一个负号用于关闭该选项。

add<地址> 设置网络设备IPv6的IP地址。

del<地址> 删除网络设备IPv6的IP地址。

1、ifconfig可以直接设置ip地址。

格式如下:

ifconfig 网卡名 ip地址 netmask 子网掩码