Networking Forums

Networking Forums > Computer Networking > Linux Networking > Controlling accepted source port

Reply
Thread Tools Display Modes

Controlling accepted source port

 
 
Rick Lim
Guest
Posts: n/a

 
      08-21-2003, 01:09 PM
Hi there,

How can I control which port the kernel uses as a source port for source
port?

for example you would have something like a web server which listens on
port 80, accepts an incomming connection an uses only port 5050 for the
source port for the accepted connection.

i.e.

192.168.0.1ort 80 listens <--- incomming connection from 192.168.0.200

192.168.0.1ort 5050 serves page ---> to 192.168.0.200

If you can direct me to any books to read it would be greatly appreciated.

Thanks.

 
Reply With Quote
 
 
 
 
Alexander Clouter
Guest
Posts: n/a

 
      08-21-2003, 03:54 PM
In article <(E-Mail Removed)>, Rick Lim wrote:
> Hi there,
>
> How can I control which port the kernel uses as a source port for source
> port?
>
> for example you would have something like a web server which listens on
> port 80, accepts an incomming connection an uses only port 5050 for the
> source port for the accepted connection.
>
> i.e.
>
> 192.168.0.1ort 80 listens <--- incomming connection from 192.168.0.200
>
> 192.168.0.1ort 5050 serves page ---> to 192.168.0.200
>
> If you can direct me to any books to read it would be greatly appreciated.
>

You might be able to get a webserver to do this, however it would be simpler
to just use iptables. An example command would simply be:

iptables -I INPUT --dport 80 --sport ! 5050 -j REJECT

The above command will let any host talk to the local machines port 80 if
their source port is 5050, regardless of their source ip address.

I recommend you read up on the networking documentation at http://tldp.org/

Regards

Alex
 
Reply With Quote
 
Rick Lim
Guest
Posts: n/a

 
      08-22-2003, 01:29 PM
I don't want to use iptables or a nat box, I want a box that will just
sit on a network and listen for requests on one port, but reply with the
data on a specified port.

Alexander Clouter wrote:
> In article <(E-Mail Removed)>, Rick Lim wrote:
>
>>Hi there,
>>
>>How can I control which port the kernel uses as a source port for source
>>port?
>>
>>for example you would have something like a web server which listens on
>>port 80, accepts an incomming connection an uses only port 5050 for the
>>source port for the accepted connection.
>>
>>i.e.
>>
>>192.168.0.1ort 80 listens <--- incomming connection from 192.168.0.200
>>
>>192.168.0.1ort 5050 serves page ---> to 192.168.0.200
>>
>>If you can direct me to any books to read it would be greatly appreciated.
>>

>
> You might be able to get a webserver to do this, however it would be simpler
> to just use iptables. An example command would simply be:
>
> iptables -I INPUT --dport 80 --sport ! 5050 -j REJECT
>
> The above command will let any host talk to the local machines port 80 if
> their source port is 5050, regardless of their source ip address.
>
> I recommend you read up on the networking documentation at http://tldp.org/
>
> Regards
>
> Alex


 
Reply With Quote
 
Alexander Clouter
Guest
Posts: n/a

 
      08-22-2003, 02:48 PM
In article <(E-Mail Removed)>, Rick Lim wrote:
> I don't want to use iptables or a nat box, I want a box that will just
> sit on a network and listen for requests on one port, but reply with the
> data on a specified port.
>

grrrrr you must not also send e-mails, repeat to your self twenty times!

Well depending on the server, you cannot do it with out just simply
redirecting the client to the different port and run your server there. I am
curious what you are trying to do with this as I see very little point in
what you are trying to accomplish.

It would help lots if you could describe why you were doing this?

The problem is you would have to write the client program to then expect the
data to come back on port 5050, which would involve a brand new startup of
TCP etc etc etc.

The only thing I know that does this is active mode FTP....

Regards

Alex
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Source port of 1079 (asprovatalk) to destination port 1025 (blackjack) - required for Microsoft Windows networking? Spin Windows Networking 1 10-07-2008 08:09 PM
Source code for controlling ethernet card in DOS? Jonas.L.Larsson@gmail.com Windows Networking 2 10-29-2007 03:21 PM
port redirect not accepted? Laurens Linux Networking 2 03-19-2007 10:45 AM
Controlling bandwidth per port on a gateway/router Sandmaneo Windows Networking 2 09-05-2006 05:32 PM
Controlling port blocking with web interface Nathan Funk Linux Networking 4 01-19-2006 12:16 AM



1 2 3 4 5 6 7 8 9 10 11