ifconfigifconfig 是一个用来查看、配置、启用或禁用网络接口的工具,这个工具极为常用的。可以用这个工具来临时性的配置网卡的IP地址、掩码、广播地址、网关等。也可以把 它写入一个文件中(比如/etc/rc.d/rc.local),这样系统引导后,会读取这个文件,为网卡设置IP地址最后更新 2013-05-10 10:16:55 合作编辑者如下:张映
有误,我来改正
(0)
正确
(0)
收藏
(0)
例1
最后更新 2013-05-10 10:16:55 - 合作编辑者如下:张映[root@localhost ~]# ifconfig #处于激活状态的网络接口 [root@localhost ~]# ifconfig -a #所有配置的网络接口,不论其是否激活 [root@localhost ~]# ifconfig eth0 #显示eth0的网卡信息 [root@localhost ~]# ifconfig eth0 down #关闭eth0网卡 [root@localhost ~]# ifconfig eth0 up #开启eth0网卡 [root@localhost ~]# ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 #为网卡添加IPv6地址 [root@localhost ~]# ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 #为网卡删除IPv6地址 [root@localhost ~]# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE #修改MAC地址 [root@localhost ~]# ifconfig eth0 192.168.1.56 #给eth0网卡配置IP地址 [root@localhost ~]# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 #给eth0网卡配置IP地址,并加上子掩码 [root@localhost ~]# ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255 #给eth0网卡配置IP地址,加上子掩码,加上个广播地址 [root@localhost ~]# ifconfig eth0 mtu 1500 #设置能通过的最大数据包大小为 1500 bytes [root@localhost ~]# ifconfig eth0 arp #开启arp功能 [root@localhost ~]# ifconfig eth0 -arp #关闭arp功能 |
|