首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

[ubuntu] 配备ip

2012-07-25 
[ubuntu] 配置ipvim /etc/network/interfaces引用auto eth0iface eth0 inet staticaddress 192.168.5.89ne

[ubuntu] 配置ip
vim /etc/network/interfaces
引用
auto eth0
iface eth0 inet static
address 192.168.5.89
netmask 255.255.255.0
gateway 192.168.1.1
pre-up ifconfig eth0 hw ether 00:11:22:33:44:55#修改mac地址


配置完重启:
#sudo /etc/init.d/networking restart

配置DNS
首先,你可以在/etc/hosts中加入一些主机名称和这些主机名称对应的IP地址,这是简单使用本机的静态查询.
要访问DNS 服务器来进行查询,需要设置/etc/resolv.conf文件.
假设DNS服务器的IP地址是192.168.3.2, 那么/etc/resolv.conf文件的内容应为:
search test.com
nameserver 192.168.3.2

设定第二个IP地址(虚拟IP地址)
编辑文件/etc/network/interfaces:
#sudo vi /etc/network/interfaces
在该文件中添加如下的行:
引用auto eth0:1
iface eth0:1 inet static
address 192.168.1.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x
根据你的情况填上所有诸如address,netmask,network,broadcast和gateways等信息.
用下面的命令使网络设置生效:
#sudo /etc/init.d/networking restart

热点排行