zoukankan      html  css  js  c++  java
  • Solaris11.1网络配置(Fixed Network)

    Solaris11的网络配置与Solaris10有很大不同,Solaris11通过network configuration profiles(NCP)来管理网络配置。

    Solaris11网络配置分为Fixed Network Configuration和 Reactive Network Configuration两种。

    Fixed Network是指网络配置不会根据网络环境自动适应的配置模式,即网络配置不会随着网络环境的变化而变化。Fixed Network Configuration通常适用于数据中心的服务器。Fixed Network需要手工配置网络,配置信息记录在DefaultFixed profile文件中。Fixed Network Configuration并不等同于配置静态IP地址,Fixed Network Configuration也可以配置为DHCP。

    Reactive Network是指网络配置能够自动适应网络环境的变化,即网络配置会随着网络环境的变化而变化。Reactive Network Configuration通常适用于桌面系统。例如:桌面系统能够通过Reactive Network模式自动搜索并连接WLAN网络。Reactive Network Configuration并不等同于DHCP, Reactive Network Configuration也可配置静态IP地址。

    以下是Solaris11.1上Fixed Network配置过程:

    1. 启用DefaultFixed NCP

    1.1 检查当前启用的NCP

    image

    1.2 启用DefaultFixed NCP

    image

    image

    2. 配置IP地址

    IP地址信息存储在DefaultFixed Profile中。

    2.1 检查物理网卡及link状态

    image

    2.2 创建网络interface

    image

    2.3 配置IP地址

    image

    image

    2.4 将主机名与IP地址加入/etc/hosts文件(可选步骤)

    此步骤主要是为了方便主机名与IP地址之间的解析。

    root@mytest:~# vi /etc/hosts
    #
    # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
    # Use is subject to license terms.
    #
    # Internet host table
    #
    ::1             localhost
    127.0.0.1       localhost loghost
    192.168.1.200   mytest  mytest.test.local

    3.  配置缺省路由

    缺省路由信息存储在/etc/inet/static_routes-DefaultFixed文件中.

    image

    root@mytest:~# more /etc/inet/static_routes-DefaultFixed
    # File generated by route(1M) - do not edit.
    default 192.168.1.1

    4. 配置domainname

    domainname信息存储在SMF中,有两种方法设置:

    4.1 使用domainname命令设置

    设置前使用domainname命令及SMF命令检查
    root@mytest:~# domainname
    <输出为空>
    root@mytest:~# svcprop -p config/domainname -l all network/nis/domain
    config/domainname hostname manifest ""
    config/domainname hostname admin ""
    
    使用domainname设置
    root@mytest:~# domainname test.local
    
    设置后检查
    root@mytest:~# domainname
    test.local
    root@mytest:~# svcprop -p config/domainname -l all network/nis/domain
    config/domainname hostname manifest ""
    config/domainname hostname admin test.local

    4.2使用SMF命令设置

    设置前检查
    root@mytest:~# domainname
    <输出为空>
    root@mytest:~#  svccfg -s svc:/network/nis/domain listprop -l all config/domainname
    config/domainname hostname    admin   
    config/domainname hostname    manifest
    
    使用SMF命令设置
    root@mytest:~# svccfg -s svc:/network/nis/domain setprop config/domainname = test.local
    root@mytest:~# svccfg -s nis/domain:default refresh
    root@mytest:~# svcadm enable nis/domain:default
    
    设置后检查
    root@mytest:~# domainname
    test.local
    root@mytest:~#  svccfg -s svc:/network/nis/domain listprop -l all config/domainname
    config/domainname hostname    admin                 test.local
    config/domainname hostname    manifest

    5. 设置NSSWITCH

    NSSWITCH信息保存在SMF中,有两种方法设置:

    5.1 使用SMF命令设置

    设置前检查
    root@mytest:~# svccfg -s svc:/system/name-service/switch listprop -l all config
    config                      application site-profile
    config                      application manifest
    config/value_authorization astring     manifest              solaris.smf.value.name-service.switch
    config/default             astring     site-profile          files
    config/default             astring     manifest              files
    config/printer             astring     site-profile          "user files"
    config/printer             astring     manifest              "user files"
    
    使用SMF命令设置
    root@mytest:~# svccfg -s svc:/system/name-service/switch setprop config/host='"files dns"'
    root@mytest:~# svccfg -s svc:/system/name-service/switch setprop config/password='"files ldap"'
    root@mytest:~# svccfg -s svc:/system/name-service/switch setprop config/group='"files ldap"'
    root@mytest:~# svcadm refresh svc:/system/name-service/switch
    
    设置后检查
    root@mytest:~# svccfg -s svc:/system/name-service/switch listprop -l all config
    config                      application site-profile
    config                      application manifest
    config/value_authorization astring     manifest              solaris.smf.value.name-service.switch
    config/default             astring     site-profile          files
    config/default             astring     manifest              files
    config/printer             astring     site-profile          "user files"
    config/printer             astring     manifest              "user files"
    config/host                astring     admin                 "files dns"
    config/password            astring     admin                 "files ldap"
    config/group               astring     admin                 "files ldap"

    5.2 使用nscfg命令从/etc/nsswitch.conf文件中导入

    设置前检查
    root@mytest:~# svccfg -s svc:/system/name-service/switch listprop -l all config
    config                      application site-profile
    config                      application manifest
    config/value_authorization astring     manifest              solaris.smf.value.name-service.switch
    config/default             astring     site-profile          files
    config/default             astring     manifest              files
    config/printer             astring     site-profile          "user files"
    config/printer             astring     manifest              "user files"
    
    nsswitch.conf文件
    root@mytest:~# more /etc/nsswitch.conf
    
    #
    # _AUTOGENERATED_FROM_SMF_V1_
    #
    # WARNING: THIS FILE GENERATED FROM SMF DATA.
    #   DO NOT EDIT THIS FILE.  EDITS WILL BE LOST.
    # See nsswitch.conf(4) for details.
    
    passwd: files ldap
    group:  files ldap
    hosts:  files dns
    ipnodes:        files dns
    networks:       files
    protocols:      files
    rpc:    files
    ethers: files
    netmasks:       files
    bootparams:     files
    publickey:      files
    netgroup:       files
    automount:      files
    aliases:        files
    services:       files
    printers:       user files
    project:        files
    auth_attr:      files
    prof_attr:      files
    tnrhtp: files
    tnrhdb: files
    sudoers:        files
    
    使用nscfg命令导入
    root@mytest:~# nscfg import -f svc:/system/name-service/switch:default
    
    导入后检查
    root@mytest:~# svccfg -s svc:/system/name-service/switch listprop -l all config
    config                      application site-profile
    config                      application manifest
    config/value_authorization astring     manifest              solaris.smf.value.name-service.switch
    config/default             astring     site-profile          files
    config/default             astring     manifest              files
    config/password            astring     admin                 "files ldap"
    config/group               astring     admin                 "files ldap"
    config/host                astring     admin                 "files dns"
    config/printer             astring     admin                 "user files"
    config/printer             astring     site-profile          "user files"
    config/printer             astring     manifest              "user files"

    6. 设置DNS Client

    DNS Client信息保存在SMF中,有两种方法可以设置DNS Client:

    6.1 使用SMF命令设置

    root@mytest:~# svccfg -s svc:/network/dns/client setprop config/domain=test.local
    root@mytest:~# svccfg -s svc:/network/dns/client listprop -l all config/domain
    config/domain astring     admin                 test.local
    root@mytest:~# svccfg -s svc:/network/dns/client setprop config/search=test.local
    root@mytest:~# svccfg -s svc:/network/dns/client listprop -l all config/search
    config/search astring     admin                 test.local
    root@mytest:~# svccfg -s svc:/network/dns/client setprop config/nameserver=net_address:'(192.168.1.100 192.168.2.100)'
    root@mytest:~# svccfg -s svc:/network/dns/client listprop -l all config/nameserver
    config/nameserver net_address admin                 192.168.1.100 192.168.2.100
    root@mytest:~# svcadm enable dns/client

    6.2 使用nscfg命令从/etc/resolv.conf文件中导入

    导入信息前 root@mytest:~# svccfg -s svc:/network/dns/client listprop -l all config config application manifest config/value_authorization astring manifest solaris.smf.value.name-service.dns.client resolv.conf内容 root@mytest:~# more /etc/resolv.conf # # _AUTOGENERATED_FROM_SMF_V1_ # # WARNING: THIS FILE GENERATED FROM SMF DATA. # DO NOT EDIT THIS FILE. EDITS WILL BE LOST. # See resolv.conf(4) for details. domain test.local search test.local nameserver 192.168.1.100 nameserver 192.168.2.100 使用nscfg命令导入 root@mytest:~# nscfg import -f svc:/network/dns/client:default 导入信息后 root@mytest:~# svccfg -s svc:/network/dns/client listprop -l all config config application manifest config/value_authorization astring manifest solaris.smf.value.name-service.dns.client config/domain astring admin test.local config/search astring admin test.local config/nameserver net_address admin 192.168.1.100 192.168.2.100

  • 相关阅读:
    机器学习为什么强大?
    将博客搬至CSDN
    nth_element()函数解决 第k小数
    DVWA XSS部分
    XSS挑战之旅(通过看代码解题)
    汇编语言(第三版)王爽 检测点3.2
    汇编语言(第三版)王爽 检测点3.1
    汇编语言(第三版)王爽 检测点2.3
    汇编语言(第三版)王爽 检测点2.2
    汇编语言(第三版)王爽 检测点2.1
  • 原文地址:https://www.cnblogs.com/cqubityj/p/3482049.html
Copyright © 2011-2022 走看看