Linux的ifconfig命令用来设置和查看网卡的设置情况。
设置IP:
ifconfig eth0 192.168.0.1 netmask 255.255.255.0
一个网卡绑定多个IP:
ifconfig eth0:0 192.168.0.253 netmask 255.255.255.0
ifconfig eth0:1 192.168.0.252 netmask 255.255.255.0
......
修改网卡MAC地址:
ifconfig eth0 hwether 00:AA:BB:CC:DD:EE
修改MAC地址需要先关闭网卡设备,设置好后再开启。
网卡开启关闭:
ifconfig eht0 up
ifconfig eth0 down