转Ubuntu 10.04 网络配置


# 一、配置网卡
$sudo vi /etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them.sudo vi /etc/network/interfaces
For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

        address 192.168.3.222  #ubuntu ip 地址

        netmask 255.255.255.0 #子网掩码

        # network 192.168.3.0   #可不用配置

        # broadcast 192.168.3.255 #可不用配置

        gateway 192.168.3.1      #网关

        # dns-* options are implemented by the resolvconf package, if installed

        #dns-nameservers 8.8.8.8 # DNS,多个用半角空格隔开

# 二、配置DNS

$ sudo vi /etc/resolv.conf

search localdomain

nameserver 202.106.116.1

nameserver 8.8.8.8

nameserver 8.8.4.4

nameserver 208.67.220.220

nameserver 208.67.222.222

nameserver 202.102.192.68

Ubuntu Linux使用文件"/etc/resolv.conf" 文件配置DNS服务器的地址,可通过nameserver 配置项设置DNS服务器的IP地址,最多可以使用3个DNS服务器。
  对"resolv.conf"的修改是即时生效的。
  我们可以使用nslookup命令进行DNS服务器查询,以验证"resolv.conf"配置文件。
  可以具体的命令可以通过 man nslookup查询,这里不再赘述。
# 三、重启网络

sudo /etc/init.d/networking restart #启动网卡,终端会断掉

sudo /etc/init.d/networking force-reload #强制加载,这个更好点,终端不会断掉

很恶心是dhcp总自动的来改我的dns设置
sudo chattr +i /etc/resolv.conf
把文件设为只读就好了

猜你喜欢

转载自gumuguo.iteye.com/blog/763259