TBC
Assumptions:
Internet gateway: 10.28.12.2
Slackware box:
eth0: 10.28.12.102
eth1: 23.128.16.1
Client:
eth0: 10.28.12.101
Default Gateway: 10.28.12.102
Server Steps:
1) Add default gateway:
ip route add default via 10.28.16.2 dev eth0
2) Enable IP forwarding:
sysctl -w net.ipv4.ip_forward=1
3) Make it permanent TBA
4) Set up iptables rules:
# 1. Allow new connections coming from 10.x (eth0) into the 23.x network (eth1)
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
# 2. Allow return traffic for those established/related sessions to flow back out to 10.x (eth0)
iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# 3. Explicitly DROP any new connections initiated from the 23.x network trying to go anywhere else
iptables -A FORWARD -i eth1 -o eth0 -j DROP
# 4. Masquerade traffic leaving out the upstream interface (for the 10.x-initiated traffic)
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
5) Save the rules:
iptables-save > /etc/sysctl.iptables
6) Make them permanent, add the rolling to rc.local:
# Restore iptables routing rules
if [ -x /sbin/iptables-restore -a -f /etc/sysctl.iptables ]; then
/sbin/iptables-restore < /etc/sysctl.iptables
fi
Client Steps:
TBA
No comments:
Post a Comment
Note: only a member of this blog may post a comment.