Wednesday, December 30, 2009

aliased ip not recognized by router

We had to manually assign an aliased ip to a failover host, call him jeeves, to replace a failed server, call him bertie. Assume bertie's ip is bbb.bbb.bbb.bbb.

(Note: to add an ip onto an interface, say eth0, use something like:
/sbin/ifconfig eth0:1 inet bbb.bbb.bbb.bbb netmask 255.255.248.0 broadcast bbb.bbb.ccc.255 up)

Previously, this had been all we'd had to do, but this time, we were only able to access the ip behind the router, not from hosts outside the local network.

The trick was to send a manual arp request to the router from jeeves, after co-opting bertie's ip:
/sbin/arping -c 2 -s bbb.bbb.bbb.bbb rrr.rrr.rrr.0
(where rrr.rrr.rrr.0 is the router ip)

Normally, this arp request goes to the router when you restart an interface, but aliasing on an ip does not necessarily cause your host to talk to the router. So you may need to do it manually.

Tuesday, December 29, 2009

can't install mtr in Leopard

I was unable to compile mtr in OS X Leopard, getting these errors on make:

dns.c:242: error: ‘PACKETSZ’ undeclared here (not in a function)
dns.c: In function ‘statmalloc’:
dns.c:318: warning: format ‘%u’ expects type ‘unsigned int’, but argument 3 has type ‘size_t’
dns.c: In function ‘dorequest’:
dns.c:756: error: ‘QUERY’ undeclared (first use in this function)
dns.c:756: error: (Each undeclared identifier is reported only once
dns.c:756: error: for each function it appears in.)
dns.c:756: error: ‘C_IN’ undeclared (first use in this function)
dns.c: In function ‘resendrequest’:
dns.c:769: error: ‘T_A’ undeclared (first use in this function)
dns.c:776: error: ‘T_PTR’ undeclared (first use in this function)
dns.c: In function ‘parserespacket’:
dns.c:866: error: ‘NOERROR’ undeclared (first use in this function)
dns.c:893: error: ‘MAXDNAME’ undeclared (first use in this function)
dns.c:918: error: ‘C_IN’ undeclared (first use in this function)
dns.c:925: error: ‘T_PTR’ undeclared (first use in this function)
dns.c:992: error: ‘T_A’ undeclared (first use in this function)
dns.c:1063: error: ‘NXDOMAIN’ undeclared (first use in this function)
dns.c: In function ‘dns_events’:
dns.c:1129: error: ‘T_PTR’ undeclared (first use in this function)
dns.c: In function ‘dns_lookup2’:
dns.c:1188: error: ‘T_PTR’ undeclared (first use in this function)
make[2]: *** [dns.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2


... the solution was to add "-lresolv" to the LIBS line:
LIBS = -lm -ltermcap -lresolv

inspired by the same issue with php 5.3.0