The ifconfig
command can change both the ip address and netmask of a network interface:
ifconfig eth0 10.10.10.10 netmask 255.255.255.0
Is it possible to change the netmask of the network interface eth0
without knowing (and changing) it's ip address?
I've tried
ifconfig eth0 netmask 255.255.255.0
but I get the error
ifconfig: ioctl (SIOCAIFADDR): Invalid argument
Just specify the same IP address as currently configured with the new subnet mask to the
ifconfig
command.(That makes me feel dirty...)
Edit:
Having said that, on an old-as-heck Fedora Core 2 box (the oldest box I could find on short notice) I am seeing
ifconfig
working fine to set the netmask w/o setting the IP. What version of net-tools are you looking at?If you don't know what the IP is, just
and it will be displayed. Then you can use that in your configuration command.
ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up its should work fine