全部博文(65)
分类: LINUX
2009-03-05 16:31:22
/*
*By Neil Chiao ()
*转载请注明出处:neilengineer.cublog.cn
*/
在Ubuntu 8.10中设置网络后,重新启动,发现网络设置没有保存。
解决方法:
1、配置IP等相关网络设置
sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
#上面2行是系统loopback设备,必须有
auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
2、设置DNS
sudo vi /etc/resolv.conf
nameserver 192.168.0.1
附:Linux命令行设置网络
1. 以DHCP方式配置网卡
sudo vi /etc/network/interfaces
auto eth0
iface eth0 inet dhcp
2. 为网卡配置静态IP地址
sudo vi /etc/network/interfaces
auto eth0
iface eth0 inet static
address 192.168.0.90
gateway 192.168.0.1
netmask 255.255.255.0
3. 设定第二个IP地址(虚拟IP地址)
sudo vi /etc/network/interfaces
auto eth0:1
iface eth0:1 inet static
address 192.168.0.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
4. 设置主机名称(hostname)
sudo /bin/hostname newname
5. 配置DNS
sudo vi /etc/resolv.conf
nameserver 192.168.0.1