In short i can not get the gateway to work for my local network and i have no clue where i'm going wrong in the script. It seems the gateway doesn't work, but if i log in through ssh using "ssh 10.0.0.150" from the client and from there try to ssh through my outside IP address it works. So if i'm not mistaking i need help with the gateway part but the firewall is ok.
I have an ADSL modem which forwards everything to server. The server is to accept inbound ssh so i can log in both from local network and the internet. Also it should function as a gateway for my home computer.
Server and client use Slack 12.1.
The ADSL modem (10.0.0.1) is forwarding everything to 10.0.0.150 (Server/Gateway)
The server only has one NIC. It should only accept packages from 10.0.0.2 (Client) with state NEW,RELATED,ESTABLISHED and from modem (10.0.0.1) with state RELATED,ESTABLISHED. Also it should accept inbound SSH request both local and from the internet.
# Disabling routing temporarily
echo 0 > $IP_FORWARD
# Loading the NAT module
# Flushing and deleting all chains and tables
# Setting standard action for all chains
$IPT -P INPUT DROP
$IPT -P OUTPUT DROP
$IPT -P FORWARD DROP
# Allowing established and related connections on all chains
$IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -o eth0 -s 10.0.0.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i eth0 -s 10.0.0.1 -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allowing local loopback
$IPT -A INPUT -i lo -j ACCEPT
$IPT -A OUTPUT -o lo -j ACCEPT
# Allow inbound services
$IPT -A INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT #SSH server
# Making this machine a gateway for the pc on the network
$IPT -A POSTROUTING -t nat -o eth0 -s 10.0.0.2 -j MASQUERADE
# Rejecting all outbound packets that are not allready set
$IPT -A OUTPUT -j REJECT
# Enabling routing again
echo 1 > $IP_FORWARD
Also i have set gateway for server to modems ip and the gateway for the client to server ip. In case someone is thinking i'm doing something wrong there.
Also this is besides the main question but when changing "netconfig" options how do i reboot the network without rebooting the pc? It gets a little bit tiring after a while.
I would greatly appreciate any help on what i'm doing wrong because to me this seems logical and correct. Thank you for your time in advance.