Monday, November 17, 2008

Gnuplot Umlauts when input isn't in iso_8859_1


# Blah
set output 'thingie'
set encoding iso_8859_1
plot 'datafile' title 'Na\357ve' # gets i umlaut, a is 345 or so.

Thursday, November 13, 2008

Port bouncing with iptables.

This just turned out to be useful to someone other than me, and I forget how I did it periodically, so:

The situation is that I am on a network where there are machines with globally routable addresses and some with private addresses. Suppose I want to get traffic from outside on the internet, but I don't want to add port-forwards to the NAT machine (Don't want to make the sysadmin manage it and I don't want to do mysterious things to those machines). Since I have a machine with a globally routable address, I can bounce the packets to the internal machine via:

DPORT=XXX
PRIVADDR=XXX.YYY....
# To
iptables -t nat -A PREROUTING -i eth0 -p tcp -d $EXTIP --dport $DPORT -j DNAT --to-destination $PRIVADDR
#from
iptables -t nat -A POSTROUTING -p tcp -d $PRIVADDR -s ! $EXTIP --dport $DPORT -j SNAT --to-source $EXTIP


If you need to target different ports, I think you can do something like

iptables -t nat -A PREROUTING -i eth0 -p tcp -d $EXTIP --dport $DPORT -j DNAT --to-destination $PRIVADDR:$OTHERPORT
iptables -t nat -A POSTROUTING -p tcp -d $PRIVADDR -s ! $EXTIP --dport $OTHERPORT -j SNAT --to-source $EXTIP

But I haven't tested it (dig around in the iptables man page under DNAT).