Ubuntu的网络设置
生活随笔
收集整理的這篇文章主要介紹了
Ubuntu的网络设置
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Ubuntu的網(wǎng)絡(luò)參數(shù)保存在文件 /etc/network/interfaces中,默認(rèn)設(shè)置使用dhcp,內(nèi)容如下:
# The primary network interface
auto eth0
iface eth0 inet dhcp 也有可能是其它的網(wǎng)絡(luò)接口如:eth1,eth2,根據(jù)具體的情況決定。
設(shè)置靜態(tài)ip的方法如下:
1) 編輯 /etc/network/interfaces
1.1)將dhcp 一行屏蔽
# The primary network interface
auto eth0
#iface eth0 inet dhcp
1.2)添加和靜態(tài)ip有關(guān)的參數(shù)
# 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,設(shè)置dns
nameserver 202.96.134.133
nameserver 202.106.0.20
3)執(zhí)行下面兩個(gè)命令,啟用新設(shè)置
$sudo ifdown eth0
$sudo ifup eth0
# The primary network interface
auto eth0
iface eth0 inet dhcp 也有可能是其它的網(wǎng)絡(luò)接口如:eth1,eth2,根據(jù)具體的情況決定。
設(shè)置靜態(tài)ip的方法如下:
1) 編輯 /etc/network/interfaces
1.1)將dhcp 一行屏蔽
# The primary network interface
auto eth0
#iface eth0 inet dhcp
1.2)添加和靜態(tài)ip有關(guān)的參數(shù)
# 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,設(shè)置dns
nameserver 202.96.134.133
nameserver 202.106.0.20
Ubuntu Server 12.04 配置DNS時(shí)不能直接編輯/etc/resolv.conf,重啟后會(huì)覆蓋。因此,手工配置DNS需:
$sudo vim ?/etc/resolvconf/resolv.conf.d/tail
添加:
nameserver 192.168.0.1
然后重啟resolvconf服務(wù)即可。
3)執(zhí)行下面兩個(gè)命令,啟用新設(shè)置
$sudo ifdown eth0
$sudo ifup eth0
轉(zhuǎn)載于:https://www.cnblogs.com/dyj057/archive/2011/01/20/1940671.html
總結(jié)
以上是生活随笔為你收集整理的Ubuntu的网络设置的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 简单的Android对文件进行读写操作
- 下一篇: ubuntu文件、目录操作基本命令