ifconfig命令被用于配置和显示Linux内核中网络接口的网络参数。用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在。要想将上述的配置信息永远的存的电脑里,那就要修改网卡的配置文件了。
eth0 :表示第一块网卡,
HWaddr :网卡的物理地址 00:0C:29:53:4F:1A,
inet addr :网卡的IP地址 192.168.168.168,
Bcast :广播地址 192.168.168.255,
Mask :子网掩码 255.255.255.0,
lo是主机的回环地址,这个一般是用来测试一个网络程序,但又不想让局域网或外网的用户能够查看,只能在此台主机上运行和查看所用的网络接口。比如把 httpd服务器的指定到回环地址,在浏览器输入127.0.0.1就能看到你所架WEB网站了。但只是您能看得到,局域网的其它主机或用户无从知道。
第一行:连接类型:Ethernet(以太网) HWaddr(硬件mac地址)。
第二行:网卡的IP地址、广播地址、子网掩码。
第三行:UP(代表网卡开启状态)RUNNING(代表网卡的网线被接上)MULTICAST(支持组播)MTU:1500(最大传输单元):1500字节。
第四、五行:接收、发送数据包情况统计。
第七行:接收、发送数据字节数统计信息。
启动网卡eth0:[[email protected] ~]# ifconfig eth0 up
关闭网卡eth0:[[email protected] ~]# ifconfig eth0 down
为网卡eth0配置IPv6地址:[[email protected] ~]# ifconfig eth0 add 33ffe:3240:800:1005::2/64
为网卡eth0删除IPv6地址:[[email protected] ~]# ifconfig eth0 del 33ffe:3240:800:1005::2/64
用ifconfig修改MAC地址:[[email protected] ~]# ifconfig eth0 hw ether 00:AA:BB:CC:dd:EE
配置IP地址:[[email protected] ~]# ifconfig eth0 192.168.2.10[[email protected] ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0[[email protected] ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255
开启网卡eth0 的arp协议:[[email protected] ~]# ifconfig eth0 arp
关闭网卡eth0 的arp协议:[[email protected] ~]# ifconfig eth0 -arp
设置最大传输单元能通过的最大数据包大小为 1500 bytes:[[email protected] ~]# ifconfig eth0 mtu 1500