All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: AW: a NAT question
@ 2004-07-16 18:43 Daniel Chemko
  2004-07-16 18:50 ` Payal Rathod
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Chemko @ 2004-07-16 18:43 UTC (permalink / raw)
  To: Payal Rathod, Netfilter ML

Payal Rathod wrote:
> On Fri, Jul 16, 2004 at 11:51:54AM +0300, Micha Silver wrote:
>> Have you tried Shorewall? http://www.shorewall.net
>> You can do it with either DNAT or proxy arp.
> 
> Ok. I will try it. But I am not too fond of using tools for firewall.
> Thanks.
> -Payal

The setup of a Script-only setup isn't too hard. You have to abandon the
concept of ip aliases since netfilter dropped support for the concept.
You only deal with the root interface and ip addresses.

If you want to setup a multi-ip address interface from the command line,
you could use something like the following:

<Assming you already have $ip0 setup on eth0 and netmask == 24, and gw
== $gw>
ip addr add $ip1/24 dev eth0
ip addr add $ip2/24 dev eth0

Now, any data sent to 200.1.1.2-4 will be sent to your Firewall.

Assuming you have a block-all,accept-selected rule, you'd setup
something like the following:

iptables -t nat -A PREROUTING --destination $ip1 -p tcp --dport 21 -j
DNAT --to $internal_1
iptables -t nat -A PREROUTING --destination $ip1 -p tcp --dport 9001 -j
DNAT --to $internal_2
iptables -t nat -A PREROUTING --destination $ip1 -p tcp --dport 80 -j
DNAT --to $internal_2
iptables -t nat -A PREROUTING --destination $ip1 -p tcp --dport 25 -j
DNAT --to $internal_2

iptables -A FORWARD --destination $internal_1 -p tcp --dport 21 -j
ACCEPT
iptables -A FORWARD --destination $internal_2 -p tcp --dport 9001 -j
ACCEPT
iptables -A FORWARD --destination $internal_2 -p tcp --dport 80 -j
ACCEPT
iptables -A FORWARD --destination $internal_2 -p tcp --dport 25 -j
ACCEPT

echo "1" > /proc/sys/net/ipv4/forward

My example used the same external interface to handle all requests. You
can replace the --destination field with any one that you've bound to
the external interface.


^ permalink raw reply	[flat|nested] 7+ messages in thread
* AW: a NAT question
@ 2004-07-15 11:26 Account fur Maillinglisten
  2004-07-16  8:51 ` Micha Silver
  0 siblings, 1 reply; 7+ messages in thread
From: Account fur Maillinglisten @ 2004-07-15 11:26 UTC (permalink / raw)
  To: Payal Rathod, netfilter

> Hi,
> We have been allocated 2 more IPs by our ISP for a period of 1 month
> for our purpose. Now these 2 IPs will be assigned to 2 Windows
> machines which are to be accessed from outside. We want port 21 or one
> machine to be accessed from outside and port 80 and 9001, 25 of other
> machine. Which is the best way to allow access to these machines from
> outside still having them under my firewall? I thought of having ip
> aliases on the Linux box and forwarding the connections to the
> respective windows box.
> Can someone explain an easy way for this?
> With warm regards,
> -Payal

Hi Payal,

you should go fort hat issue. Add virtual interfaces to your linuxbox,
assign them the ip-addresses and create some forwarding-rules for your
required ports 

# virtual alias on your interface. check man ifconfig and alter my 
# statements for your needs eq replace x.x.x.x with the correct values
ifconfig eth0:1 x.x.x.x
# This creates a duplicate interface of eth0 with a different ip-address

# (x.x.x.x). To remove one, simply put it down with ifconfig eth0:1 down

After that you've got an interface where you can bind your
forwardingrules to.

hth
-fe


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-07-16 20:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-16 18:43 AW: a NAT question Daniel Chemko
2004-07-16 18:50 ` Payal Rathod
2004-07-16 19:25   ` Antony Stone
2004-07-16 20:39   ` Victor Wren
  -- strict thread matches above, loose matches on Subject: below --
2004-07-15 11:26 Account fur Maillinglisten
2004-07-16  8:51 ` Micha Silver
2004-07-16 17:55   ` Payal Rathod

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.