Solved

route based on incoming interface

Posted on 2004-08-18
5
371 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
UPD maximums on Red Hat 6 110
Cant reach dockers repository (pull command) 11 86
Linux Networking : What is of bond interface & when it will be useful 18 91
Linux SSH Error 9 98
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 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

20 Experts available now in Live!

Get 1:1 Help Now