LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-29-2004, 05:27 PM   #1
digihall7
LQ Newbie
 
Registered: Sep 2003
Location: Ogun state, Nigeria.
Posts: 16

Rep: Reputation: 0
Linux Box with 3 NICs for Internet sharing


Linux Box with 3 NICs for Internet sharing

Hello Good people,

I have a linux box with 3 NICs which I want to use to share internet in my office, i.e.- 1 nic connect to the internet, & 2 nics connect two different LANs.

Please, how do I do the Masquerading, NAT, and the Ip forwarding for the linux box?

What are the other necessary things to do?

Regards.
digihall7
 
Old 04-29-2004, 05:54 PM   #2
AutOPSY
Member
 
Registered: Mar 2004
Location: US
Distribution: Redhat 9 - Linux 2.6.3
Posts: 836

Rep: Reputation: 31
Modify the script below, to suit your needs.
The script below, forwards requests from eth1 to eth0 and reverse.
(eth0(internet)) <---------> (eth1(LAN))


#!/bin/sh

IPTABLES=/sbin/iptables

#All The lines below are NAT routing

# flush any old rules
$IPTABLES -F -t nat

# turn on NAT (IP masquerading for outgoing packets)
$IPTABLES -A POSTROUTING -t nat -o eth0 -j MASQUERADE

#turn on interface forwarding
$IPTABLES -A FORWARD -i eth1 -o eth0 -j ACCEPT
$IPTABLES -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT

# enable IP forwarding (of incoming packets)
echo 1 > /proc/sys/net/ipv4/ip_forward


---(END)------

The above is rc.ipmasq, chmod it 755, and introduce it into rc.local.
you may or may not have this same directory structure.
 
Old 04-30-2004, 03:03 AM   #3
digihall7
LQ Newbie
 
Registered: Sep 2003
Location: Ogun state, Nigeria.
Posts: 16

Original Poster
Rep: Reputation: 0
Linux Box with 3 NICs for Internet sharing

Good people,

Please let me make myself clearer again.

I have 3 NICs, and the following is how I want to configure it;

eth0 (internet)
and
eth1 (LAN_1)
eth2 (LAN_2)

Please, how do I do the Masquerading, NAT, and the Ip forwarding for the linux box?

What are the other necessary things to do?

Regards.
digihall7
 
Old 04-30-2004, 04:30 AM   #4
metalick
Member
 
Registered: Apr 2004
Location: Zagreb, Croatia
Distribution: SuSE 9.0
Posts: 44

Rep: Reputation: 15
Re: Linux Box with 3 NICs for Internet sharing

Quote:
Originally posted by digihall7
Good people,

Please let me make myself clearer again.

I have 3 NICs, and the following is how I want to configure it;

eth0 (internet)
and
eth1 (LAN_1)
eth2 (LAN_2)

Please, how do I do the Masquerading, NAT, and the Ip forwarding for the linux box?

What are the other necessary things to do?

Regards.
digihall7
Well that is a very complicated procedure. I would suggest that you install shorewall (www.shorewall.net) as firewall, and through that you will do the bridging between the interfaces. Shorewall is a strong firewall with many features and very good documentation. I am writting it because I have tried it and I actually use it. It would be also wise to install squid or some other proxy, to gain the caching features. Last it would also be good if you install a caching dns server. I know the answer is not very specific but if investigate these packages a bit you will find accurate answers.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Why my Internet Sharing with Xp box not working? qutub110 Linux - Networking 4 04-19-2005 01:35 PM
Internet Connection Sharing W/ 2 NICs RemusX2 Linux - Networking 5 11-29-2004 10:16 PM
Sharing Internet with a WinXP Box sovietpower Linux - Networking 2 11-13-2003 09:19 PM
Box Linux with 3 NICs Marcelo Oliveir Linux - Networking 9 09-11-2003 02:12 PM
Internet sharing via linux box on ASDL problem RIKUS Linux - Networking 1 08-20-2003 08:55 AM


All times are GMT -5. The time now is 07:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration