Thursday, February 24, 2011

Configure physical and virtual IP on solaris

Configure IP Address on Solaris

Path        /etc/inet

Files
Hosts
Ipnodes
Netmask
Protocols
Services
Networks

Hosts file:       Details of machines on your network. It contains IP addresses followed by Hosts. /etc/hosts is symbolic link of /etc/inet/hosts

root@recp0002 # cat hosts

127.0.0.1       localhost
3.158.24.159      SERVER0002
3.120.191.100    drserver


Ipnodes file:   the file contains IPv6 addresses. The file contains minimum information of local host.

#
# Internet host table
#
::1     localhost
127.0.0.1       localhost
3.158.24.159      SERVER0002
3.120.191.100    drserver

Netmasks file:

#
# The netmasks file associates Internet Protocol (IP) address
# masks with IP network numbers.
#
#       network-number  netmask
#
# The term network-number refers to a number obtained from the Internet Network
# Information Center.
#
# Both the network-number and the netmasks are specified in
# "decimal dot" notation, e.g:
#
#               128.32.0.0 255.255.255.0
#
3.158.24.0              255.255.252.0
Networks file:

#ident  "@(#)networks   1.4     92/07/14 SMI"   /* SVr4.0 1.1   */
#
# The networks file associates Internet Protocol (IP) network numbers
# with network names.  The format of this file is:
#
#       network-name    network-number  nicnames . . .
#

#
# The loopback network is used only for intra-machine communication
#
loopback        127

#
# Internet networks
#
arpanet         10              arpa    # Historical

Protocols file:

# Copyright 1990-2002 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident  "@(#)protocols  1.7     02/09/06 SMI"   /* SVr4.0 1.1   */

#
# Internet (IP) protocols
#
ip              0       IP              # internet protocol, pseudo protocol number
icmp            1       ICMP            # internet control message protocol
igmp            2       IGMP            # Internet Group Management
ggp             3       GGP             # gateway-gateway protocol
ipip            4       IP-IP           # IP in IP (encapsulation)
tcp             6       TCP             # transmission control protocol
cbt             7       CBT             # Core Based Trees
egp             8       EGP             # exterior gateway protocol
igp             9       IGP             # any private interior gateway
pup             12      PUP             # PARC universal packet protocol
udp             17      UDP             # user datagram protocol
mux             18      MUX             # Multiplexing
mobile          55      MOBILE          # IP Mobility
ospf            89      OSPFIGP         # Open Shortest Path First
pim             103     PIM             # Protocol Independent Multicast
ipcomp          108     IPComp          # IP Payload Compression Protocol
vrrp            112     VRRP            # Virtual Router Redundancy Protocol
sctp            132     SCTP            # Stream Control Transmission Protocol

#
# Internet (IPv6) extension headers
#
hopopt          0       HOPOPT          # Hop-by-hop options for IPv6
ipv6            41      IPv6            # IPv6 in IP encapsulation
ipv6-route      43      IPv6-Route      # Routing header for IPv6
ipv6-frag       44      IPv6-Frag       # Fragment header for IPv6
ipv6-icmp       58      IPv6-ICMP       # IPv6 internet control message protocol
ipv6-nonxt      59      IPv6-NoNxt      # No next header extension header for IPv6
ipv6-opts       60      IPv6-Opts       # Destination Options for IPv6

Services file:

#ident  "@(#)services   1.32    01/11/21 SMI"
#
#
# Copyright (c) 1999-2001 by Sun Microsystems, Inc.
# All rights reserved.
#
# Network services, Internet style
#
tcpmux          1/tcp
echo            7/tcp
echo            7/udp
discard         9/tcp           sink null
discard         9/udp           sink null
systat          11/tcp          users
daytime         13/tcp
daytime         13/udp
netstat         15/tcp
chargen         19/tcp          ttytst source
chargen         19/udp          ttytst source
ftp-data        20/tcp
ftp             21/tcp
ssh             22/tcp                          # Secure Shell
telnet          23/tcp
smtp            25/tcp          mail
time            37/tcp          timserver
time            37/udp          timserver
name            42/udp          nameserver
whois           43/tcp          nicname         # usually to sri-nic
domain          53/udp
domain          53/tcp
imap            143/tcp         imap2           # Internet Mail Access Protocol v2
ldap            389/tcp                         # Lightweight Directory Access Protocol
ldap            389/udp                         # Lightweight Directory Access Protocol
submission      587/tcp                         # Mail Message Submission
submission      587/udp                         #    see RFC 2476
ldaps           636/tcp                         # LDAP protocol over TLS/SSL (was sldap)
ldaps           636/udp                         # LDAP protocol over TLS/SSL (was sldap)
#
# Host specific functions
#
tftp            69/udp
rje             77/tcp
finger          79/tcp
link            87/tcp          ttylink
supdup          95/tcp
iso-tsap        102/tcp
x400            103/tcp                         # ISO Mail
x400-snd        104/tcp
csnet-ns        105/tcp
pop-2           109/tcp                         # Post Office
uucp-path       117/tcp
nntp            119/tcp         usenet          # Network News Transfer
ntp             123/tcp                         # Network Time Protocol
ntp             123/udp                         # Network Time Protocol
netbios-ns      137/tcp                         # NETBIOS Name Service
netbios-ns      137/udp                         # NETBIOS Name Service
netbios-dgm     138/tcp                         # NETBIOS Datagram Service
cvc_hostd       442/tcp                         # Network Console
ike             500/udp         ike             # Internet Key Exchange
uuidgen         697/tcp                         # UUID Generator
uuidgen         697/udp                         # UUID Generator
#
# UNIX specific services
#
# these are NOT officially assigned
#
exec            512/tcp
login           513/tcp
shell           514/tcp         cmd             # no passwords used
printer         515/tcp         spooler         # line printer spooler
courier         530/tcp         rpc             # experimental
uucp            540/tcp         uucpd           # uucp daemon
biff            512/udp         comsat
who             513/udp         whod
syslog          514/udp
talk            517/udp
route           520/udp         router routed
ripng           521/udp
klogin          543/tcp                         # Kerberos authenticated rlogin
kshell          544/tcp         cmd             # Kerberos authenticated remote shell
new-rwho        550/udp         new-who         # experimental
rmonitor        560/udp         rmonitord       # experimental
monitor         561/udp                         # experimental
pcserver        600/tcp                         # ECD Integrated PC board srvr
sun-dr          665/tcp                         # Remote Dynamic Reconfiguration

www-ldap-gw     1760/tcp                        # HTTP to LDAP gateway
www-ldap-gw     1760/udp                        # HTTP to LDAP gateway
listen          2766/tcp                        # System V listener port
nfsd            2049/udp        nfs             # NFS server daemon (clts)
nfsd            2049/tcp        nfs             # NFS server daemon (cots)
eklogin         2105/tcp                        # Kerberos encrypted rlogin
lockd           4045/udp                        # NFS lock daemon/manager
lockd           4045/tcp
dtspc           6112/tcp                        # CDE subprocess control
fs              7100/tcp                        # Font server
apocd   38900/udp
snmpd           161/udp        snmp             # SMA snmp daemon
#
# NetBackup services
#
bprd    13720/tcp       bprd
bpjava-msvc     13722/tcp       bpjava-msvc
bpcd    13782/tcp       bpcd
vnetd   13724/tcp       vnetd
vopied  13783/tcp       vopied


Path:       /etc

inetd.conf file:

#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident  "@(#)inetd.conf 1.56    04/10/21 SMI"
#
# Legacy configuration file for inetd(1M).  See inetd.conf(4).
#
# This file is no longer directly used to configure inetd.
# The Solaris services which were formerly configured using this file
# are now configured in the Service Management Facility (see smf(5))
# using inetadm(1M).
#
# Any records remaining in this file after installation or upgrade,
# or later created by installing additional software, must be converted
# to smf(5) services and imported into the smf repository using
# inetconv(1M), otherwise the service will not be available.  Once
# a service has been converted using inetconv, further changes made to
# its entry here are not reflected in the service.
#
#
# CacheFS daemon.  Provided only as a basis for conversion by inetconv(1M).
#
100235/1 tli rpc/ticotsord wait root /usr/lib/fs/cachefs/cachefsd cachefsd"
# TFTPD - tftp server (primarily used for booting)
tftp    dgram   udp6    wait    root    /usr/sbin/in.tftpd      in.tftpd -s /tftpboot
bpcd    stream  tcp     nowait  root    /usr/openv/netbackup/bin/bpcd bpcd
vnetd   stream  tcp     nowait  root    /usr/openv/bin/vnetd vnetd
vopied  stream  tcp     nowait  root    /usr/openv/bin/vopied vopied
bpjava-msvc     stream  tcp     nowait  root    /usr/openv/netbackup/bin/bpjava-msvc bpjava-msvc –transient




hostname.<interface> File:

 # ls hostname.*
hostname.ce0     hostname.eri0    hostname.eri0:2
hostname.ce1     hostname.eri0:1

defaultrouter:
contains default routers IP address of the Server.

Defaultdomain

Contains default domain name of the Server


           
Commands

Ifconfig – can configure all network interface operations

Ifconfig –a – status of all network interfaces; lo0 is loopback address

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
eri0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 3.120.191.100 netmask fffffc00 broadcast 3.120.91.255
eri0:1: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 0.0.0.0 netmask 0

Ifconfig eri0 down  - disable the interface

Ifconfig eri0 up -  enable the interface

Ifconfig eri0 3.58.24.55 up –  set IP address and enable the interface

Ifconfig eri0 netmask 255.255.252.0 broadcast + up -  set netmask and broadcast value

Ifconfig eri0 broadcast + up -  set broadcast based on netmask

Ifconfig eri0 unplumb – close the interface

Ifconfig eri0 plumb -  opens the interface

Ifconfig eri0 recb0001 netmask+broadcast+up
ifconfig hme0 ip-addr netmask 255.255.255.0 broadcast + up

You can combine two commands in one shot

Ifconfig eri0 down && ifconfig -a
Down an interface and show the status

Ifconfig eri0 router – Enable IP forwarding
Ifconfig eri0 –router -  Disable IP forwarding

Ifconfig eri0 broadcase +    reset broadcast address


hostname
DR0001

ping <hostname>

is alive should come

Conditions:
  1. The interface must be plumbed, which is automatically carried during boot by /lib/svc/method/net-physical script
2.      The interface must be configured
3.      The interface must be up
4.      The interface must be physically connected
5.      The interface must have valid routes configured



Steps to change IP address in Solaris 10

  1. edit /etc/hosts file
  2. edit /etc/inet/ipnodes
  3. edit /etc/netmasks
  4. edit /etc/defaultrouter if set in a new location
  5. restart the network/physical service
svcadm restart network/physical

Steps to create virtual IP in Solaris

1.                  create /etc/hostname.eri0:1 or hostname:hme0:1 file with hostname of Server
2.                  edit /etc/hosts with IP address and hostname
3.                  plumb the new Interface
ifconfig eri0:1 plumb
up the interface with IP address and netmask
ifconfig eri0:1 3.158.24.55 netmask 255.255.252.0 broadcast + up


No comments:

Post a Comment