Ubuntu 9.10 配置IP地址
2010-06-03 16:53:53| 分类:
Linux
| 标签:
|举报
|字号大中小 订阅
1. 手动临时设置IP
1)配置IP
# sudo ifconfig eth0 192.168.1.10 netmask 255.0.0.0
# route add default gw 192.168.1.1
2)配置DNS
# sudo gedit /etc/resolv.conf
输入以下内容:
nameserver 202.96.134.86
nameserver 202.106.0.166
手动设置IP一般在系统重启后就失效
2. 静态设置IP
1)Ubuntu网络配置信息保存在 /etc/network/interfaces 文件中,默认内容如下:
auto eth0
iface eth0 inet dhcp
auto lo
iface lo inet loopback
2)配置静态IP
# sudo gedit /etc/network/interfaces
a. 注释第二行,设置静态IP有关参数
auto eth0
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
auto lo
iface lo inet loopback
b. 编辑 /etc/resolv.conf,设置DNS
nameserver 202.96.134.86
nameserver 202.106.0.166
c. 重启服务,使新设置生效
# sudo ifconfig eth0 down
# sudo ifconfig eth0 up
评论这张
转发至微博
转发至微博
评论