View previous topic :: View next topic |
Author |
Message |
d0ugb n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 27 Feb 2004 Posts: 11
|
Posted: Tue Apr 04, 2006 8:18 pm Post subject: iptables help with subdomains, and internal ip's |
|
|
Okay, forgive me if i say anything incorrect here, im still pretty new with iptables. Here is my situation, I have 1 ipaddress from ISP, and im running bind on the same computer that i use to share my connection with the rest of my network. I use a base 10.0.0.x network, what i want to know is it possible to allow external access to to a subdomain mycomp.example.com even though it is on an internal address? For example i run a SSH serve on port 22 on my server, but i want to ssh directly into my subdomain using the same port 22 to connect, right now the only way i have been able to acomplish this is by connecting to the server then connecting to the internal machine. Is there anyway that i can do this? Thanks in advance. ![Question :?:](images/smiles/icon_question.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Voorhees51 Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
![](images/avatars/29310527541c9055b8e2b8.gif)
Joined: 05 Nov 2003 Posts: 358
|
Posted: Tue Apr 04, 2006 11:29 pm Post subject: |
|
|
use iptables to setup a NAT then use port forwarding |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
aetius Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 09 Jul 2004 Posts: 118
|
Posted: Tue Apr 04, 2006 11:57 pm Post subject: |
|
|
more specifically, there are three steps you need to perform:
1) set up NAT so your internal addresses can get back out (I'm assuming you are doing this already)
2) redirect traffic on the firewall's external interface port to the internal host
3) allow the traffic to cross the router once redirected.
To redirect, you need to tell iptables to convert the destination IP to the internal IP:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 22 -j DNAT --to-destination 10.0.0.5
10.0.0.5 being an example, and eth0 being your external interface.
Then, you have to allow that traffic across the FORWARD chain - otherwise it should be dropped by your drop policy (which is set, right?).
iptables -A FORWARD -i eth0 -d 10.0.0.5 -p tcp --dport 22 -j ACCEPT
again assuming eth0 is your external interface and the target address is 10.0.0.5. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|