Assuming you want to make the following changes to the network device
- Change the
- Set the
- Set the
Default Gatewayfor the device to be
and you want to avoid using
route that are obsolete you can perform these changes using the following two commands
sudo ip addr add 192.168.1.2/24 dev eth0; sudo ip route add default via 192.168.1.1 dev eth0;
Please note that the
netmask is given in
CIDR notation (it is the
/24 right after the IP of the device in the
ip addr command).
A subnet mask (netmask) is a bitmask that encodes the prefix length in quad-dotted notation: 32 bits, starting with a number of 1 bits equal to the prefix length, ending with 0 bits, and encoded in four-part dotted-decimal format: 255.255.255.0. A subnet mask encodes the same information as a prefix length, but predates the advent of CIDR. In CIDR notation, the prefix bits are always contiguous, whereas subnet masks may specify non-contiguous bits.
From Wikipedia: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
This post is also available in: Αγγλικα