# Port forwarding with portfwd



## urello (Aug 7, 2013)

I'm using net/portfwd for forwarding ports. It worked fine for almost a week, then some ports became unreachable from Internet. I saw in /var/log/messages

```
Aug  7 16:48:41 freegtw portfwd[6419]: copy: Failure reading from socket: Bad file descriptor
Aug  7 16:48:41 freegtw portfwd[6419]: socket_close(): close() on socket FD 8 failed: Bad file descriptor
Aug  7 16:48:41 freegtw portfwd[6419]: socket_close(): close() on socket FD 7 failed: Bad file descriptor
Aug  7 16:49:20 freegtw portfwd[6425]: TCP pipe: Can't forward incoming connection from 192.168.1.179:42541 to any destination
Aug  7 16:49:23 freegtw portfwd[6425]: TCP pipe: Can't forward incoming connection from 89.252.4.131:63994 to any destination
Aug  7 16:50:47 freegtw portfwd[6425]: TCP pipe: Can't forward incoming connection from 89.252.4.131:64047 to any destination
Aug  7 16:51:41 freegtw portfwd[6419]: copy: Failure reading from socket: Bad file descriptor
Aug  7 16:51:41 freegtw portfwd[6419]: socket_close(): close() on socket FD 8 failed: Bad file descriptor
Aug  7 16:51:41 freegtw portfwd[6419]: socket_close(): close() on socket FD 7 failed: Bad file descriptor
Aug  7 16:53:59 freegtw portfwd[6425]: TCP pipe: Can't forward incoming connection from 89.252.4.131:64103 to any destination
Aug  7 16:55:36 freegtw portfwd[6425]: TCP pipe: Can't forward incoming connection from 89.252.4.131:64143 to any destination
Aug  7 16:57:23 freegtw portfwd[6425]: TCP pipe: Can't forward incoming connection from 195.238.92.101:33343 to any destination
```

portfwd.conf

```
user  nobody
group nobody
tcp {
        443 { => 192.168.1.106:443 };
        6563 { => 192.168.1.106:5900 };
        6569 { => 192.168.1.106:22 };
        3000 { => 192.168.1.106:3000 };
        3333 { => 192.168.1.106:3306 };
        8098 { => 192.168.1.106:8098 };
        80 { => 192.168.1.144:8085 };
        57266 { => 192.168.1.222:8080 };
        57265 { => 192.168.1.222:222 };
        6544 { => 192.168.1.56:5900 };
        6543 { => 192.168.1.56:8080 };
        10733 { => 192.168.1.144:10733 };
        19895 { => 192.168.1.144:5900 };
        21 { => 192.168.1.2:21 };
        5080 { => 192.168.1.2:80 };
        5001 { => 192.168.1.2:5001 }
}
```
After *I* restarted portfwd the problem has been solved. What could I do to prevent this from reocurring?
FreeBSD9.1 x64


----------

