Reputation: 5733
At my Ubuntu operating system I have the following networt mask set:
...
inet addr:192.168.186.136 Bcast:192.168.186.255 Mask:255.255.255.0
...
Now I will change only the Mask from 255.255.255.0 to 255.255.254.0 Is there a command in order to do this? I could not found one.
Upvotes: 4
Views: 21086
Reputation: 271
With the newer iproute2 the commands are:
ip addr add 192.168.186.136/23 dev eth0
ip addr del 192.168.186.136/24 dev eth0
You first add an interface with the new netmask and then delete the old interface. The order of the commands is important because if you swap them and delete the old interface first, you will temporarily lose connectivity until it is restored by the "add" command.
Upvotes: 0
Reputation: 2222
You can change your network settings via ifconfig
command. If you only need to change to netmask, reassign the same ip with ne new netmask.
ifconfig eth0 192.168.186.136 netmask 255.255.254.0
.
For more information about ifconfig
you can look at the manual page man ifconfig
.
Upvotes: 5