Skip to contentSkip to conversation

ip_nat_irc

DISCUSSION Harald Welte 1 participant 1 message Jun 17, 2003 1 message not in the archive netfilter

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · Tero Jänkä

Hello there.

Could you tell me how ip_nat_irc works? For the last two days I've been reading different HOWTOs, asking people on IRC etc. and I just can't get it work.

Well, certainly I can tell you how it is implemented - but I don't see how this would help you...

Quoted 2 lines

My situation is this. An external firewall, not controlled by me, is blocking all connections to my machine's tcp ports, except port 993.

ok.

Quoted 2 lines

Therefore I would like to use ip_nat_irc to translate my DCC send and CHAT offers to use port 993. Is it possible with ip_nat_irc and SNAT?

No, at leat not without modifying the code. And you can most likely only do it on an intermediate router/firewall, not on the IRC client machine itself.

Quoted 7 lines

I added an iptables rule "/sbin/iptables -t nat -I POSTROUTING 1 -p tcp -s 130.232.130.88 -j SNAT --to-source 130.232.130.88:1024-2048". 130.232.130.88 is the machine's own IP. Then I did "/sbin/modprobe ip_conntrack_irc" and "/sbin/modprobe ip_nat_irc", connected to an irc-server port 6667 and sent a dcc send offer to myself, yet the port in the received dcc send offer was beyond the range of 1024-2048. What am i doing wrong here? (How does ip_nat_irc work?)

It works just like any other NAT helper module we have in netfilter. Please see the netfilter hacking HOWTO about some information on this topic.

The piece of code you might want to modify is about line 125 in ip_nat_irc.c, the function is irc_data_fixup(). It basically tries to find an unused port number. If you hardcode this to port 993 and fail if this port is unavailable, you end up with what you wanted to do.

If you are talking about a single irc client on a single machine, it might sound way better to hack the irc client instead of the kernel firwealling code, however.

Quoted 1 line

Tero Jänkä

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie