ubuntu 設(shè)置靜態(tài)IP的實現(xiàn)方法
Ubuntu 設(shè)定靜態(tài)IP:
切換到root用戶,然后進入/etc/network目錄。備份interfaces文件(備份文件是一個好習(xí)慣)
下面編輯interfaces文件,添加如下語句:
1 # Assgin static IP by eric on 26-SEP-2012 2 iface eth0 inet static 3 address 192.168.196.135 #change to your static IP 4 netmask 255.255.255.0 #change to your netmask 5 gateway 192.168.196.255 #change to your getway 6 #We must specify dns-nameserver here 7 #in order to get internet access from host 8 dns-nameservers 192.168.196.255 9 auto eth0
編輯完成后的interfaces文件內(nèi)容如下:
root@ubuntu:/etc/network# cat interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback #add by andy at 2014-08-14 # Assgin static IP by eric on 26-SEP-2012 iface eth0 inet static address 192.168.196.135 #change to your static IP netmask 255.255.255.0 #change to your netmask gateway 192.168.196.255 #change to your getway #We must specify dns-nameserver here #in order to get internet access from host dns-nameservers 192.168.196.255 auto eth0
下一步就是重啟網(wǎng)卡:
root@ubuntu:/etc/network# /etc/init.d/networking restart 重啟完成后,測試一下: root@ubuntu:/etc/network# ping www.baidu.com.cn PING www.a.shifen.com (220.181.112.244) 56(84) bytes of data. 64 bytes from 220.181.112.244: icmp_req=1 ttl=128 time=6.12 ms 64 bytes from 220.181.112.244: icmp_req=2 ttl=128 time=14.7 ms
OK。靜態(tài)IP設(shè)置完成。
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
在 Linux 命令行發(fā)送郵件的 5 種方法(推薦)
這篇文章主要介紹了在 Linux 命令行發(fā)送郵件的 5 種方法,本教程中包含了最流行的 5 個命令行郵件客戶端,你可以選擇其中一個,需要的朋友可以參考下2019-12-12linux基礎(chǔ)教程之特殊權(quán)限SUID、SGID和SBIT
這篇文章主要給大家介紹了關(guān)于linux基礎(chǔ)教程之特殊權(quán)限SUID、SGID和SBIT的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2018-09-09使用?Apache?Dubbo?實現(xiàn)遠程通信(微服務(wù)架構(gòu))
Apache?Dubbo?是一個分布式服務(wù)框架,主要實現(xiàn)多個系統(tǒng)之間的高性能、透明化調(diào)用,本文給大家介紹使用?Apache?Dubbo?實現(xiàn)遠程通信的詳細過程,感興趣的朋友跟隨小編一起看看吧2022-01-01Apache mod_rewrite中的REQUEST_URI使用實例
這篇文章主要介紹了Apache mod_rewrite中的REQUEST_URI使用實例,本文使用一個實例講解如何使用REQUEST_URI,需要的朋友可以參考下2015-01-01Linux系統(tǒng)中檢查系統(tǒng)重啟記錄方案
通過Linux系統(tǒng)的日志文件和特定命令,系統(tǒng)管理員可以有效監(jiān)控和分析系統(tǒng)的重啟歷史,以便及時發(fā)現(xiàn)并解決潛在的系統(tǒng)問題和安全漏洞,保證系統(tǒng)穩(wěn)定高效運行,利用/var/log目錄和命令如last、uptime和journalctl2024-10-10