I'll try to help you to use OpenSolaris without the headache ! I am an ex Sun Microsystems and please don't hesitate to contact me for any matter having a link with OpenSolaris... No stupid questions... It is a very nice OS ! Don't miss it !

Monday, January 4, 2010

Configuration of the Network through Files (ip is static)

I know I know you are all experts in the matter of networking...

But if you are new to OpenSolaris or would like some refreshment related to the way to access a network in OpenSolaris, this is the post you need !

1.The Network Interface Card

It is sometimes frustrating but you have to check if your network card is seen by OpenSolaris... You have also to retrieve the nic.

rudy@vsolutions:~$ ifconfig -a
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
rge0: flags=1000843 mtu 1500 index 2
inet 164.15.227.15 netmask ffffff00 broadcast 164.15.227.255
lo0: flags=2002000849 mtu 8252 index 1
inet6 ::1/128

In the previous example, the network interface (or nic) is seen by OpenSolaris and an IP address was assigned.

You can retrieve a reference to the nic in /var/adm/messages.

rudy@vsolutions:~$ grep rge0 /var/adm/messages | more
Dec 23 05:42:04 opensolaris rge: [ID 801725 kern.info] NOTICE: rge0: Using MSI i
nterrupt type
Dec 23 05:42:04 opensolaris mac: [ID 469746 kern.info] NOTICE: rge0 registered
Dec 23 05:43:05 opensolaris in.routed[546]: [ID 749644 daemon.notice] rge0 has a
bad address 0.0.0.0
Dec 23 05:43:06 opensolaris mac: [ID 435574 kern.info] NOTICE: rge0 link up, 100
Mbps, full duplex

If you know the nic you can use prtconf...

rudy@vsolutions:~$ prtconf -v | grep rge0
dev_path=/pci@0,0/pci8086,2942@1c,1/pci1028,2c0@0:rge0
dev_link=/dev/rge0

2.The Configuration


You have to be root to execute the commands ! Please backup your files ! Or play with beadm !!!

root@vsolutions:~# cat /export/home/rudy/bin/enableNetwork
# change the following before rebooting your machine !
IP=XXX.XXX.XXX.XXX
GATEWAY=YYY.YYY.YYY.YYY
DNS=ZZZ.ZZZ.ZZZ.ZZZ

echo "...configuring the network network..."
echo "ip address : " $IP
echo "gateway : " $GATEWAY
echo "dns : " $DNS
echo "...using dns..."

echo "$IP" > /etc/hostname.rge0
echo "$GATEWAY" > /etc/defaultrouter
cp /etc/nsswitch.dns /etc/nsswitch.conf
echo "nameserver $DNS" > /etc/resolv.conf

Reboot and that should do the trick...

-Rudy-

No comments:

Post a Comment