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/clientSMF 服务),反过来,我们也可以查看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/passwordproperty 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.

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 三星手机白屏了怎么办 电脑能上qq打不开网页怎么办? 电脑打不开机怎么办黑屏 英雄杀连接不上怎么办 炫舞时登陆器卸下载失败怎么办 电视为什么会出现登录超时怎么办 登录app时提示请求超时怎么办 手机来短信断网怎么办 百度网络不给力怎么办 网络连接不给力怎么办 抖音网络不给力怎么办 玩lol老是掉线怎么办 无线网络连接有防火墙怎么办啊 千牛重新获取enc-k怎么办 为什么说不能获取对方信息怎么办 qq炫舞客户端被修改怎么办 win7玩穿越卡顿怎么办 玩dnf就蓝屏怎么办win7 平板玩fgo闪退怎么办 微信总是说空间不足怎么办 激活卡时遇到服务器错误怎么办 悦平台服务器错误是怎么办 手机银行提示登录服务器错误怎么办 qq漂流瓶封了怎么办 我的世界被冻结怎么办 qq里被屏蔽了怎么办 qq领手游礼包账号存在异常怎么办 笔记本电脑太卡怎么办最有效 华为平板电脑忘记开机密码怎么办 平板电脑忘记开机密码怎么办 平板电脑忘了开机密码怎么办 qq文件已被损坏怎么办 斗地主没痘了怎么办 熹妃q传金币不够用怎么办 苹果手机玩王者卡怎么办 苹果6玩王者荣耀卡怎么办 苹果macbook开不了机怎么办 苹果7震动像拖拉机一样怎么办 win10笔记本玩lol卡怎么办 苹果笔记本密码忘了怎么办 苹果笔记本系统密码忘记了怎么办