Networking Forums

Networking Forums > Computer Networking > Linux Networking > Is there any problem in my iptables table?

Reply
Thread Tools Display Modes

Is there any problem in my iptables table?

 
 
jwhan
Guest
Posts: n/a

 
      06-12-2004, 02:41 AM
Our office network is as below.
| Linux Box |
-- E1 line -- | eth0
| eth1 | ---------- office
pc, demo pc
-- Cable line-| eth2 |


eth0: GW 211.104.XXX.94, ip 211.104.xxx.67, netmask 255.255.255.224
eth2: dhcp
eth1: GW 192.168.1.1 ip 192.168.1.1 netmask 255.255.255.0


In my office, some demo server and pc need to use public ip. Of course, it's
very easy. Only using iptables DNAT table.
But someone request me to set the firewall to connect demo pc by using
public ip in our office.
So I have used some tricks on the iptables.

1:iptables -t nat -A PREROUTING -d demopc's public ip -i eth 0 -j DNAT --to
demopc's private ip.
2: iptables -t nat -A PREROUTING -d demopc's public ip -i eth 1 -j DNAT --to
demopc's private ip.

3: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d ! 192.168.1.0/24 -o
eth0 -j SNAT --to 211.104.xxx.67
4: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d ! 192.168.1.0/24 -o
eth1 -j SNAT --to 211.104.xxx.67

2, 4 table is added for connecting to demo server by using public ip. In
other word, all pc connect to server in the condition of SNAT base.

is there any problem?






--
==================================
Cybermed,Inc
Assistant manager of marketing team
Jiwon, Han
Tel: 82-2-545-4282
Fax: 82-2-545-6042
E-Mail: (E-Mail Removed)
Homepage: www.cybermed.co.kr
===================================


 
Reply With Quote
 
 
 
 
Antoine EMERIT
Guest
Posts: n/a

 
      06-12-2004, 08:54 AM
"jwhan" <(E-Mail Removed)> wrote news:cadng3$258$(E-Mail Removed):

> 1:iptables -t nat -A PREROUTING -d demopc's public ip -i eth 0 -j DNAT
> --to demopc's private ip.
> 2: iptables -t nat -A PREROUTING -d demopc's public ip -i eth 1 -j
> DNAT --to demopc's private ip.


Ok

> 3: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d !
> 192.168.1.0/24 -o eth0 -j SNAT --to 211.104.xxx.67


If eth0 is your "outdoor" interface, you may not need this rule. Return
packet will be forward to the sender to its source address. This works
because you go pass the firewall throw 2 interfaces.

> 4: iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d !
> 192.168.1.0/24 -o eth1 -j SNAT --to 211.104.xxx.67


If 211.104.xxx.67 is your public ip address, I suggest you to set your
firewall private address instead (192.168.0.x), else the rule 2 may applied
on the return packet and resent the packet to your server (looping the
trafic).

Regards

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Routing table problem Hasan MANZAK Windows Networking 3 10-16-2009 02:36 AM
Anyone know how to make the iptables connection tracking table allocation larger? D. Stussy Linux Networking 8 05-19-2008 03:47 PM
a problem with nat table setting yozhang@gmail.com Linux Networking 2 02-01-2006 06:47 PM
nat table and perl problem bjohnsme Linux Networking 1 08-12-2004 03:00 PM
iptables "can't initialize iptables table `filter'" pete Linux Networking 1 10-10-2003 03:44 AM



1 2 3 4 5 6 7 8 9 10 11