?
Solved

500:  ppp0 to eth0

Posted on 2006-07-17
8
Medium Priority
?
488 Views
Last Modified: 2010-08-05
Hi,

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".
BUT
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?
Thanks
0
Comment
Question by:smotbd
[X]
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
8 Comments
 
LVL 40

Expert Comment

by:noci
ID: 17122722
You probably refer to

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

like:

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.
0
 

Author Comment

by:smotbd
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!
0
 

Author Comment

by:smotbd
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!



0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Expert Comment

by:noci
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
or
   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.
0
 
LVL 40

Expert Comment

by:noci
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.
0
 

Author Comment

by:smotbd
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...
0
 

Author Comment

by:smotbd
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!!)




0
 
LVL 40

Accepted Solution

by:
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 172.16.1.25 dev eth0

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

0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

800 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