Ubuntu9.04网络设置

Ubuntu9.04网络设置

最近一个兄弟拷贝给我一个9.04的虚拟机。设置网络还遇到些和8.04不同的地方,记录一下:

sudo gedit /etc/network/interfaces

#设置静态IP
auto eth0

iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
#broadcast 192.168.1.255
gateway 192.168.1.1

#设置动态dhcp
auto eth0 inet dhcp

上面两个设置二选一就行了,看哪个适合你。


sudo gedit /etc/resolv.conf

#设置DNS server(可以设置多个)
nameserver 192.168.1.1

#重新设置网络
sudo /etc/init.d/networking restart

由于我的UBUNTU虚拟机是从朋友那里拷贝的,所以
设置后报错如下:
eth0: ERROR while getting interface flags:No such device
SIOCSIFNETMASK:No such device
eth0: ERROR while getting interface flags:No such device
Failed to bring up eth0.
    ...done.

解决方法:
在 /etc/udev/rules.d 目录里 *_persistent-net.rules 文件
这个文件里有网卡MAC地址和网卡名称的对应关系。
里面肯定会有关于eth0 和eth1的两行信息
删除这个文件,然后重启解决!

新的CN99的源

deb http://ubuntu.cn99.com/ubuntu/ jaunty main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ jaunty-security main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ jaunty-proposed main restricted universe multiverse
deb http://ubuntu.cn99.com/ubuntu/ jaunty-backports main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ jaunty main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ jaunty-security main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ jaunty-updates main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ jaunty-proposed main restricted universe multiverse
deb-src http://ubuntu.cn99.com/ubuntu/ jaunty-backports main restricted universe multiverse





手动设置ip
/etc/network/interfaces 是网络配置文件,你可以用任何文本编辑程序编辑,z注意保存之后要重启相应的网络连接使它生效,如eth0:
sudo ifdown eth0
sudo ifup eth0
下面是我的文件,你可以参考
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.0.110
netmask 255.255.255.0
gateway 192.168.0.1
auto eth0

猜你喜欢

转载自vvsongsunny.iteye.com/blog/856113