用netadm命令管理配置文件

netadm 配置文件切换
Oracle Solaris 11 OS 包括以下 NCP:
    DefaultFixed。允许您使用 dladm 或 ipadm 命令管理网络。
    Automatic。允许您使用 netcfg 或 netadm 命令管理网络。

root@solaris:~# netadm enable -p ncp DefaultFixed
root@solaris:~# netadm enable -p ncp Automatic

用netcfg命令创建的配置文件用
root@solaris:~# netcfg
netcfg> create ncp cai    #创建一个ncp 叫cai
netcfg:ncp:cai> create ncu phys net2    #创建ncu 对应link net2
Created ncu 'net2'.  Walking properties ...
activation-mode (manual) [manual|prioritized]>     #没有输入为默认
mac-address>
autopush>
mtu>
netcfg:ncp:cai:ncu:net2> list    #查看内容
ncu:net2
    type                link
    class               phys
    parent              "cai"
    activation-mode     manual
    enabled             true
netcfg:ncp:cai:ncu:net2> end    #保存推出
Committed changes
netcfg:ncp:cai> create ncu ip net2    #创建ncu ip接口
Created ncu 'net2'.  Walking properties ...
ip-version (ipv4,ipv6) [ipv4|ipv6]> ipv4    #ip版本这儿选IPv4
ipv4-addrsrc [dhcp|static]> static        #配置类型为静态
ipv4-addr> 188.188.3.248/22            #ip地址
ipv4-default-route> 188.188.1.1            #网关
netcfg:ncp:cai:ncu:net2> list            #查看网络参数
ncu:net2
    type                interface
    class               ip
    parent              "cai"
    enabled             true
    ip-version          ipv4
    ipv4-addrsrc        static
    ipv4-addr           "188.188.3.248/22"
    ipv4-default-route    "188.188.1.1"
netcfg:ncp:cai:ncu:net2> end    #保存推出
Committed changes
netcfg:ncp:cai> end        #保存推出
netcfg> end
root@solaris:~# netadm list    #查看新创建的配置cai
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
ncp         cai            disabled    #here
loc         Automatic      offline
loc         NoNet          offline
loc         DefaultFixed   online
启用用户创建的配置文件
root@solaris:~# netadm enable cai

用netcfg配置dns
    root@solaris:~# svccfg -s dns/client  
    svc:/network/dns/client> setprop config/nameserver = (8.8.8.8 8.8.4.4)  
    svc:/network/dns/client> listprop config  
    config                      application  
    config/value_authorization astring     solaris.smf.value.name-service.dns.client  
    config/nameserver          net_address 8.8.8.8 8.8.4.4  
    svc:/network/dns/client> exit  
    root@solaris:~#  
    root@solaris:~# svcadm refresh dns/client  
    root@solaris:~# svcadm restart dns/client  
    root@solaris:~# svccfg -s name-service/switch  
    svc:/system/name-service/switch> setprop config/host = "files dns"  
    svc:/system/name-service/switch> listprop config  
    config                      application  
    config/default             astring     files  
    config/value_authorization astring     solaris.smf.value.name-service.switch  
    config/printer             astring     "user files"  
    config/host                astring     "files dns"  
    svc:/system/name-service/switch> exit  

删除用netcfg创建的用户自定义配置文件
root@solaris:~# netadm list
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
loc         Automatic      offline
loc         NoNet          offline
loc         DefaultFixed   online
loc         test.loc       offline
loc         acme.test.ncp  offline
root@solaris:~# netcfg #进入config模式
netcfg> help destroy
usage: destroy {-a | <object-type> [<class>] <object-name>}
    Destroys the specified profile or resource.
netcfg> destroy -a #清除所有用户自定义配置
ncp 'Automatic' cannot be removed
ncp 'DefaultFixed' cannot be removed
loc 'Automatic' cannot be removed
loc 'NoNet' cannot be removed
loc 'DefaultFixed' cannot be removed
All user-defined entities destroyed
netcfg> end    #保存退出
root@solaris:~# netadm list
TYPE        PROFILE        STATE
ncp         Automatic      disabled
ncp         DefaultFixed   online
loc         Automatic      offline
loc         NoNet          offline

loc         DefaultFixed   online


本问由笔者参考oracle文档实验步骤所写原创

作者:john

转载请注明出处!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值