LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-02-2004, 03:02 AM   #1
teanine
LQ Newbie
 
Registered: Mar 2004
Posts: 4

Rep: Reputation: 0
Linux as a router


Hi all..I am a Newbie...

I have a box with two eth cards..I want to use my box as gateway for my internal LAN.

the default kernel routing table in the box is pointin to my ISP gateway. I can reach it from the box, but cannot from behind the box ie LAN. I want to be able to reach my external hosts from my LAN.

Any Ideas will be greatly appreciated

internal LAN IP 192.168.1.0/24 & box with 192.168.1.1 for LAN

Box with 217.199.148.13/24 for eth conneting to ISP

rgds
 
Old 04-02-2004, 03:14 AM   #2
kubla
LQ Newbie
 
Registered: Jan 2004
Posts: 11

Rep: Reputation: 0
You need two things. An interfaces file with the correct ip and gatway info and a firewall script which enables masquerading.

Your interfaces config file might look something like this:

auto eth0
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0

auto eth1
iface eth1 inet static
address 217.199.148.13
netmask 255.255.255.240
gateway 217.199.148.X

X, in this case, will be what your ISP assigns for your gateway.


Something like this for your firewall will be a start:

# flush the existing firewall rules
iptables -t nat -F
iptables -F
iptables -X

# MASQUERADE the connection (-j MASQUERADE).
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

# Turn on IP forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
 
  


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
Small Linux Router/firewall behind D-Link Hardware router dleidlein Linux - Networking 6 04-30-2007 05:12 AM
Linux Router & Netgear Wireless Router DMaCATO Linux - Wireless Networking 1 04-30-2004 09:16 AM
/etc/resolv.conf configuration when behind a router(not a linux router) rmanocha Linux - Networking 2 04-28-2004 01:52 AM
Linux Router robe8 Linux - Security 2 03-28-2004 09:49 PM
ADSL Router + Linux Router + LAN = HELP!!! linuxlois Linux - General 2 09-16-2003 08:24 AM

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

All times are GMT -5. The time now is 05:09 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