[FUG-BR] Carp + ifstated

2013-11-22 Por tôpico Christiano Liberato
Caros,

estou com problemas para um servidor retornar a ser master com as trocas de
advskew via ifstated.

Segue o cenário:

##
server1
##

carp0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
lladdr 00:00:5e:00:01:01
priority: 0
carp: MASTER carpdev vic0 vhid 1 advbase 1 advskew 0
groups: carp
inet6 fe80::200:5eff:fe00:101%carp0 prefixlen 64 scopeid 0x5
inet 172.16.1.250 netmask 0xfe00 broadcast 172.16.1.255

carp1: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
lladdr 00:00:5e:00:01:02
priority: 0
carp: MASTER carpdev vic1 vhid 2 advbase 1 advskew 0
groups: carp
inet6 fe80::200:5eff:fe00:102%carp1 prefixlen 64 scopeid 0x6
inet 192.168.56.12 netmask 0xff00 broadcast 192.168.56.255

##
server2
##

carp0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
lladdr 00:00:5e:00:01:01
priority: 0
carp: BACKUP carpdev vic0 vhid 1 advbase 1 advskew 128
groups: carp
inet6 fe80::200:5eff:fe00:101%carp0 prefixlen 64 scopeid 0x5
inet 172.16.1.250 netmask 0xfe00 broadcast 172.16.1.255

carp1: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
lladdr 00:00:5e:00:01:02
priority: 0
carp: BACKUP carpdev vic1 vhid 2 advbase 1 advskew 128
groups: carp
inet6 fe80::200:5eff:fe00:102%carp1 prefixlen 64 scopeid 0x6
inet 192.168.56.12 netmask 0xff00 broadcast 192.168.56.255

##
/etc/ifstated.conf (rodando apenas no server1)
##

init-state one

if_up=carp0.link.up  carp1.link.up 

state one {
if ( ! $if_up ) {
run ifconfig carp0 advskew 200
run ifconfig carp1 advskew 200
set-state two
}
}

state two {
if ( $if_up ) {
run ifconfig carp0 advskew 0
run ifconfig carp1 advskew 0
set-state one
}
}

#

Conforme o ifstated.conf, ao derrubar a int carp0 (ou carp1) no server1,
ele se torna BACKUP, pois recebe advskew 200.

E o problema acontece aqui: ao subir a int carp0 (ou carp1) no server1, ele
deveria receber advskew 0 e se tornar MASTER.
Isso nao acontece, mesmo se fizer na mao, ele vira MASTER e volta para
BACKUP.

Alguem sabe se estou errando ou se falta alguma coisa?

Obrigado!
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd


[FUG-BR] CARP + Ifstated

2009-05-27 Por tôpico Fábio Ferrão
Senhores,

Estou utilizando CARP + ifstated para 3 interfaces virtuais em cada um dos
dois firewalls envolvidos. Por enquanto apenas um firewall com FreeBSD 7.2
Stable está rodando o CARP, pois o outro está sendo instalado.

O meu problema é:
O ifstated.conf está testando 3 interfaces conforme abaixo:

*#!/usr/local/bin/bash

init-state one

net = '( ifconfig -a -u |grep carp0  /dev/null every 3  ifconfig -a -u
|grep carp1  /dev/null every 3  ifconfig -a -u |grep carp2  /dev/null
every 3)'

state one {
if ( ! $net ) {
run /sbin/ifconfig carp0 advskew 200
run /sbin/ifconfig carp1 advskew 200
run /sbin/ifconfig carp2 advskew 200
set-state two
}
}

state two {
if ( $net ) {
run /sbin/ifconfig carp0 advskew 1
run /sbin/ifconfig carp1 advskew 1
run /sbin/ifconfig carp2 advskew 1
set-state one
}
}*

Quando o ifstated é iniciado com o conf acima, a saída é a seguinte:

*[r...@firewall ~]# ifstated -dv -f /usr/local/etc/ifstated.conf
net = ( ifconfig -a -u |grep carp0  /dev/null every 2  ifconfig -a -u
|grep carp1  /dev/null every 2  ifconfig -a -u |grep carp2  /dev/null
every 2)
ifstated: initial state: one
ifstated: changing state to one
ifstated: started
ifstated: running /sbin/ifconfig carp0 advskew 200
ifstated: running /sbin/ifconfig carp1 advskew 200
ifstated: running /sbin/ifconfig carp2 advskew 200
ifstated: changing state to two
ifstated: running /sbin/ifconfig carp0 advskew 1
ifstated: running /sbin/ifconfig carp1 advskew 1
ifstated: running /sbin/ifconfig carp2 advskew 1
ifstated: changing state to one
ifstated: running /sbin/ifconfig carp0 advskew 200
ifstated: running /sbin/ifconfig carp1 advskew 200
ifstated: running /sbin/ifconfig carp2 advskew 200
ifstated: changing state to two*

Com isso as interfaces CARP do meu firewall ficam da seguinte forma:

*carp0: flags=49UP,LOOPBACK,RUNNING metric 0 mtu 1500
inet 10.0.0.1 netmask 0xff00
carp: MASTER vhid 1 advbase 1 advskew 200
carp1: flags=49UP,LOOPBACK,RUNNING metric 0 mtu 1500
inet 10.0.1.1 netmask 0x
carp: MASTER vhid 2 advbase 1 advskew 200
carp2: flags=49UP,LOOPBACK,RUNNING metric 0 mtu 1500
inet 10.0.2.1 netmask 0xff00
carp: MASTER vhid 3 advbase 1 advskew 200
*
O correto seria que as interfaces CARP ficassem com advskew 1, pois todas
estão up. A propósito o parâmetro -u do ifconfig mostra as interfaces que
estão UP. De acordo com a saída acima, dá impressão que uma das interfaces
não está up e por isso o script entrou no primeiro if.
Após isso, se eu executar um* ifconfig carp0 down *e
posteriormente*ifconfig carp0 up
*, o advskew de todas as interfaces ficam como valor 1, conforme abaixo:

*carp0: flags=49UP,LOOPBACK,RUNNING metric 0 mtu 1500
inet 10.0.0.1 netmask 0xff00
carp: MASTER vhid 1 advbase 1 advskew 1
carp1: flags=49UP,LOOPBACK,RUNNING metric 0 mtu 1500
inet 10.0.1.1 netmask 0x
carp: MASTER vhid 2 advbase 1 advskew 1
carp2: flags=49UP,LOOPBACK,RUNNING metric 0 mtu 1500
inet 10.0.2.1 netmask 0xff00
carp: MASTER vhid 3 advbase 1 advskew 1*

Se eu alterar o conf pra testar somente 2 interfaces, o script fucniona de
primeira, ou seja:

*#!/usr/local/bin/bash

init-state one

net = '( ifconfig -a -u |grep carp0  /dev/null every 3  ifconfig -a -u
|grep carp1  /dev/null every 3)'

state one {
if ( ! $net ) {
run /sbin/ifconfig carp0 advskew 200
run /sbin/ifconfig carp1 advskew 200
set-state two
}
}

state two {
if ( $net ) {
run /sbin/ifconfig carp0 advskew 1
run /sbin/ifconfig carp1 advskew 1
set-state one
}
}
*

A saída do ifstated é:

*[r...@firewall ~]# ifstated -dv -f /usr/local/etc/ifstated.conf
net = ( ifconfig -a -u |grep carp0  /dev/null every 2  ifconfig -a -u
|grep carp1  /dev/null every 2)
ifstated: initial state: one
ifstated: changing state to one
ifstated: started
ifstated: running /sbin/ifconfig carp0 advskew 200
ifstated: running /sbin/ifconfig carp1 advskew 200
ifstated: changing state to two
ifstated: running /sbin/ifconfig carp0 advskew 1
ifstated: running /sbin/ifconfig carp1 advskew 1
ifstated: changing state to one
*
Desta forma o advskew das interfaces ficam 1.


Alguém já configurou o CARP para mais de duas interfaces, teve este problema
e conseguiu resolver?
Este problem só ocorre quando o conf tests 3 interfaces. O script está
errado? Alguém pode me ajudar?

Abraço à todos.



-- 
Fábio Ferrão

E conhecereis a verdade e a verdade vos libertará.João 8.32
And you will know the truth and the truth you will free.John 8.32
-
Histórico: http://www.fug.com.br/historico/html/freebsd/
Sair da lista: https://www.fug.com.br/mailman/listinfo/freebsd