一,配置IP地址
临时改变IP地址,重启后失效。切换到root用户,
1. ifconfig ce0 down
2. ifconfig ce0 192.168.0.100 netmask 255.255.255.0 up
如果想永久改变IP地址,涉及到以下三个文件。
1. /etc/hostname.ce0
此文件中需加入主机名,本例中加入:
dbserver
2. /etc/hosts 此文件为一个动态链接,链接至/etc/inet/hosts
此文件中需要添加如下一行:
IP地址 主机名 loghost
192.168.0.100 dbserver loghost
3. /etc/nodename
此文件中需加入主机名,本例中加入:
dbserver
重启网络服务或者机器重启后IP地址即会改变。
二、改变主机名
当系统要求改变一台机器的主机名是,需要修改以下文件:
/etc/inet/hosts 存在动态链接,/etc/hosts链接至此文件
/etc/nodename
/etc/hostname.interface
三、配置DNS服务器
设置DNS客户端需要两个步骤:
1.创建/etc/resolv.conf文件,并添加DNS服务器IP和名称
# more /etc/resolv.conf
nameserver 192.0.0.88
nameserver 192.0.0.188
2.修改/etc/nsswitch.conf配置,在hosts后加上dns 解析
# vi /etc/nsswitch.conf
"/etc/nsswitch.conf" 40 lines, 943 characters
#
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "@(#)nsswitch.files 1.14 06/05/03 SMI"
#
# /etc/nsswitch.files:
#
# An example file that could be copied over to /etc/nsswitch.conf; it
# does not use any naming service.
#
# "hosts:" and "services:" in this file are used only if the
# /etc/netconfig file has a "-" for nametoaddr_libs of "inet" transports.
passwd: files
group: files
hosts: files dns
ipnodes: files
networks: files
protocols: files
rpc: files
ethers: files
netmasks: files
bootparams: files
publickey: files
# At present there isn't a 'files' backend for netgroup; the system will
# figure it out pretty quickly, and won't use netgroups at all.
netgroup: files
automount: files
aliases: files
services: files
printers: user files
auth_attr: files
prof_attr: files
project: files
tnrhtp: files
tnrhdb: files
~
"/etc/nsswitch.conf" 40 lines, 947 characters
#
# ping
is alive
阅读(966) | 评论(0) | 转发(0) |