Change the subnet mask of an interface

Contributor Icon Contributed by qmchenry Date Icon October 3, 2003  
Tag Icon Tagged: Solaris networking

If a network interface was configured with the wrong subnet mask as can happen when the default subnet is selected with a variable length subnet mask, a simple configuration change will fix it.


Consider a host that is assigned the IP address 10.50.90.15 in the class C subnet 10.50.90.0/24. The normal subnet mask for a class A 10.* subnet is 255.0.0.0, and this is the value that an operating system will guess given that IP address information alone. To correct this problem permanently so that it will persist after the host reboots, edit the /etc/netmask file and add the following line:

10.50.90.0 255.255.255.0

To reconfigure the interface, say hme0, immediately without rebooting the system, run the following as root:

ifconfig hme0 10.50.90.15 netmask 255.255.255.0

Previous recipe | Next recipe |
 
  • Anonymous
    If you just want to change the netmask, you can do this:
    ifconfig hme0 netmask 255.255.255.0
  • Anonymous
    I typed in the string: ifconfig hme0 10.50.90.15 netmask 255.255.255.0 and it said 'ifconfig' is not recognized as an internal or external command. I typed it in DOS. Did I do something wrong?

    Thanks,
    Isabelle
  • defian7
    If you are not jokin, this is for unix based machine, the error msg looks like you are trying the command on Windows.
blog comments powered by Disqus