有时开发时要用到多个ip,还要改mac,在 /etc/network/interfaces这样写就可以达到 设置多个ip,改mac的目的
vi /etc/network/interfaces
auto lonetmask 255.255.255.0
gateway 10.10.0.1
dns-nameserever 8.8.4.4 //dns
dns-nameserver 192.168.0.1
改后sudo /etc/init.d/networking restart 让设置生效
当然用命令也是可以改ip,mac的
改mac地址
ifconfig eth0 down
ifconfig eth0 hw ether 00:aa:bb:cc:dd:ee
ifconfig eth0 up
ifconfig eth0 192.168.0.22 netmask 255.255.255.0 //改ip
ifconfig eth0:0 192.168.1.22 netmask 255.255.255.0 //添加一个ip
route add default gw 192.168.0.1 ///添网关
不过用改dns的 命令我还没发现。。。。有人发现可给我说下