您的位置:首页 > 运维架构

openindiana下配置静态IP

2012-06-28 15:53 302 查看

Introduction

OpenIndiana151aisbydefaultinstalledtouseNWAMandDHCPdynamicIPs.InmanysituationsitwouldbepreferredtosetupastaticIPfortheserver,somethingwhichisdifficulttodothroughnwam.ThereafewguidestouseNWAMforStaticIPs(examples:A,B,orC)butnoneseemstraightforward.

GUIWay(easiest)

Usingsu,sudoorpfexectoacquiretherequiredprivileges:

Commands

#svcadmdisablesvc:/network/physical:nwam
#svcadmenablesvc:/network/physical:default
#cp/etc/nsswitch.dns/etc/nsswitch.conf
#network-admin

network-admin

Connections

General

DNS

Hosts

Thislastcommandwillopenawindowingnomeinwhichyoucanfillintherequiredvalues.

ConsoleWay

Commands(Solaris11andOpenIndiana151):

#ipadmcreate-addr-Tstatic-a1.2.3.4/24e1000g0/v4static

#
route-padddefault1.2.3.254#cp/etc/nsswitch.dns/etc/nsswitch.conf
#vi/etc/hosts
#vi/etc/resolv.conf

Commands:

#svcadmdisablesvc:/network/physical:nwam
#svcadmenablesvc:/network/physical:default
#cp/etc/nsswitch.dns/etc/nsswitch.conf
#vi/etc/hosts
#vi/etc/resolv.conf
#vi/etc/defaultrouter
#vi/etc/hostname.NIC
#svcadmrestartsvc:/network/physical:default

files

Thefollowingfilesneedtobeedited.Changethepartsnecessary,whereoiboxisthecurrentcomputername,example.netisthedomainname(orworkgroup)./etc/hosts
/etc/resolv.conf
/etc/defaultrouter
Notethefile/etc/hostname._NIC_willbesomethinglike/etc/hostname.bnx0wherethesuffixisyourphysicalNIC./etc/hostname.NIC

PotentialIssuesandWorkarounds

Typicallyitisalwaysagoodideasdoallthisworkinatrueconsole(directkeyboardplusscreenoraBMC/iLOM/IMMdevice)asyoumayloseallnetworkedconnectivitytoyoursystem.

firewalls

Theuseofipfilter(afirewall)canpreventthechangesabovefromworking.Tocheckifipfilterisactive
#svcsipfilter
ThefollowingcommandtodisableipfiltermaysolveissuesintryingtogetastaticIPtowork.
#svcadmdisableipfilter

alternatesetoffileschanges

Amoretraditionalsetofchanges(similartowhatsys-unconfigwoulddo),allowingthesystemtohavemultipleIPaddresseswithdifferenthostnamesoneachofyourphysicalinterfaces.ThebelowassumesyouwanttheservertohaveStaticIP:192.168.1.16,hostname:oibox,adefaultrouteof192.168.1.1,andtousegoogle'sDNSnameserversof8.8.8.8and8.8.4.4.ThisiswhatIdo,itisdifferentthantheabove"files"section,andisbasedoninformationathttp://www.outside-the-box.com/?p=185/etc/hosts
/etc/resolv.conf
/etc/defaultrouter
Notethefile/etc/hostname._NIC_willbesomethinglike/etc/hostname.bnx0wherethesuffixbnx0,pcn0,nge0,etc.isyourphysicalNICidentifier./etc/hostname.NIC

sshkeys

Youmaywishtogenerateanewsetofsshkeystodothisyouwillneedtoremovethekeys,thewillberegeneratedautomaticallyonnextsystemreboot.
#rm/etc/ssh/*key*

Other

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

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: