Solved

route based on incoming interface

Posted on 2004-08-18
5
356 Views
Last Modified: 2008-01-09
I have two modem connections to two isp's
I also have two ip's on one interface - eth0 and eth0:1 connected to a local network

What i need to figure out is how to establish routing so that traffic coming into eth0 goes out ppp0 and traffic coming into eth0:1 goes out ppp1 (as well as their returned packets)





                                                                                                       
0
Comment
Question by:xscousr
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:pablouruguay
ID: 11836199
Yes.   Set the default gateway for the router to point up PPP0
link, and use iptables SNAT to set all packets to have source address ppp1
0
 
LVL 14

Expert Comment

by:pablouruguay
ID: 11836269
you have a solution for brabard i recommend to read it

http://www.experts-exchange.com/Networking/Linux_Networking/Q_21064680.html
0
 
LVL 2

Author Comment

by:xscousr
ID: 11840608
squid won't solve the issue.

Not only do i have http traffic coming in i also have two sendmail servers running, each masqing and using it's isp's mailserver as a smart host, one on each eth. With this each incoming needs to go out vi it's assigned ppp connection so that it will be coming from within the isp's block and be accepted by their mail server.

so
                25
 ------->| eth0    | --------->ppp0 ---------> Internet
              | 80      |
              |           |
              |  26     |
 ------->| eth0:1 | --------->ppp1 ---------> Internet
                 8080  
0
 
LVL 6

Accepted Solution

by:
de2Zotjes earned 300 total points
ID: 11856341
You need "advanced routing":
http://www.lartc.org/howto/lartc.rpdb.html

You will have to use iptables to set a mark on the packets based on the incomfing interface.

Then you create 2 extra routing tables (one for each mark)

Last you setup the main routng tables to jump to the proper table based on the mark set by iptables.

Rough guide to the commands:
iptables -t mangle -A PREROUTING -i eth0 -j MARK --set-mark net0
(same for eth1, you can refine by not setting the mark for packets destined to the local nets (-d ! lnet)

ip route add default via ip-ppp0 dev ppp0 table side0
ip route add default via ip-ppp1 dev ppp1 table side1

ip rule add fwmark net0 table side0
ip rule add fwmark net1 table side1

I did not test this solution, but it looks sane and should work.
0
 
LVL 2

Author Comment

by:xscousr
ID: 11873386
thanks de2Zotjes
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now