openindiana下配置静态IP

Introduction

OpenIndiana 151a is by default installed to use NWAM and DHCP dynamic IPs. In many situations it would be preferred to set up a static IP for the server, something which is difficult to do through nwam.  There a few guides to use NWAM for Static IPs (examples: AB, or C) but none seem straight forward.

GUI Way (easiest)

Using su, sudo or pfexec to acquire the required privileges:

Commands

# svcadm disable svc:/network/physical:nwam
# svcadm enable svc:/network/physical:default
# cp /etc/nsswitch.dns /etc/nsswitch.conf
# network-admin

network-admin

Connections

General

DNS

Hosts

This last command will open a window in gnome in which you can fill in the required values.

Console Way

Commands (Solaris 11 and OpenIndiana 151):

# ipadm create-addr -T static -a 1.2.3.4/24 e1000g0/v4static
# route -p add default 1.2.3.254
# cp /etc/nsswitch.dns /etc/nsswitch.conf

# vi /etc/hosts
# vi /etc/resolv.conf

Commands:

# svcadm disable svc:/network/physical:nwam
# svcadm enable svc:/network/physical:default
# cp /etc/nsswitch.dns /etc/nsswitch.conf
# vi /etc/hosts
# vi /etc/resolv.conf
# vi /etc/defaultrouter
# vi /etc/hostname.NIC
# svcadm restart svc:/network/physical:default

files

The following files need to be edited.  Change the parts necessary, where oibox is the current computer name, example.net is the domain name (or workgroup). 

/etc/hosts
# Internet host table
#
127.0 . 0.1 localhost.localdomain localhost.local localhost loghost oibox oibox.local oibox.localdomain oibox.example oibox.example.net
:: 1 localhost.localdomain localhost.local localhost loghost oibox oibox.local oibox.localdomain oibox.example oibox.example.net
/etc/resolv.conf
nameserver 8.8 . 8.8
nameserver 8.8 . 4.4
/etc/defaultrouter
192.168 . 1.1

Note the file /etc/hostname._NIC_ will be something like /etc/hostname.bnx0 where the suffix is your physical NIC.

/etc/hostname.NIC
192.168 . 1.16

Potential Issues and Workarounds

Typically it is always a good ideas do all this work in a true console (direct keyboard plus screen or a BMC/iLOM/IMM device) as you may lose all networked connectivity to your system.

firewalls

 

The use of ipfilter (a firewall) can prevent the changes above from working.  To check if ipfilter is active

# svcs ipfilter

The following command to disable ipfilter may solve issues in trying to get a static IP to work.

# svcadm disable ipfilter 

alternate set of files changes 

A more traditional set of changes (similar to what sys-unconfig would do), allowing the system to have multiple IP addresses with different hostnames on each of your physical interfaces.  The below assumes you want the server to have Static IP: 192.168.1.16, hostname: oibox, a default route of 192.168.1.1, and to use google's DNS name servers of 8.8.8.8 and 8.8.4.4.   This is what I do, it is different than the above "files" section, and is based on information at http://www.outside-the-box.com/?p=185

/etc/hosts
# Internet host table
#
:: 1             oibox.local localhost loghost
127.0 . 0.1       oibox.local localhost loghost
192.168 . 1.16    oibox oibox.example.net
/etc/resolv.conf
nameserver 8.8 . 8.8
nameserver 8.8 . 4.4
/etc/defaultrouter
192.168 . 1.1

Note the file /etc/hostname._NIC_ will be something like /etc/hostname.bnx0 where the suffix bnx0, pcn0, nge0, etc. is your physical NIC identifier.

/etc/hostname.NIC
oibox

ssh keys

You may wish to generate a new set of ssh keys to do this you will need to remove the keys, the will be regenerated automatically on next system reboot.

# rm  /etc/ssh/*key*

Other

This section needs to be merged with http://wiki.openindiana.org/oi/4.2+Network+management 

 
以上转自 http://wiki.openindiana.org/oi/Static+IP
 
以上经本人测试通过













评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值