Basic Network Configuration Under Solaris
The following document provides a general overview of the network configuration process for Solaris. For a detailed review of Solaris network configuration please see Chapter 4 of the O’Reilly Solaris 8 Administration Guide by Paul Watters: Solaris 8 Administration Guide, Chapter 4
The basic Solaris network configuration process follows these steps:
- Check available network interfaces
- Configure loopback interface
- Configure ethernet interface(s)
- Edit /etc/hosts, /etc/defaultrouter, /etc/hostname.(interface_name), /etc/defaultdomain, /etc/nsswitch.conf, /etc/resolv.conf
- Restart inet daemon
Network Interfaces
Hardware and Driver Information
• To check the current hardware and driver specifications of your network card run the Korn shell script at the bottom of this document.
Alternatively, run the following set of commands:
1.
Run ifconfig –a
Example:
ifconfig –a lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 eri0: flags=1000843 mtu 1500 index 2 inet 128.222.147.22 netmask ffffff00 broadcast 128.222.147.255 ether 0:3:ba:44:9d:22
2. for each interface from step 1 (i.e. lo0, etc.) run netstat –I
Example:
netstat –I eri0 Name Mtu Net/Dest Address Ipkts Ierrs Opkts Oerrs Collis Queue eri0 1500 jtripper.domain.com jtripper.domain.com 204358186 0 335053251 3 0 0
Network configuration
Standalone host
Example environment:
Hostname = jtripper IP = 128.222.147.22 Local loopback interface = lo0 Primary network interface = eri0 Default domain = jedi
Example configuration sequence:
1. To configure local loopback interface:
ifconfig lo0 inet 127.0.0.1
2. To configure Primary NIC:
ifconfig eri0 plumb ifconfig eri0 inet 128.222.147.22 netmask 255.255.255.0 broadcast 128.222.147.255 ifconfig eri0 up
3. Populate /etc/hosts file:
vi /etc/hosts 127.0.0.1 localhost loghost 128.222.147.22 jtripper
4. Configure default router (gateway):
vi /etc/defaultrouter 128.222.147.1
The /etc/defaultrouter file is read by /etc/rc2.d/S69inet during system boot. The default router is then added to the routing table. You can run this script manually:
/etc/rc2.d/S69inet stop /etc/rc2.d/S69inet start
You can also add or change a default router manually (but you will lose this setting once the system is rebooted – only settings in /etc/defaultrouter will be retained):
route add default 128.222.147.1 route change default 128.222.147.1
You can specify a particular route for a particular address.
Example:
route add -net 10.0.0.0 -netmask 255.0.0.0 128.222.22.111
(NOTE: If you don’t want your machine to use the router – i.e. you want to limit the machine’s access to internal network – you need to touch /etc/notrouter )
To obtain routing statistics run:
netstat –r Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ --------- 128.222.147.0 jtripper.domain.com U 1 2585 eri0 224.0.0.0 jtripper.domain.com U 1 0 eri0 default rd86-328g2.domain.com UG 1 10320 localhost localhost UH 216687155 lo0
To view the route for a particular netowrk destination:
traceroute marvin.domain.com traceroute to marvin.domain.com (128.222.22.57), 30 hops max, 40 byte packets 1 rd86-328g2.domain.com (128.222.144.1) 0.829 ms 0.782 ms 0.654 ms 2 rd86-328b.domain.com (128.222.82.2) 0.608 ms 0.854 ms 0.846 ms 3 marvin.domain.com (128.222.22.57) 0.824 ms 0.766 ms 0.552 ms
5. Configure default hostname:
vi /etc/hostname.eri0 jtripper
6. To verify that the interface is being addressed correctly by other hosts on the local network:
arp –a Net to Media Table: IPv4 Device IP Address Mask Flags Phys Addr ------ -------------------- --------------- ----- --------------- eri0 rd86-328g2.domain.com 255.255.255.255 00:0b:bf:f2:68:00 eri0 e137443.domain.com 255.255.255.255 00:08:74:9e:63:55 eri0 e449158.domain.com 255.255.255.255 00:0b:db:86:f4:b0 eri0 phl-lab-02.domain.com 255.255.255.255 00:90:27:3d:21:4d eri0 e259822.domain.com 255.255.255.255 00:b0:d0:cb:99:77 eri0 e060146.domain.com 255.255.255.255 00:06:5b:87:28:11 eri0 e390650.domain.com 255.255.255.255 00:0b:db:58:e5:cf eri0 e716918.domain.com 255.255.255.255 00:04:00:4c:48:25 eri0 jtripper.domain.com 255.255.255.255 SP 00:03:ba:44:9d:22 eri0 e731038.domain.com 255.255.255.255 08:00:11:09:01:b9 eri0 rd86-328g2.domain.com 255.255.255.255 00:0b:bf:f2:68:00 eri0 rd86-328g2.domain.com 255.255.255.255 00:0b:bf:f2:68:00 eri0 hpdyn08.domain.com 255.255.255.255 00:10:83:f9:77:a6 eri0 224.0.0.0 240.0.0.0 SM 01:00:5e:00:00:00
DNS Environment
In addition to the previous steps, complete the following configuration sequence:
7. Define default domain (“jedi” in this example)
domainname jedi vi /etc/defaultdomain jedi
8. Edit /etc/nsswitch.conf to match the following line:
vi /etc/nsswitch.conf hosts: dns files
NIS Environment
9. Edit /etc/hosts to add entries for NIS master and slave servers
Rename /etc/auto_home to /etc/auto_home.save
Copy /etc/nsswitch.nis to /etc/nsswitch.conf
Edit /etc/nsswitch.conf to match the following line:
vi /etc/nsswitch.conf networks: nis [NOTFOUND=return] files protocols: nis [NOTFOUND=return] files rpc: nis [NOTFOUND=return] files ethers: nis [NOTFOUND=return] files netmasks: nis [NOTFOUND=return] files bootparams: nis [NOTFOUND=return] files publickey: nis [NOTFOUND=return] files netgroup: nis automount: files nis aliases: files nis # for efficient getservbyname() avoid nis services: files nis sendmailvars: files printers: user files nis auth_attr: files nis prof_attr: files nis project: files nis
Initialize client with
ypinit -c
Enable NIS service (on Solaris 10)
svcadm enable network/nis/client
10. Edit /etc/resolv.conf to make it look something like this:
domain domain.com nameserver 128.222.121.11 nameserver 128.222.26.11 search domain2.com domain3.com domain4.com
Here’s a sample script to display status of network interfaces on a Solaris system:
#!/bin/ksh # NIC STATUS #set -x ##################################### # VARIABLES # SCRIPT=$(/bin/basename $0) NDD=/usr/sbin/ndd NETSTAT=/usr/bin/netstat IFC=/sbin/ifconfig typeset -R5 LINK typeset -R9 AUTOSPEED typeset -R6 STATUS typeset -R6 SPEED typeset -R5 MODE typeset -R18 ETHER ##################################### # FUNCTIONS # #---- Function to check volume sizes and states. # USAGE() { echo echo "$SCRIPT" echo "$SCRIPT [-t]" echo echo " -t = Print tcp settings" } #---- Function to test that the user is root. # Check_ID() { ID=$(/usr/ucb/whoami) if [ $ID != "root" ]; then echo "$ID, you must be root to run this program." exit 1 fi } #---- Function to test a Cassini Gigabit-Ethernet port (i.e. ce_). # Check_CE() { autospeed=`${NETSTAT} -k $LINK| awk '{for (i=1; i< =NF; ++i) {if ($i == "cap_1000fdx") {print $(i+1)}}}'` case $autospeed in 1) AUTOSPEED=on ;; 0) AUTOSPEED=off ;; *) AUTOSPEED=Error ;; esac status=`${NETSTAT} -k $LINK| awk '{for (i=1; i<=NF; ++i) {if ($i == "link_up") {print $(i+1)}}}'` case $status in 1) STATUS=Up ;; 0) STATUS=DOWN ;; *) STATUS=Error ;; esac SPEED=`${NETSTAT} -k $LINK| awk '{for (i=1; i<=NF; ++i) {if ($i == "link_speed") {print $(i+1)}}}'` mode=`${NETSTAT} -k $LINK| awk '{for (i=1; i<=NF; ++i) {if ($i == "link_duplex") {print $(i+1)}}}'` case $mode in 2) MODE=FDX ;; 1) MODE=HDX ;; 0) MODE=--- ;; *) MODE=Error ;; esac } #---- Function to test Quad Fast-Ethernet, Fast-Ethernet, and # GEM Gigabit-Ethernet (i.e. qfe_, hme_, ge_) # Check_NIC() { ${NDD} -set /dev/ instance if [ $type = "ge" ];then autospeed=`${NDD} -get /dev/ adv_1000autoneg_cap` else autospeed=`${NDD} -get /dev/ adv_autoneg_cap` fi case $autospeed in 1) AUTOSPEED=on ;; 0) AUTOSPEED=off ;; *) AUTOSPEED=Error ;; esac status=`${NDD} -get /dev/ link_status` case $status in 1) STATUS=Up ;; 0) STATUS=DOWN ;; *) STATUS=Error ;; esac speed=`${NDD} -get /dev/ link_speed` case $speed in 1000) SPEED=1GB ;; 1) SPEED=100MB ;; 0) SPEED=10MB ;; *) SPEED=Error ;; esac mode=`${NDD} -get /dev/ link_mode` case $mode in 1) MODE=FDX ;; 0) MODE=HDX ;; *) MODE=Error ;; esac } #---- Function to test the Davicom Fast Ethernet, DM9102A, devices # on the Netra X1 and SunFire V100 (i.e. dmfe_) # Check_DMF_NIC() { autospeed=`${NDD} -get /dev/ adv_autoneg_cap` case $autospeed in 1) AUTOSPEED=on ;; 0) AUTOSPEED=off ;; *) AUTOSPEED=Error ;; esac status=`${NDD} -get /dev/ link_status` case $status in 1) STATUS=Up ;; 0) STATUS=DOWN ;; *) STATUS=Error ;; esac speed=`${NDD} -get /dev/ link_speed` case $speed in 1000) SPEED=1GB ;; 100) SPEED=100MB ;; 10) SPEED=10MB ;; 0) SPEED=10MB ;; *) SPEED=Error ;; esac mode=`${NDD} -get /dev/ link_mode` case $mode in 1) MODE=FDX ;; 0) MODE=HDX ;; *) MODE=Error ;; esac } #---- Function to print "read and write" tcp settings. # Check_TCP() { echo echo "TCP settings" echo "============" for i in `/usr/sbin/ndd /dev/tcp ?| egrep -v "tcp_host_param"| awk '/read and write/ {print $1}'` do echo "`/usr/sbin/ndd -get /dev/tcp $i`tc" echo $i done } ##################################### # MASTER NICSTATUS FUNCTION # #---- Function to test network port configurations. # Nic_Status() { # Output header. echo echo " Link Autospeed Status Speed Mode Ethernet Address" echo "----- --------- ------ ------ ----- ------------------" # # Create a uniq list of network ports configured on the system. # # NOTE: This is done to avoid multiple references to a single network port # (i.e. qfe0 and qfe0:1). # for LINK in `${IFC} -a| egrep -v "lo|be|dman|lpfc"| awk -F: '/^[a-z,A-z]/ {print $1}'| sort -u` do type=$(echo $LINK | sed 's/[0-9]//g') num=$(echo $LINK | sed 's/[a-z,A-Z]//g') # # Here we reference the functions above to set the variables for each port which # will be outputed below. # case $type in ce) Check_CE $type $num ;; dmfe) Check_DMF_NIC $type $num ;; *) Check_NIC $type $num ;; esac # # Set ethernet variable and output all findings for a port to the screen. # ETHER=`${IFC} ${LINK}| awk '/ether/ {print $2}'` echo "$LINK $AUTOSPEED $STATUS $SPEED $MODE $ETHER" done } ############################################# # Start ############################################# # aflag= bflag= vflag= while getopts t? name do case $name in t) tflag=1 ;; ?) USAGE exit 2 ;; esac done Check_ID Nic_Status if [ ! -z $tflag ]; then Check_TCP fi set +x
I need to either make this thing boot from the drive to a running solaris OS, or install both VMware and the solaris OS onto the drive so i can use it in a demonstration in my class. ive been having trouble, as the ISO ive been downloading from ORACLE dont seem to be bootable, nor do they have anything executable.
any help is appreciated.
I am working in a Windows 2003 Server System and want to check if internet is working in a remotely connected Solaris System. I connect to the Solaris system using Putty. Please help.
I booked a room at the royal solaris and dont want to rent a car, or spend a great deal of money on taxis. If not the from the hotel Im looking for the cheapest transportation in the area.
Also where can I find a detaied map of cabo san lucas and san jose del cabo?
I just received my new external hard-drive from Dell, and I just partitioned it so that I could put an emergency backup operating system on it to retrieve files from my computer that I haven’t backed up yet.
Can an external hard-drive boot operating systems such as Linux, Solaris, or LynxOS RTOS?
Just curious…
By the way, where can I get a copy of the OpenDarwin OS?
I am running on SOlaris 10. I don’t think Yahoo Messenger has a solaris messenger client. I am trying to use the Sun Java instant messenger to connect. But I am not sure what is the server or session if for my to configure it to work.
Any help ?
I need to test my software application on Solaris 8 for a backwards compatibility/regression test. Does anyone know where I can download a version of this software or purchase a copy? I need to do it this weekend, so eBay isn’t an option. I need to download and install it… Thanks!
I want to be able to install the operating system on a removable seagate hard drive and then use it on multiple machines. Is this possible? I have the solaris express DVD that was sent to me from sun microsystems.