The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IPChains::PortFW - Perl module to manipulate portfw masquerading table.

SYNOPSIS

  my $masq = new IPChains::PortFW( option => value, ... );
  $masq->append();

DESCRIPTION

IPChains::PortFW is an perl interface to the linux kernel port forwarding facility. You must have ipmasqadm and the portfw module installed for this module to work. A kernel compiled with CONFIG_IP_MASQUERADE_IPPORTFW would also helps.

It has a similar interface than the IPChains(3) module. You create an IPChains::PortFW object with new(), you can query or set attributes with the attribute() method and you add or deletes the port forwarding rules using append() or delete().

ATTRIBUTES

Here are the attributes valids for IPChains::PortFW.

LocalAddr

This is the local address from which packets will be redirected.

LocalPort

This is the port from which packets will be redirected.

RemAddr

This is the address to which the packets will be forwarded to.

RemPort

This is the port to which the packets will be forwarded to.

Pref

This is a preferences value used for load balancing in the case when there are many possible remote destinations.

METHODS

new( [options], ... )

Create a new IPChains::PortFW object and sets its attributes.

attribute( attribute [, value] )

Get or sets an attribute. Use undef to delete a value.

clopts()

Unset all attributes.

append()

Append a rule to the port forwarding masquerade table as specified by the attributes of the current objects.

delete()

Deletes entries in the port forwarding masquerade table. The entries matching the attributes will be deleted.

flush()

Removes all entries from the port forwarding masquerade table.

list()

Returns an array of IPChains::PortFW objects. One for each entries in the port forwarding table.

EXAMPLE

Redirecting http protocol to internal web server.

my $portfw = new IPChains::PortFW( Proto => 'udp', LocalAddr => '199.168.1.10', LocalPort => 80, RemAddr => '10.0.0.1', RemPort => 80 );

$portfw->append;

AUTHOR

Francis J. Lacoste <francis@insu.com>

COPYRIGHT

Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms as perl itself.

SEE ALSO

IPChains(3)