3

We have a client who needs to set up 2 Class C (/24) address ranges in Ubuntu. We have a single nic connected to the switch currently and the IPs are set up at the switch.

We have done this many times in RedHat based systems by using the IPADDR_START and IPADDR_END options in the ifcfg file such as this:

IPADDR_START=192.168.0.1
IPADDR_END=192.168.0.254

However this does not appear to be an option in Ubuntu. You have to set them up individually like so:

auto eth0:x
iface eth0:x inet static
address [IP ADDRESS]
netmask 255.255.255.0

Which is fine to shell script the creation of this file. But, I understand 'x' can only go up to 256 which would only allow one class C.

Does anyone know how we can add multiple class C ips to a single nic?

Dave Drager
  • 8,455

1 Answers1

5

Add a pile of up lines like so:

iface eth0 inet static
  address 192.168.0.1
  netmask 255.255.255.0
  up ip addr add 192.168.0.2/24 dev eth0
  up ip addr add 192.168.0.3/24 dev eth0
  up ip addr add 192.168.0.4/24 dev eth0
  up ip addr add 192.168.0.5/24 dev eth0
  ...
womble
  • 98,245