zllz5230 发表于 2013-1-28 16:04:27

ubuntu server配置IP地址

这段时间部署hadoop的集群环境使用到linux,涉及到linux一些配置,记录下来共以后使用。



linux的IP分DHCP动态分配和Static静址两种,原来一直使用动态分配,但由于后来系统原因导致IP地址老是变化,就配置成了静态IP方式。

      在ubuntu server 11.10版本下配置方式如下:



使用vi编辑器打开/etc/network/interfaces文件




Java代码
1.# The primary network interface
2.auto eth0   
3.iface eth0 inet dhcp
# The primary network interface
auto eth0
iface eth0 inet dhcp

按一下方式修改这个文件




Java代码
1.# The primary network interface
2.auto eth0   
3.iface eth0 inet static
4.
5.#要配置的IP地址   
6.address 192.168.182.130
7.
8.#网关地址   
9.gateway 192.168.182.2
10.
11.#子网掩码   
12.netmask 255.255.255.0
13.
14.#广播地址   
15.#broadcast 192.168.182.255
16.#network 192.168.182.0
# The primary network interface
auto eth0
iface eth0 inet static

#要配置的IP地址
address 192.168.182.130

#网关地址
gateway 192.168.182.2

#子网掩码
netmask 255.255.255.0

#广播地址
#broadcast 192.168.182.255
#network 192.168.182.0


然后执行以下命令使配置生效




Java代码
1.root@wenbo00:/# /etc/init.d/networking restart
页: [1]
查看完整版本: ubuntu server配置IP地址