linuxnetwork-programmingconfigurationnetmask

Change subnetmask in linux


How can I change the subnetmask of my eth0 interface?

sudo ifconfig netmask 255.255.254.0

I tried this but it wasn't effective


Solution

  • you lose device parameter.

    Just like this:

    sudo ifconfig eth0 192.168.120.56 netmask 255.255.254.0
    

    Then restart your network service

    systemctl restart network