Chinaunix首页 | 论坛 | 博客
  • 博客访问: 822970
  • 博文数量: 188
  • 博客积分: 4433
  • 博客等级: 上校
  • 技术积分: 1905
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-14 07:14
个人简介

linux

文章分类

全部博文(188)

文章存档

2016年(6)

2015年(22)

2014年(18)

2013年(5)

2012年(125)

2011年(10)

2010年(2)

分类: 系统运维

2012-03-17 21:34:35

新安装了solaris 10操作系统,安装成功之后,发现不能上网,其实在安装操作系统的过程中,已经设置了静态的IP地址,但要使机器能上网,还得配置一些网络设置,具体如下:

假如想设置的网络配置信息

为:hostname:mysolaris IP:192.168.0.12 子网掩码:255.255.255.0 网关:192.168.0.1 dns(假设的):192.168.0.1

设置IP需要修改三个文件,个体的操作步骤如下:

1)、修改/etc/hosts文件,添加要设置的IP地址.

#vi /etc/hosts

添加IP,具体内容:192.168.0.12 mysolaris loghost

保存/etc/hosts文件.

添加IP,格式为:ip hostname loghost

#more /etc/hosts

::1 localhost

127.0.0.1 localhost

192.168.0.12 mysolaris loghost

2)、修改/etc/netmasks文件.

#vi /etc/netmasks

添加子网掩码:192.168.1.0 255.255.255.0

保存/etc/netmasks文件.

添加子网掩码的格式为:xxx.xxx.xxx.0 xxx.xxx.xxx.xxx

#more /etc/netmasks

192.168.1.0 255.255.255.0

3)、修改/etc/defaultrouter文件.

#vi /etc/defaultrouter

添加默认路由:192.168.0.1

保存/etc/defaultrouter文件.

#more /etc/defaultrouter

192.168.0.1

修改完这三个文件,IP地址的设置已经完成。但如果想上网还得需要配置dns,dns配置的信息如下:

1、修改/etc/resolv.conf文件,如果/etc/resolv.conf文件不存在,则需要创建它(touch /etc/resolv.conf)。

#vi /etc/resolv.conf

添加内容:nameserver 192.168.0.1

保存/etc/resolv.conf文件.

2、修改/etc/nsswitch.conf文件.

#vi /etc/nsswitch.conf

在文件中的hosts: files 后添加dns 即:hosts: files dns

保存/etc/nsswitch.conf文件.

重新启动系统即可。

ip   和子网掩码   执行这个命令:ifconfig   eth0   192.168.1.123   netmask   255.255.255.0 up
网关的设定执行这个命令:   route   add   default   gw   192.168.1.3
把这两个命令写到/etc/rc.local   或者/etc/rc.d/rc.local   里面都可以的,这样就可以永久保存

阅读(998) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~