linux 修改IP重啟網卡方法__linux

來源:互聯網
上載者:User

修改網卡命令:

ifconfig eth0 192.168.0.3 netmask 255.255.255.0
️臨時修改IP生效,如果想重啟之後依然生效,可以修改網卡設定檔。

重啟網卡命令:

centos: sudo service network restart
ubuntu:sudo /etc/init.d/networking restart

網卡設定檔: centos: 修改 /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0      #網卡對應的裝置別名BOOTPROTO=static #網卡獲得ip地址的方式(預設為dhcp,表示自動擷取)HWADDR=00:07:E9:05:E8:B4        #網卡MAC地址(物理地址)IPADDR=192.168.100.100          #IP地址NETMASK=255.255.255.0           #子網路遮罩 ONBOOT=yes                      #系統啟動時是否啟用此裝置
ubuntu: 修改 /etc/network/interfaces
auto eth0iface eth0 inet staticaddress 192.168.3.90gateway 192.168.3.1netmask 255.255.255.0

修改dns

# vi /etc/resolv.confnameserver 8.8.8.8              #google網域名稱伺服器nameserver 114.144.114.114      #國內網域名稱伺服器

ubuntu 參考:http://www.linuxidc.com/Linux/2013-04/83577.htm
centos 參考:http://www.linuxidc.com/Linux/2015-02/112964.htm

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.