Operating System - HP-UX
1819928 Members
3069 Online
109607 Solutions
New Discussion юеВ

ifconfig error ( subnet error )

 
SOLVED
Go to solution
Daniel_25
Advisor

ifconfig error ( subnet error )

Hi,
I tried to configure IP with netmask 255.255.255.224 but failed
# ifconfig lan0:1 202.93.38.4 netmask 255.255.255.224
ifconfig: ioctl (SIOCSIFNETMASK): bad value


but when I used 255.255.255.0 ,..it worked.
I already tried to edit the file /etc/rc.config.d/netconf and restart the machine and still failed.

Any idea would be apriciated

Regards
Daniel
5 REPLIES 5
Curtis Larson_1
Valued Contributor

Re: ifconfig error ( subnet error )

i beleive there is something about a subnet address that can not be all zeros or ones.

this has been discussed on the forum before. Do a search on network and zero or ifconfig and bad value. You'll find other threads regarding this.

I do beleive in the other threads there will be mentioned a work around for this also.
Steven Sim Kok Leong
Honored Contributor
Solution

Re: ifconfig error ( subnet error )

Hi,

The last octet of your netmask is 224 (11100000) while the last octet of your IP address is 4 (00000100). At the bits where the netmask is 1, the bits in your IP are 0's. These are thus reserved bits which resulted in the error you got.

To allow setting of 224 as the last octet of your netmask, you will have to use ndd to set ip_check_subnet_addr to 0.

# ndd -set /dev/ip ip_check_subnet_addr 0

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com

Re: ifconfig error ( subnet error )

Hi
If you use a mask of 255.255.255.224 then your network is subnetted to the following...

202.93.38.0-202.93.38.31 first subnet
202.93.38.32-202.93.38.63
202.93.38.64-202.93.38.95
.......
202.93.38.224-202.93.38.255 last subnet


According to subnet RFC (RFC 917 and others) The first subnet and the last subnet cannot be used. The usable IP starts with
202.93.38.33 with 202.93.38.32 as network address and 202.93.38.63 as the broadcast address. I think this will solve your problem...

Manoj

Lutz Esser
New Member

Re: ifconfig error ( subnet error )

Hi Daniel,
try to make changes as follow for network tunable parameters read in by the networking startup script.

/etc/rc.config.d/nddconf

TRANSPORT_NAME[0]=ip
NDD_NAME[0]=ip_check_subnet_addr
NDD_VALUE[0]=0

activate it with "ndd -c"

I hope it works

Regards
Lutz




Never say never again
Jeff Brownell
Valued Contributor

Re: ifconfig error ( subnet error )

Sometimes you see an error like the one below if you try to set an IP-address with a broadcast address using ifconfig.

error lan0 ifconfig: ioctl (SIOCSIFNETMASK): Bad value

This could indicate that the netmask that was used for this address was not valid for the RFC1122 (3.2.1.3).
The RFC states what the network part and the host part of an IP-address should look like.

The ip_check_subnet_addr option could be used to disable this check for the validity of the address.
To explain what the RFC states look at this host-IP and the network mask:

10.1.0.32 netmask 255.255.255.0

This indicates that the network part should be 10.1.0.X and the host part should be X.X.X.32
The problem now is that if we follow RFC1122 (3.2.1.3) this above mention IP results in network part of 10.1.X.X and a host part of X.X.0.32
If the ip_check_subnet_addr value is set the above example would result in an error.

Unsetting the value with ndd, would not check for the RFC and this would give no error.
You could do so by executing:

ndd -set /dev/ip ip_check_subnet_addr 0

OS ver --Min --Max --Default
11.0 0 1 1
11i 0 1 0

Why should this be used?
-----------------------
The RFC1122 (3.2.1.3) decreases the number of usable IP-addresses, so unsetting this value frees some more IPs.

Usable commands:
---------------
Check the current value:

ndd -get /dev/ip ip_check_subnet_addr

Disable the subnet address check:

ndd -set /dev/ip ip_check_subnet_addr 0

Enable the subnet address check:

ndd -set /dev/ip ip_check_subnet_addr 1