ubuntu 启动时 设置多个ip 修改mac 网关 。。。
2011-11-29 09:58
686 查看
有时开发时要用到多个ip,还要改mac,在 /etc/network/interfaces这样写就可以达到 设置多个ip,改mac的目的
vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
#auto eth0 inet dhcp
iface eth0 inet static
hwaddress ether 00:6d:04:60:2f:4a //设置mac
address 192.168.0.222 //第一个ip
netmask 255.255.255.0
gateway 192.168.0.1 //第一个网关
auto eth0:0 //第二个ip
iface eth0:0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0:1 //第三个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 让设置生效
当然用命令也是可以改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的 命令我还没发现。。。。有人发现可给我说下
vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
#auto eth0 inet dhcp
iface eth0 inet static
hwaddress ether 00:6d:04:60:2f:4a //设置mac
address 192.168.0.222 //第一个ip
netmask 255.255.255.0
gateway 192.168.0.1 //第一个网关
auto eth0:0 //第二个ip
iface eth0:0 inet static
address 192.168.1.222
netmask 255.255.255.0
gateway 192.168.1.1
auto eth0:1 //第三个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 让设置生效
当然用命令也是可以改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的 命令我还没发现。。。。有人发现可给我说下
相关文章推荐
- Ubuntu 16.04修改MAC地址以及网络常用设置(IP/DNS/网关)
- CentOS和Ubuntu设置或修改网络配置(IP&网关&DNS)
- ubuntu 修改ssh远程主机名称,mac开机运行命令,静默方式启动virtual box虚拟机,静默执行run脚本
- Ubuntu命令设置ip网关dns
- Linux系列:Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)
- Ubuntu_修改MAC并设置DNS域名服务器IP地址及静态IP地址
- linux设置网关修改ip
- Linux CentOS修改网卡IP/网关设置
- ubuntu 设置IP,设置网关
- CentOS 设置网络(修改IP&修改网关&修改DNS)
- ubuntu 命令修改IP和网关
- 解决ubuntu下修改my.cnf设置字符集导致mysql无法启动
- linux设置网关修改ip
- ubuntu 设置IP,设置网关
- Ubuntu 16.04通过网络配置工具NetworkManager设置IP、网关、DNS和查看IP、网关、DNS
- 设置ubuntu ip网关DNS等等一切
- linux设置网关修改ip
- 使用Python脚本自动修改Windows的IP、网关和DNS设置
- ubuntu 设置IP,设置网关方法分享
- Ubuntu虚拟机设置固定IP上网(配置IP、网关、DNS、防止resolv.conf被重写)