0

Lots of tutorials out there show to set-up carp using ifconfig: https://www.netbsd.org/docs/guide/en/chap-carp.html

I'm wondering if it's possible to do the same using /etc/network/interfaces?

For instance, how can I duplicate this:

# ifconfig carp0 create
# ifconfig carp0 vhid 1 pass lanpasswd \
     carpdev em0 advskew 100 10.0.0.1 255.255.255.0

in /etc/network/interfaces?

Thanks!!

moomima
  • 497
  • 2
  • 5
  • 9

2 Answers2

0

Try using a manual interface with the pre-up and up options. I would start with:

auto carp0
iface carp0 manual
     pre-up ifconfig carp0 create | true
     up ifconfig carp0 vhid1 pass lanpasswd carpdev em0 advskew 100 10.0.0.1 255.255.255.0
     down ifconfig carp0 down

The command man interfaces should give you documentation on how to use /etc/network/interfaces.

BillThor
  • 27,737
  • 3
  • 37
  • 69
0

Yes, this is possible. Below is a sample configuration of /etc/network/interfaces:

# The primary network interface
auto eth1
iface eth1 inet static
address 192.168.5.2
netmask 255.255.254.0
gateway 192.168.5.1
dns-nameservers 192.168.5.1
  #######################
  # ucarp configuration
  #######################
  # vid : The ID of the virtual server [1-255]
  ucarp-vid 1
  # vip : The virtual address
  ucarp-vip 192.168.5.3
  # password : A password used to encrypt Carp communications
  ucarp-password secret
  # advskew : Advertisement skew [1-255]
  ucarp-advskew 1
  # advbase : Interval in seconds that advertisements will occur
  ucarp-advbase 1
  # master : determine if this server is the master
  ucarp-master no

# The carp network interface, on top of eth0
iface eth1:ucarp inet static
        address 192.168.5.3
        netmask 255.255.255.0

Cheers

Adrian
  • 1
  • Thanks Adrian, but your solution is for ucarp, not carp. :) Seems like ucarp is probably a better way to go than carp. Nevertheless... – moomima Jan 05 '15 at 08:57