Labels

Android (1) Apache (1) bash (2) boost (2) C (36) C++ (4) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (3) Dreamweaver (2) Eclipse (3) fail2ban (5) git (6) GitHub (5) Hacking (4) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (33) javascript (3) Linux (181) Mac (21) Machine Learning (1) mySQL (52) Netbeans (6) Networking (1) Nexus (1) OpenVMS (6) Oracle (3) Pandas (3) php (17) Postgresql (8) Python (9) raid (1) RedHat (15) Samba (2) Slackware (52) SQL (14) ssh (1) svn (1) tar (1) ThinkPad (1) Virtualbox (4) Visual Basic (2) Visual Studio (1) Windows (5) wire (1)

Thursday, 30 July 2026

Slackware server as a gateway

 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.