To bind a range of IP addresses in Debian or Ubuntu Linux, you can use the ip
command to add and remove IP addresses from network interfaces.
For example, to add a range of IP addresses to the eth0
interface, you can use the following command:
sudo ip address add 192.168.0.100/24 dev eth0
This will add the IP address 192.168.0.100
and its subnet mask /24
to the eth0
interface. The subnet mask determines the range of IP addresses that are included in the subnet. In this case, the range is 192.168.0.1
to 192.168.0.254
.
To remove a range of IP addresses from an interface, you can use the del
option instead of the add
option. For example:
sudo ip address del 192.168.0.100/24 dev eth0
This will remove the IP address and subnet mask from the eth0
interface.
Keep in mind that these changes are not persistent, and will be lost if the system is rebooted.
To make the changes permanent, you will need to edit the interface configuration file .
The interface configuration file is located in the /etc/network/interfaces directory.
add the following lines:
auto eth0 iface eth0 inet static address <ip_address> netmask <netmask> gateway <gateway>
Replace <ip_address>
, <netmask>
and <gateway>
with the appropriate values for your network.
Once you have saved the changes, you will need to restart the network service for the changes to take effect. To do this, run the following command:
sudo /etc/init.d/networking restart