ubuntu设置固定IP和无线中设置固定ip

星期四, 2011-04-07 | Author: Lee | linux | 8,894 views

笔记本上用无线,又想固定ip,推荐用wicd,UBUNTU自带的network-manage,只能使用DHCP方法上网,用固定IP会导致无法上网,解决如下:
sudo apt-get install wicd
安装完成后在应用程序--互联网里可以找到该软件,很方便的设置,基本上可以通杀所以的无线设置。
还有就是对网卡设置ip,有点和centos不同,记录下:
1。单网卡配单IP(普遍)

vi /etc/network/interface

auto eth0

iface eth0 inet static

address IP

netmask 子网掩码
gateway 网关

2.单网卡双IP (情况较少,多用于区分服务或者安全隐藏)

vi /etc/network/interface

auto eth0:0

iface eth0:0 inet static

address IP

netmask 子网掩码

gateway 网关

auto eth0:1

iface eth0:1 inet static

address IP

netmask 子网掩码

gateway 网关

3.双网卡双IP(应用情况较多,一般为一个内网一个为外网)

auto eth0

iface eth0 inet static

address IP

netmask 子网掩码

gateway 网关

auto eth1

iface eth1 inet static

address IP

netmask 子网掩码

gateway 网关

综上,配置后保存推出,一般需要重启下网卡才能设置生效,方法很多,比如ifdown eth0 ,ifup eth0,最直接的方法直接在终端键入/etc/init.d/networking restart

至于DNS,都是一样的,如下

vi /etc/resolv.conf(实际系统默认的并不存在resolv.conf该文件,属于自己创建)

nameserver 主DNS

nameserver 后备DNS

下面标配置一个:
本人习惯sudo -i
后面就直接用命令方便:
首先设置IP
vi /etc/network/interface
添加内容:
auto lo
iface lo inet loopback

auto etho
iface etho inet static
address 192.168.0.118
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1

保存

然后修改DNS
vi /etc/resolv.conf

将内容修改为
nameserver 202.103.24.68
保存

重启网络连接
/etc/init.d/networking stop
/etc/init.d/networking start

Tags: , , ,

文章作者: Lee

本文地址: https://www.pomelolee.com/752.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

2 Comments to ubuntu设置固定IP和无线中设置固定ip

F
2011 年 04 月 17 日

我来看看你最近怎么样哈。
我正在寻找国内比较靠谱的服务器,有没有好的推荐,虚拟主机

I5A6
2011 年 04 月 19 日

老样子,最近玩了玩ubuntu的桌面;
我也找不到好的,想自己弄台,费用不低,没有什么其他收入,也不太想弄!

Leave a comment

Search

文章分类

Links

Meta