Ubuntu 16.04修改MAC地址以及网络常用设置(IP/DNS/网关)

1、先停止桌面版自带的NetworkManager,这东西很难用,且有些设置需要重启。

sudo systemctl stop NetworkManager.service
sudo systemctl disable NetworkManager.service

2、设置MAC地址在帮助文档中应该找这个关键字:hardware address,设置有两种方式,临时和永久。

  1. 临时,直接使用命令行方式,重启后失效
    sudo ifconfig eth0 down
    sudo ifconfig eth0 hw ether xx:xx:xx:xx
    sudo ifconfig eth0 up
  2. 永久,修改/etc/network/interfaces
    #加入如下MAC地址配置
    hwaddress ether 00:01:04:1b:2C:1F
    #重启网络服务
    sudo service networking restart

3、网络常用设置/etc/network/interfaces(IP/DNS/网关)

#This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface #环路
auto lo
iface lo inet loopback 
# The primary network interface
auto eth0 #网卡
iface eth0 inet static #设置IPV4为静态地址
address 1.1.1.2 #设置IP
netmask 255.255.255.0 #设置子网掩码
network 1.1.1.255 #设置网关
gateway 1.1.1.1 #设置网关
dns-nameservers 1.1.1.1 #设置DNS服务器,多个用空格隔开
dns-search .com #限制.com的查询走上面设置的DNS服务器
hwaddress ether 00:01:04:1b:2C:1F #设置MAC地址

 

参考:

http://blog.csdn.net/zhangwu1241/article/details/53311534

http://www.youritronics.com/how-to-set-the-mac-address-from-etcnetworkinterfaces-in-debian/

https://www.cnblogs.com/qiuxiangmuyu/p/6343841.html

http://wiki.ubuntu.org.cn/Quick_HOWTO_:_Ch03_:_Linux_Networking/zh#.2Fetc.2Fnetwork.2Finterfaces.E6.96.87.E4.BB.B6

http://blog.csdn.net/u011077672/article/details/71123319

https://wiki.debian.org/NetworkConfiguration

==>如有问题,请联系我:easonjim#163.com,或者下方发表评论。<==
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值