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.1
ort 80 listens <--- incomming connection from 192.168.0.200
>
> 192.168.0.1
ort 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