[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


500:  ppp0 to eth0

Posted on 2006-07-17
Medium Priority
Last Modified: 2010-08-05

I have set up 2 network cards, each with an individual IP address.

I also have a script that forwards all incoming traffic on "port a" to "port b".
I now want the script to port forward data from ppp0, port a ---->to------> eth0, port b.

How do I define whether it's ppp0 or eth0 I want the data to come from and go to?
Data can only come from ppp0 (3G card)
AND data can only go to LAN through eth0.

Understand? any clues?
Question by:smotbd
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
LVL 40

Expert Comment

ID: 17122722
You probably refer to

iptables filter rules, then -i  & -o specify the input & output interface for a FORWARD rule.


iptables -I FORWARD -i ppp0 -o eth0 -p tcp --dport 25 -j ACCEPT        

- would allow SMTP to pass on.
If this is not enough then please provide more details about what you want to pass on.

Author Comment

ID: 17123500
Well, I don't want to use iptables. I have written a PHP code that forwards data coming in on port a to port b.
This works fine if using just one network interface i.e. 3G card or ethernet. BUT I want to use both 3G and ethernet because I want a 3G connection for mobility and then have an ethernet connection from the mobile PC to another PC. So basically I want to forward data from my mobile PC to my other PC linked via ethernet. My PHP is running on my mobile PC and my other PC is listening a particular port for this data. The PHP does forward to port B of the other PC IP address but how will it know to use eth0 and not ppp0. Obviously only eth0 will have access to other PC as other PC not on internet(only connected to mobile PC) so how can I say - use eth) to forward data to tother PC? Will I need to or will it just try to network interface??

Thanks....bit confusing I know!

Author Comment

ID: 17123595
OK, what I should ask is this to make it simpler(same thing):
I have a PHP client running on a PC(call it PC1) that connects to two servers listening on a particular port.
This PC1 has a 3G card and an ethernet connection.
I want one connection to a server using 3G and another connection using ethernet.
I can get PHP to connect to both servers via 3G individually or via ethernet individuall......BUT..........

How do I get the PHP client to connect to server 1 via 3G and server 2 via ethernet? That is my problem!

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

LVL 40

Expert Comment

ID: 17124600
the the connecting part is simple:
  you connect to the intended node by IP, the IP routing layer should solve this for you
  just specify the address of the target.

If you need a specific route just add a host route:
   route add -host <ipaddress> dev eth0
   route add -host <ipaddress> dev ppp0

If you need to listen on a specific port try to "socket_bind" your socket to an address and port.
Use the ipaddress of the intended interface.
LVL 40

Expert Comment

ID: 17124610
BTW the route add's are not permanent, as given they work until reboot or
update of routing tables. with route add/del statements.

Author Comment

ID: 17130816
Thanks noci.......

Not by my PC for couple of days but will try end of week and will get back to you.
Think your suggestions should work...

Author Comment

ID: 17137036
So how would I make the 'route add....' pernament??? I need it to be pernament.

What do you mean by "-host <ipaddress>" ?? Is all that in the "" just the ip address.
Do I use "<" and ">" ?

Can you give example please so I can try it out when I'm by my linux PC tomorow.

Many thanks....(my linux skills is very ameture sorry!!)

LVL 40

Accepted Solution

noci earned 2000 total points
ID: 17142417
How to add to the permanent, depends on your distro....

in RH: /etc/sysconfig/network/routes (IIRC) or something very close to it.
in Suse some like wise file.

an example:

route add -host dev eth0

so no " and no < or > just the ip address.


Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

656 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