Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-01-2013, 09:56 AM   #1
LQ Newbie
Registered: May 2009
Posts: 14

Rep: Reputation: 0
2 NIC card routing table

I want to make one linux machine. it has two NIC cards, one for use for pppoe(em1) connection and other(p2p1) for use dhcp for lan user, can anyone help for make the routing table for use the internet of lan users.
Old 04-01-2013, 09:59 AM   #2
Registered: Mar 2013
Location: ahmedabad
Distribution: CentOS, Ubuntu, Debian
Posts: 92
Blog Entries: 1

Rep: Reputation: Disabled
you have to setup iptables rule for that with natting........

#iptables -I INPUT -P all -j ACCEPT
#iptables -I OUTPUT -P all -j ACCEPT
#iptables -I FORWARD -P all -j ACCEPT
#iptables -t nat -I POSTROUTING -j MASQUERADE
#service iptables save
Old 04-01-2013, 02:15 PM   #3
LQ Newbie
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
You would also need to make sure you DHCP config has a routers option to tell your DHCP clients (LAN users) their default route is the IP on your p2p1 interface. As well, the box itself will need a default route to the what ever is assigned by your PPPoE.

I generally prefer to make my iptables much more restrictive than that. (And the -P all fails on my CentOS 6.4) At a minimum, I would recomend changing the last iptables statement to something like the following:

To limit NAT to traffic recieved from a given interface.
iptables -t nat -I POSTROUTING -i p2p1 -j MASQUERADE


To Limit NAT to traffic from a particular subnet
iptables -t nat -I POSTROUTING -s -j MASQUERADE.
substitute the with whatever address space your LAN users are using.

You probably would not need the "iptables -I INPUT" & "iptalbes -I OUTPUT" lines.

You may also need to edit /etc/sysctl.conf
Look for a line with :
net.ipv4.ip_forward = 0

change the 0 to a 1
net.ipv4.ip_forward = 1

If you don't find it, add it.

then run:
sysctl - p /etc/sysctl.conf


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
IP Table and routing table thirstonlinux Linux - Newbie 1 02-05-2013 05:28 AM
ARP table or routing table consulted first? YaMaHaBoB Linux - Networking 4 07-15-2011 05:56 PM
How to adjust routing of external packets to one NIC instead of another NIC? rfreiberger Linux - Newbie 3 04-14-2010 02:20 PM
routing table selie Linux - Networking 2 05-04-2007 10:12 AM
Debian 3 NIC static routing table crashsystems Linux - Networking 3 11-09-2006 01:58 AM > Forums > Linux Forums > Linux - Newbie

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

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