NETFWD(1)

NAME
netfwd - network traffic forwarder

SYNOPSIS
netfwd [-d] [-q | -v] local_address remote_address

DESCRIPTION
The netfwd command accepts network traffic on local_address and forwards it to remote_address.

The options are as follows:

-d  Daemon mode. netfwd detaches itself from the controlling terminal and runs in the background. All messages are written to the syslog using LOG_DAEMON.

-q  Quiet mode. Suppress all messages. By default, warnings and errors are turned on.

-v  Verbose mode. Causes netfwd to print debugging messages about connections.

Format of local_address:
[-s bind_address] [inet|inet6] tcp|udp port
unix stream|dgram path
tty path tty_settings

Format of remote_address:
[inet|inet6] tcp|udp host port
unix stream|dgram path
tty path tty_settings

TTY settings:
baudrate,databits,parity,stopbits,flowcontrol

baudrate: any value like 9600, 19200, 115200...
databits: 5|6|7|8
parity: E|O|N (E - even, O - odd, N - none)
stopbits: 1|1.5|2
flowcontrol: X|H|N (X - Xon/Xoff, H - full hardware, N - none)

Any tty_settings parameter can be omitted. The default tty_settings is 115200,8,N,1,H.

netfwd supports IPv4, IPv6 and unix address families. Also netfwd can forward data to and from tty devices (e.g. cua(4) ). If address family is omitted, all IPv4 and IPv6 addresses are used for accepting connections and any of them is used for connecting. Remote_address doesn't depend on local_address. So you can, for example, forward TCP traffic into Unix socket and vice versa.

EXAMPLES

You have a couple of applications that use unix socket to communicate with each other. But you want to run them on separate computers. To achieve this, do the following: On computer, where one of applications creates server unix socket:

    # netfwd inet tcp 5555 unix stream /path_to_socket

On another computer:

    # netfwd unix stream /path_to_socket inet tcp 1st_host 5555

So, when the second application connects to local unix socket, it automatically connects to the remote computer to 5555 TCP port. And all communication will be done as if they were on one computer.

Another example is when you need to connect two serial devices, but cable length does not allows you to do this, or you need to connect devices wirelessly. Plug the first device into serial port of the first computer and do the following:

    # netfwd tcp 2222 tty /dev/cua00 115200,8,N,1,H

Then plug the second device into serial port of the second computer and do the following:

    # netfwd tty /dev/cua00 115200,8,N,1,H tcp first.host.com 2222

After this, the second computer connects to the first computer over TCP/IP and they start exchanging serial data.

AUTHORS
netfwd was written from scratch by Alexey Vatchenko <av@bsdua.org>.

BUGS
netfwd doesn't try all host's addresses when connection to the first address is failed. Also netfwd doesn't support broadcast sending. netfwd doesn't remove unix socket after termination.