service migation script from your book

General Discussion of atomic repo and development projects.

Ask for help here with anything else not covered by other forums.
zacpac

service migation script from your book

Unread post by zacpac »

i have having problems with your server migration script in your book, i found a typo first of all, and now when i run it all i get returned is the plesk default screen

#!/bin/sh

IPTABLES="/sbin/iptables"
CONFIG="/etc/rc.d/forwarded"
EXTERNAL=eth0

# Enable connection tracking

$IPTABLES -A INPUT -m state \
--state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A OUTPUT -m state \
--state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -m state \
--state NEW,ESTABLISHED,RELATED -j ACCEPT


# the working part of the code to redirect it

for i in `cat $CONFIG`; do
SOURCEIP=`echo $i | awk -F: '{print $1}'`
DESTIP=`echo $i | awk -F: '{print $2}'`
echo "Forwarding $SOURCEIP to $DESTIP"
$IPTABLES -A FORWARD -i $EXTERNAL -o $EXTERNAL \
-d $SOURCEIP -m state --state \ <- typo was here -state should have been --state
NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -t nat -A PREROUTING -i $EXTERNAL \
-d $SOURCEIP -j DNAT --to-destination $DESTIP
$IPTABLES -t nat -A POSTROUTING -d $DESTIP \
-j SNAT --to $SOURCEIP

done

# Enable IP Forwarding in the Kernel

echo "1" > /proc/sys/net/ipv4/ip_forward
zacpac

Unread post by zacpac »

it seems to be the name based names that are calling the problem
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Unread post by scott »

yeah I saw the --state thing too, the book as published is actually 2 copyedits old. The next printing should be the newer copyedit.
zacpac

Unread post by zacpac »

is there anywhere on the web to get the latest updates to the book ?? do you post the changed to gotroot ?
scott
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
Posts: 8355
Joined: Wed Dec 31, 1969 8:00 pm
Location: earth
Contact:

Unread post by scott »

Yep, theres a lot on gotroot that isnt in the book (the original book was 26 chapters, only 19 were finished). I dont know how the eratta works with a publisher, we might not have the rights to post it online.
Post Reply