Ifconfig
来自KlniuWiki
1 设置网卡信息
更改网络连接的信息前,都需要关闭网络连接:
sudo ifconfig eth0 down
设置 eth0 的 IP:
sudo ifconfig eth0 192.168.1.99
也可同时设置 IP,广播地址,子网掩码:
sudo ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0
设置网卡 eth0 物理地址即 MAC:
sudo ifconfig eth0 hw ether 04:64:03:00:12:51
其中 hw 后面所接的是网络接口类型, ether表示以太网, 同时也支持 ax25 、ARCnet、netrom等,详情请查看 man ifconfig。 当然这些设置都是可以合并的,比如设置网卡 eth0 的IP地址、网络掩码、广播地址,物理地址并且激活它;
sudo ifconfig eth0 192.168.1.252 hw ether 04:64:03:00:12:51 netmask 255.255.255.0 broadcast 192.168.1.255 up
2 参见
- ifconfig查看、配置IP. XiaoXiaopig. 2010-5-6 13:21:42.