Chapter 12. Networking

Table of Contents
NAT and firewalling.
ISP filtering and shaping Gnutella traffic

NAT and firewalling.

This section only addresses IPv4. Some background on the Internet Protocol is needed. Most likely if you are having networking problems, you are on a private network. These addresses are found in "RFC 1918".

Start address End address CIDR range
10.0.0.0 10.255.255.255 10.0.0.0/8
172.16.0.0 172.31.255.255 172.16.0.0/12
192.168.0.0 192.168.255.255 192.168.0.0/16

There are only a limited amount of real (routeable) IP addresses and they cost money. In order to get around this, many networks use these private networks and a gateway connects them to the outside. The gateway will have at least two IP addresses. You can find the external IP address by visiting a web sight like http://www.portforward.com/english/routers/port_forwarding/routerindex.htm. This URL also contains instructions on how to configure most routers to forward ports.

A critical item to know is the port used by gtk-gnutella. It can be found using the Preferences item from the File menu or by pressing Control-p. The port is the "listen port" in the "network" tab. The ip address and port are also in the status bar separated by a colon. Finally, you can find the port with a shell command.


grep listen_port ~/.gtk-gnutella/config_gnet

The gateway will use network address translation or NAT for short. There are two types of NAT, source and destination NAT or simply SNAT and DNAT. DNAT is the appropriate technology to get gtk-gnutella working inside a translated network. Often NAT is combined with port blocking, more commonly known as firewalling. Changing the port that gtk-gnutella uses can avoid port blocking.

If your gateway uses iptables, it maybe as simple as adding a few rules to forward gtk-gnutella traffic on the gateway.


#
# DNAT rules to allow machines inside to act as servers on external ports.
#
EXTIF=ppp0
gtkg=192.168.0.111
port=6346

# Forward Gnutella traffic.
iptables -t nat -A PREROUTING -i $EXTIF -p udp --dport $port -j DNAT --to $gtkg
iptables -t nat -A PREROUTING -i $EXTIF -p tcp --dport $port -j DNAT --to $gtkg

NOTE: Many consumer firewall products refer to DNAT as "DMZ". This is the wrong nomenclature, but it maybe what you want.

gtk-gnutella development hosted bySourceForge.net Logo