ubuntu網絡配置

Ubuntu的網絡參數保存在文件 /etc/network/interfaces中,默認設置使用dhcp,內容如下:

# The primary network interface
auto eth0
iface eth0 inet dhcp

設置靜態ip的方法如下:
1) 編輯 /etc/network/interfaces
1.1)將dhcp 一行屏蔽
# The primary network interface
auto eth0
#iface eth0 inet dhcp

1.2)添加和靜態ip有關的參數
# The primary network interface
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1

2)編輯 /etc/resolv.conf,設置dns
nameserver 202.96.134.133
nameserver 202.106.0.20

3)執行下面兩個命令,啓用新設置
$sudo ifdown eth0 

$sudo ifup eth0

或者執行$/etc/init.d/networking restart


原文地址:http://www.5dlinux.com/article/1/2007/linux_9193.html

發佈了18 篇原創文章 · 獲贊 6 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章