I have a Linux slackware host acting as a LAN router and DHCP server. That is working fine. I now want to port forward e.g. port 22 from the internet to a host on the LAN. I haven't quite found what I'm looking for on the web or on EE.
On the router/DHCP-server host I have:
eth0 is the connection to the Internet with a static IP: 22.214.171.124 and a public domain of mydomain.com.
eth1 is the LAN interface with static IP 192.168.1.1. This is also the interface for the DHCP server which is started with: /usr/sbin/dhcpd eth1. I also have
/etc/sysctl.conf has: net.ipv4.ip_forward = 1
My iptables startup has:
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
So far, the above is my configuration for setting this computer up as a router for my LAN. As I said, this works fine and the other hosts in the LAN get their IPs from this host and are all on the 192.168.1.0/24 subnet.
WHAT I WANT TO DO:
I want Internet requests coming in on port 30038 via eth0 to be routed to 192.168.1.101, port 22.
That's it! Basically, I want to ssh into the host at 192.168.1.101 by doing:
ssh -p 30038 mydomain.com
How do I do that?
(I also want to eventually route ports 80, 443 and 25 to this same host, but I suppose if I can do what I want for 22 I can figure out the rest).