Opensolaris: 设置静态IP地址

在网上也有相关文章,感觉或设置过多,或设置偏少。自己总结如下:

1. 禁用nwam服务
root@opensolaris# svcadm disable nwam

2.配置子网掩码文件

root@opensolaris# echo "10.224.54.0 255.255.254.0" > /etc/netmasks

3.配置IP文件

root@opensolaris# echo "10.224.55.249" > /etc/hostname.bnx0

我这台机器bnx0网卡是up状态
root@opensolaris:~# dladm show-link
LINK        CLASS    MTU    STATE    OVER
bnx0        phys     1500   up       --
bnx1        phys     1500   down     --
bnx2        phys     1500   down     --
bnx3        phys     1500   down     --
igb0        phys     1500   unknown  --
igb1        phys     1500   unknown  --
igb2        phys     1500   unknown  --
igb3        phys     1500   unknown  --

4.配置默认网关文件

root@opensolaris# echo "10.224.54.1" > /etc/defaultrouter

5.配置DNS文件

root@opensolaris#  echo "nameserver 10.224.30.4" > /etc/resolv.conf

6.启动网卡服务

root@opensolaris# svcadm enable svc:/network/physical:default

6.启动DNS解析服务

root@opensolaris# cp /etc/nsswitch.dns /etc/nsswitch.conf

上述过程已经经过反复测试。


上面是通过修改文件来达到配置静态IP地址的效果

也可通过如下命令:
ifconfig bnx0 10.224.55.249 netmask 255.255.254.0 up
route add default 10.224.54.1
cp /etc/nsswitch.dns /etc/nsswitch.conf

不过仅仅通过命令来实现的话,重新启动机器配置会消失。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值