LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2008, 08:28 AM   #1
newuser77
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Rep: Reputation: 0
dual nics for iptables setup


--------
Win2003---LAN---eth1---|RHEL5.1|---eth0---Public
--------

eth0 = 192.168.99.100/24 ,GW=192.168.99.1
eth1 = 192.168.100.200 /24 , GW=??
windows ip = 192.168.100.201 /24, GW=??

Hi,
I recently trying to use iptables in my RHEL 5.1 as firewall for packet filtering and traffic routing.My RHEL5.1 is embeded with 2 nic cards.eth0 is connecting to our public network , eth1 is connecting to my private network.Within my private network I have setup a windows share folder.The reason I want to use RHEL5.1 as a firewall is I understand the iptables give lots of control of traffic flow. Here are the intention what I want to do:
1. Only allow certain MAC address from public network to access my private network share.
example : I have create a windows share folder name "winshare", when certain user want to access the share folder from public, only certain MAC address which is match in iptables are allow to connect to my windows share.

Is this possible done in iptables ? I have do many reseach but still not very understand the nature of the iptables.I study lots of DNAT,PREROUTING however I don't know how to start it.I hope the expert can provide me step by step guide to allow me to learn the lesson.Any comment is appreciated.
 
Old 06-25-2008, 01:35 PM   #2
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
hi,

1. cant do that - since you will probably have 1 MAC address connected to your public interface which is your ISP routers MAC. the solution is probably using IP/subnet rule to allow access via the firewall.

2. yes - you can DNAT your SMB server (windows shares) or any DMZ servers - but still you have to access them by using ip address like \\a.b.c.d (i think this is not a good idea), or you can directly using VPN.

example :

iptables -t nat -A PREROUTING -i <public_intf> -p tcp --dport 445 -j DNAT --to <smb_server_ip>

and so on with the rest of the SMB ports.

HTH.
 
Old 06-25-2008, 04:29 PM   #3
newuser77
LQ Newbie
 
Registered: Jun 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,
thanks for the respose.my public is basically another LAN network from different subnet.would it possible to do that ? how ? a step by step guide is much appreciated.thank you.
 
Old 06-26-2008, 11:33 AM   #4
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
hi,

assuming your :
samba server is at 10.10.10.10/24
your internet connection is dial-up dsl using ppp0 1.2.3.4
your remote laptop is 5.6.7.8

with the scenario :

remote --- internet --- 1.2.3.4 modem/router --- 10.10.10.1/24 --- samba 10.10.10.10/24

iptables -t nat -I PREROUTING -i ppp0 -s 5.6.7.8 -d 1.2.3.4 -p tcp --dport 445 -j DNAT --to 10.10.10.10
iptables -t nat -I PREROUTING -i ppp0 -s 5.6.7.8 -d 1.2.3.4 -p udp --dport 445 -j DNAT --to 10.10.10.10

and so on with rest of the SMB ports : tcp/udp 135,137,138,139.
and dont forget to configure your samba server to allow connection from the internet (that is not a good idea btw).

HTH.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Setup Dual nics for load balancing/failover thistleair Linux - Networking 4 05-11-2005 02:15 PM
How to setup two NICs in RH7.3 ? jkt2000 Linux - Networking 3 08-28-2004 07:28 AM
Iptables firewall with 4 NICs and nat jod Linux - Security 7 08-06-2003 05:14 AM
IPTables & multiple nics Smerk Linux - Networking 1 12-10-2002 07:53 AM
Multiple NICs Server Setup swa1 Linux - Software 2 07-26-2001 09:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration