Until recently I had totally forgotten about this post but today I had to setup a static IP on my build machine (illumos) , that’s whey I realized that there were a lot of folks who had asked me about this information…
So for all of us ,here it goes..
Execute all these steps as root.
- svcadm disable svc:/network/physical:nwam
- vim /etc/hostname.<you’re interface name> ;; (create if the file does not exist). Here “hostname” is a literal string not the hostname of you’re machine and finally make sure the file reads like this in the first line..
<Desired IP> netmask <you’re netmask> broadcast + up
[Save and exit]
- vim /etc/defaultrouter ;; (Create if it does not exist) and add you’re router’s IP address in the first line of the file.
[Save and exit]
- Take a look at /etc/hosts file and you should see a line like this…
<Specified IP> <hostname of machine> <hostname of machine>.local localhost loghost
[ If you don’t see this then you must add the above line to /etc/hosts file.
TIP :: You will always have the loopback address (127.0.0.1) specified in that file, just copy paste that line and change the loopback address to you’re static IP ]
- svcadm enable svc:/network/physical:default
Thats about it.. You can use the ifconfig cmd to setup a static IP on the fly like this..
ifconfig <iface name> netmask <mask address> broadcast + up
In case you don’t know you’re interface name then just execute “dladm show-phys “ and what you find under the “LINK” tab would be you’re interface name.
Once set these changes are persistent .
PS:: give it a try in Vbox or vmware and let me know if you find any issues in setting it up .. I would be glad to help.