Archive for the ‘kludges’ Category

redirecting a TCP connection using iptables

Friday, May 8th, 2009

Yesterday I was requested to redirect the traffic to the 80 TCP port of an host to the TCP 8080 port of a second host just for some hours. Thanks to iptables it was been very easy.
First it’s better to enable port forwarding:

# echo 1 >/proc/sys/net/ipv4/ip_forward

Then here comes some iptables commands and rules:

# iptables -F
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X
# iptables -P INPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -P OUTPUT ACCEPT

# iptables -t nat -A PREROUTING  -p tcp -m tcp -d HOST1 –dport PORT1 -j DNAT –to-destination HOST2:PORT2
# iptables -t nat -A POSTROUTING -p tcp -d HOST2 –dport PORT2 -j MASQUERADE

If You like, just download this simple shell script.

To display the nat rule:

# iptables -t nat -n -L

many thanks to cyberciti.biz and Chris Siebenmann‘s wiki.

ORA-01034 and ORA-27121 on CentOS5

Thursday, April 30th, 2009

getting the error

ERROR: ORA-01034: ORACLE not available ORA-27121: unable to determine size of shared memory segment Linux Error: 13: Permission denied

on a CentOS 5 Oracle box, You can fix it with changing a file permission:

chmod 6751 $ORACLE_HOME/bin/oracle

Dreadful, is’t it? ;-)