SOLARIS11 设置静态IP
来源:互联网 发布:大麻淘宝 编辑:程序博客网 时间:2024/05/22 06:35
在下面的例子中,我们会手动的设置服务器静态IP为10.163.198.20.
首先切换到DefaultFixed
NCP,默认为Automatic
root@solaris:~# netadm enable -p ncp DefaultFixed
在一个多网卡的机器上,你可以使用dladm
命令决定哪个网络接口映射到哪个物理设备
root@solaris:~# dladm show-physLINK MEDIA STATE SPEED DUPLEX DEVICEnet0 Ethernet up 1000 full e1000g0net1 Ethernet unknown 0 unknown pcn0
创建一个静态IP包括两个步骤:
1.创建网络接口
2.创建IP地址
注意:一个网络接口有可能拥有多个IP地址(用过LINUX都应该知道)
root@solaris:~# ipadm create-ip net0root@solaris:~# ipadm show-ifIFNAME CLASS STATE ACTIVE OVERlo0 loopback ok yes ---net0 ip down no ---root@solaris:~# ipadm create-addr -T static -a 10.163.198.20/24 net0/acme #网络接口为net0,描述是acme
root@solaris:~# ipadm show-ifIFNAME CLASS STATE ACTIVE OVERlo0 loopback ok yes ---net0 ip ok yes ---root@solaris:~# ipadm show-addrADDROBJ TYPE STATIC ADDRlo0/v4 static ok 127.0.0.1/8net0/acme static ok 10.163.198.20/24lo0/v6 static ok ::1/128
添加一个默认路由
root@solaris:~# route -p add default 10.163.198.1add net default: gateway 10.163.198.1add persistent net default: gateway 10.163.198.1
使用SMF配置解析服务
The name service configuration is now stored and configured via SMF services instead of via configuration files in /etc
. This change is part of a wider set of configuration changes in Oracle Solaris 11, which provides a greater degree of administrative auditability and control over system configuration, particularly during system updates.
The SMF service svc:/network/dns/client
manages configuration information that used to be in /etc/resolv.conf
. The SMF service svc:/system/name-service/switch
manages configuration information that used to be in /etc/nsswitch.conf
. In both cases, the configuration information is also stored in the legacy files for compatibility with other applications that might read them. You should not directly edit these legacy files. Changes made to properties are not reflected in the legacy files until the service is refreshed, restarted, or enabled.
Note: Specifying lists and strings as SMF properties requires quoting them or escaping parentheses and quotation marks to prevent the shell from interpreting them.
使用SMF配置DNS
在下面的例子中,我们使用了svccfg命令配置了DNS(svc:/network/dns/client
SMF 服务),反过来,我们也可以查看DNS的IP地址或者域名。
root@solaris:~# svccfg -s svc:/network/dns/client setprop \config/search='("uk.acme.com" "us.acme.com" "acme.com")'root@solaris:~# svccfg -s svc:/network/dns/client listprop config/searchconfig/search astring"uk.acme.com" "us.acme.com" "acme.com"root@solaris:~# svccfg -s svc:/network/dns/client setprop \config/nameserver=net_address: '(10.167.162.20 10.167.162.36)'root@solaris:~# svccfg -s svc:/network/dns/client listprop config/nameserverconfig/nameserver net_address 10.167.162.20 10.167.162.36
在更改配置后,需要刷新服务。
root@solaris:~# svcadm refresh svc:/network/dns/client
It is not necessary to set the properties for every name service database. You can use the special property config/default
to provide a default value. You can individually customize entries that can't use the default value.
使用SMF配置/etc/switch.conf
In the following example, we use the name service switch mechanism to allow our system to search through the DNS, LDAP, NIS, or local file sources for naming information. We again use the svccfg
command on the svc:/system/name-service/switch
SMF service:
root@solaris:~# svccfg -s svc:/system/name-service/switch setprop config/default = "files nis" root@solaris:~# svccfg -s svc:/system/name-service/switch setprop config/host = "files dns nis" root@solaris:~# svccfg -s svc:/system/name-service/switch setprop config/password = "files nis" root@solaris:~# svcadm refresh svc:/system/name-service/switch
或者:
root@solaris:~# svccfg
svc:> select name-service/switch
svc:/system/name-service/switch> setprop config/host="files dns nis"
svc:/system/name-service/switch> setprop config/default="files nis"
svc:/system/name-service/switch> setprop config/password = "files nis"
svc:/system/name-service/switch> refresh
svc:/system/name-service/switch> exit
Note: The config/host
property defines both the hosts
and ipnodes
entries in /etc/nsswitch.conf
, while the config/password
property defines the passwd
entry. The remaining properties have the same name as their /etc/nsswitch.conf
entries.
Setting the Host Name
In Oracle Solaris 11, /etc/nodename
has been removed and replaced with the config/nodename
property of thesvc:/system/identity:node
service.
To set the host name, we again use svccfg
:
root@solaris:~# svccfg -s svc:/system/identity:node setprop config/nodename = astring: hostnameroot@solaris:~# svcadm refresh svc:/system/identity:noderoot@solaris:~# svcadm restart identity:node
Setting the host name this way will work for both automatic and manual network configurations.
/etc/hosts
In Oracle Solaris 11, the host's own entry in /etc/hosts
is now the same as that of localhost
. In previous versions of Oracle Solaris, this entry was associated with the first network interface.
root@solaris:~# cat /etc/hosts## Copyright 2009 Sun Microsystems, Inc. All rights reserved.# Use is subject to license terms.## Internet host table#::1 solaris localhost 127.0.0.1 solaris localhost loghost
Note: Some application installers might fail due to changes in the /etc/hosts
file. If you experience this, you might have to edit/etc/hosts
directly.
- SOLARIS11 设置静态IP
- Solaris11配置静态IP
- solaris11 ip地址配置
- ubuntu设置静态IP
- Ubuntu设置静态IP
- Linux设置静态IP
- centos5 设置静态IP
- Ubuntu设置静态 IP
- RedHat 设置静态IP
- fedora静态ip设置
- Debian5静态IP设置
- Linux静态IP设置
- Linux静态IP设置
- ubuntu ip静态设置
- Ubuntu设置静态IP
- Linux静态IP设置
- Linux静态IP设置
- ubuntu 设置静态IP
- Unity3D学习之脚本入门(选择结构和循环结构)
- 如何在Linux下解压tar.lz文件
- 2014-11-19(a tough day)
- Android缓存框架--ASimpleCache
- 输入一个日期判断是星期几 java
- SOLARIS11 设置静态IP
- enumerateObjectsUsingBlock 使用 方法 iOS
- cocos2d JS 自学笔记 <一> 初步接触cocos2d JS
- 从失败中学习
- GCC编译链接到生成可执行
- MFC中对话框的模式化与非模式化的成长之路
- jar、war、ear的使用和区别
- POJ 1260-Pearls(DP)
- 解决PS CS5 在应用程序文件夹中发现其它未经许可的语言包