ubuntu 启动时 设置多个ip 修改mac 网关 。。。
有時(shí)開發(fā)時(shí)要用到多個(gè)ip,還要改mac,在?/etc/network/interfaces這樣寫就可以達(dá)到 設(shè)置多個(gè)ip,改mac的目的
vi /etc/network/interfaces
auto loiface lo inet loopback
auto eth0
#auto eth0 inet dhcp
iface eth0 inet static
hwaddress ether 00:6d:04:60:2f:4a ? ?//設(shè)置mac
address 192.168.0.222 ? ? ? ? ? ? ? ? ? ? ? ? //第一個(gè)ip
netmask 255.255.255.0
gateway 192.168.0.1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第一個(gè)網(wǎng)關(guān)
auto eth0:0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第二個(gè)ip
iface eth0:0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0:1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //第三個(gè)ip
iface eth0:1 inet static
address 10.10.0.2
netmask 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 讓設(shè)置生效
當(dāng)然用命令也是可以改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 //添加一個(gè)ip
route add default gw 192.168.0.1 ? ? ? ? ? ? ? ? ? ? ? ?///添網(wǎng)關(guān)
?
不過用改dns的 命令我還沒發(fā)現(xiàn)。。。。有人發(fā)現(xiàn)可給我說下
總結(jié)
以上是生活随笔為你收集整理的ubuntu 启动时 设置多个ip 修改mac 网关 。。。的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: crosstool-ng 编译交叉工具链
- 下一篇: RT73 wifi无线网卡驱动移植过程