8 Replies Latest reply: Apr 17, 2012 11:39 PM by handat RSS

    How to change IP address permanently on Solaris 10

    800808
      Hi Solaris Experts,

      I would like to update an IP address permanently but believes ifconfig
      only does it on the fly and will revert back once the Solaris 10 Sun Fire server
      is rebooted:

      ( i ) # uname -a
      SunOS angel 5.10 Generic_139556-08 i86pc i386 i86pc

      ( ii ) # ifconfig -a
      bge0: flags=201000803<UP,BROADCAST,MULTICAST,IPv4,CoS> mtu 1500 index 2
      inet 10.56.120.37 netmask fffffc00 broadcast 10.56.123.255
      ether 0:1e:68:9b:30:33
      nge0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 4
      inet 203.20.160.62 netmask ffffff00 broadcast 203.20.160.255
      ether 0:1e:68:9b:30:35
      nge0:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index4
      inet 203.20.160.81 netmask ffffff00 broadcast 203.20.160.255
      nge1: flags=201000803<UP,BROADCAST,MULTICAST,IPv4,CoS> mtu 1500 index 5
      inet 10.56.120.40 netmask fffffc00 broadcast 10.56.123.255
      ether 0:1e:68:9b:30:36

      ( iii ) # vi /etc/inet/hosts (/etc/inet/ipnodes is softlinked to /etc/inet/hosts)
      #10.56.120.37 angel angel.apple.com loghost
      203.20.160.91 angel angel.apple.com loghost

      ( iv ) # svcadm restart network/physical

      ( v ) # ifconfig -a
      bge0: flags=201000803<UP,BROADCAST,MULTICAST,IPv4,CoS> mtu 1500 index 2
      inet 203.20.160.91 netmask ff000000 broadcast 203.255.255.255
      ether 0:1e:68:9b:30:33
      nge0: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index 4
      inet 203.20.160.62 netmask ffffff00 broadcast 203.20.160.255
      ether 0:1e:68:9b:30:35
      nge0:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS> mtu 1500 index4
      inet 203.20.160.81 netmask ffffff00 broadcast 203.20.160.255
      nge1: flags=201000803<UP,BROADCAST,MULTICAST,IPv4,CoS> mtu 1500 index 5
      inet 10.56.120.40 netmask fffffc00 broadcast 10.56.123.255
      ether 0:1e:68:9b:30:36

      However, I want the correct netmask & broadcast are 255.255.255.0 & 203.20.160.255
      respectively, the same as nge0: (203.20.160.62) & nge0:1 (203.20.160.81).

      The following ifconfig command does update the IP address together with both correct netmask & broadcast
      but don't believe that this change will stay after reboot:

      #ifconfig bge0 inet 203.20.160.91 netmask 255.255.255.0 broadcast 192.168.1.255

      The value in /etc/netmasks (softlinked to /etc/inet/netmasks) is:
      10.56.120.0 255.255.252.0

      The value in /etc/defaultrouter is:
      203.20.160.1

      In short, which other files also need to be updated to pickup the correct netmask (255.255.255.0)
      & broadcast (203.20.160.255) permanently, without having to reboot the server?

      Thanks in advance,

      Jack
        • 1. Re: How to change IP address permanently on Solaris 10
          Nik
          Hi.

          Check file: */etc/netmasks*

          Regards.
          • 2. Re: How to change IP address permanently on Solaris 10
            800808
            Hi Nik,

            Thank you for responding to this threat.

            There was only the following line as posted from the initial post:

            The value in /etc/netmasks (softlinked to /etc/inet/netmasks) is:
            *10.56.120.0 255.255.252.0*

            What is wrong with it and how should it be corrected? Are there any reference material available online?

            Please elaborate further than just looking at the content of this file.

            Thanks again,

            Jack
            • 3. Re: How to change IP address permanently on Solaris 10
              bobthesungeek76036
              Sounds like you did all the right steps. Not sure why the network restart used the old default netmask. Try running this command:

              <pre>ifconfig bge0 netmask + broadcast + up</pre>

              and see if that doesn't set your netmask/broadcast correctly.
              • 4. Re: How to change IP address permanently on Solaris 10
                800808
                Hi bobthesungeek76,

                Can I clarify your suggestion with the following command:
                ifconfig bge0 netmask + broadcast + up
                Are you referring to try the step ifconfig bge0 255.255.252.0 10.56.123.255 up ?

                I don't understand where devices nge0: and nge0:1: got their netmask & broadcast from since their /etc/inet/netmasks show:

                10.56.120.0 255.255.252.0

                This one liner provide only netmask for 10.56.120.0 subnet of network but nothing for 203.20.160.0 subnet. Does the following /etc/defaultrouter play any part on setting netmask or broadcast for devices nge0: & nge0:1:?

                203.20.160.1

                Thanks a lot,

                Jack
                • 5. Re: How to change IP address permanently on Solaris 10
                  Nik
                  Hi.
                  You need change /etc/netmasks
                  from
                  10.56.120.0 255.255.252.0
                  to
                  10.56.120.0 255.255.*255*.0

                  Regards
                  • 6. Re: How to change IP address permanently on Solaris 10
                    800808
                    Hi Nik,

                    Thanks for your advice once again but are you able to provide the reason behind your suggestion, so that I won't blindly making this change without knowing why?

                    I understand how IP and netmask are use in general but do not understand how to setup /etc/inet/netmasks to offset both 10.56.120.0 & 203.20.160.0 subnetworks as well as getting different broadcasts for each.

                    It is necessary to just as importing to learn from this exercise as much as making the change itself. This is a production server and I must be absolutely convinced that this change will work before applying it. Past attempt has not been successful which caused unnecessary downtime.

                    Many thanks again,

                    Jack
                    • 7. Re: How to change IP address permanently on Solaris 10
                      Nik
                      Hi.
                      Historically, IPv4 adresses have 3 different class (A,B,C) with predefined netmasks.

                      Network 10.0.0.0 have predefined netmask 255.0.0.0.0
                      Network 203.20.160.0 have predefined netmasks 255.255.255.0

                      http://en.wikipedia.org/wiki/Classful_network


                      So it's not required special step for configure net 203.20.160.0 with netmasks 255.255.255.0

                      For configure netmask for specific network Solaris use file /etc/netmasks
                      For network 10.56.120.0 currently you have record 255.255.252.0

                      You want have netmasks 255.255.255.0, as i understnad you.
                      So you need make this changes at /etc/netmasks.

                      Regards.
                      • 8. Re: How to change IP address permanently on Solaris 10
                        handat
                        Why don't you just have a line each for each subnet and mask you need? You are not limited to a single line in /etc/netmasks