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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM