OpenSolaris Static IP

I’ve been driven pretty closely to incoherent rage trying to simply configure a static IP on my reinstalled server box, because of incomplete and incorrect web pages and forum posts.

It makes sense that the default configuration is DHCP; that’s what the vast majority of sites work via. I don’t, because the DHCP server in my router doesn’t let me configure static IPs for certain MAC addresses, which is a requirement for (for example) the fileserver.

I know it’s possible to configure a static IP via NWAM. But only on one interface at a time, and I’m not prepared to accept that limit (this motherboard has two, and I’ve got various ideas for putting both to use).

So, here’s the deal:

Disable svc:/network.physical:nwam and enable svc:network.physical:default. Copy /etc/nsswitch.dns to /etc/nsswitch.conf. Put your IP and name into /etc/hosts, and take your name off of the localhost IP lines. Make sure /etc/resolv.conf is valid. Put the default router ip into /etc/defaultrouter. (Turning on RIP in the router hasn’t resulted in its being found automatically.)

Now, here’s the completely weird and undocumented bit: If your live Ethernet interface is nge0, create /etc/hostname.ngeo, and in it put TWO lines; on the first line, the static IP you want. On the second line, “netmask 255.255.255.0 broadcast + up”. (“+” means the all-ones broadcast address rather than the all-zeros one, I think.) If this is documented anywhere, I couldn’t find it. I’ve found two examples, and the one I found this weekend I couldn’t find tonight, I ended up finding a different one.

And restart the service. Seems to work.

Leave a Reply