LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-13-2006, 03:30 PM   #1
ricka
LQ Newbie
 
Registered: Aug 2004
Location: Atlanta, GA
Distribution: Suse 10.1
Posts: 11

Rep: Reputation: 0
IP Masquerading/UPnP problem - port not forwarding through multiple NATs


So here is my setup. I am piggybacking wireless from a friend of mine, but I want to have my own internal wireless network as well that is secure from him. Currently, my Suse 10.1 box is logged into his wireless router and doing IP Masquerading/DHCP to my wireless router so that my other computers/printers are seperate from his stuff.

Now to the problem. I am trying to get Azureus to work (read no NAT errors) on my windows computer that connects to my wireless router. The linux box doing the routing has no problems as I just allowed the Azureus port in my firewall. I thought that would also allow my windows computer to not have problems, but it is getting NAT errors. I don't believe the problem is on my wireless router, because if I try to make my linux box listen on the same port that the windows box is listening on, I get a message from Azureus "UPnP: Mapping 'Nat Tester (TCP/#####)' has been reserved by 'xxx.xxx.xx.xx' - please select a different port." Also, I am able to telnet to that port on the windows machine from my linux box.

I'm no UPnP expert, but it seems that either
A) my linux firewall is allowing traffic to itself but not to other computers on the WLAN or
B) there is some problem with UPnP and multiple layers of NAT (his wireless NAT to my wireless NAT)


If you have somehow managed to read this far, I could really use any thoughts or suggestions as to how I can get to the bottom of this. I'm not quite a newbie, but I'm certainly no expert either and I could use all input.
 
Old 12-14-2006, 08:14 AM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Can you please specify your network topology in ip schema ?
 
Old 12-14-2006, 08:55 PM   #3
ricka
LQ Newbie
 
Registered: Aug 2004
Location: Atlanta, GA
Distribution: Suse 10.1
Posts: 11

Original Poster
Rep: Reputation: 0
So it goes Internet -> my friends wireless router 192.168.1.1/255.255.255.0 -> my linux box doing IP masq/DHCP to my router 192.168.10.5/255.255.255.0 -> the other machines on my LAN. My Linux box wireless card is assigned a dynamic IP on my friends router and the ethernet card is acting as the gateway so I made it's IP static at 192.168.10.1. If that is too confusing I can try to draw it up in visio or paint or something.

Since you are asking, does the subnet mask have something to do with this? I'm no network guru but I thought this is how it should be set up (not the same octet but same subnet mask.) Again, any and all input is appreciated.
 
Old 12-15-2006, 07:18 AM   #4
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
In this case; at first, you windows client would be having your linux box as its gateway & then you windows box would be having the dns server ip specified as well, then you'd be doing MASQUAREDING at your linux router while you recieve requests from your windows client & then your wireless router would be forwarding these MASQd packets to your friends wireless router & there he would be doing another MASQ or SNATing to let these packets out.

Is this the path you guys are following ?

Btw are you experiencing problems only in the case of P2P connections only or the internet from your windows client is not working as well ?
 
Old 12-15-2006, 02:33 PM   #5
ricka
LQ Newbie
 
Registered: Aug 2004
Location: Atlanta, GA
Distribution: Suse 10.1
Posts: 11

Original Poster
Rep: Reputation: 0
Yes, this is the path that we are following. My windows clients have access to the Internet, and as far as I can tell, this UPnP port problem back to my windows clients is the only problem with the setup. I bet if we went the static IP route then I could forward ports at each firewall and make it work, but my friend doesn't want to do that, and I was trying to see if we could get it working with DHCP all around. The only apps I need this for would be ones that utilize UPnP (Azureus and possibly an xbox 360 in the future...).

I have read a little bit about a package called linux-igd. It seems to solve some people's problems with UPnP, but that message I got from Azureus in the first post is making me thing I don't need that. I don't know much about Azureus, but somehow must have known that my windows machine was reserving that port via UPnP. I'm guessing it tried to reserve it at my friends router and got denied. That means the messages are probably getting out to reserve the port, but not getting back in somehow. And the fact that UPnP works when connecting to his router leads me to believe that possibly my firewall is blocking those requests, even though I have specifically allowed them in my firewall. I may try to install this linux-igd and see what I can get done with it. I'm also no networking guru, but I'm going to attempt to learn how to use ethereal and see if I can see what is going on.

Thank you for your help, and if you have any other suggestions or thoughts, keep em coming while I get back to you to see if any of this works.
 
Old 12-16-2006, 10:23 AM   #6
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
In this case; for the troubleshooting part, lets go hop by hop. As your linux router sits infront of your windows box at first place, we'll start tcpdump'ing the packets here at first, use the "tcpdump -nn > output-file" & post it here during your p2p application tries to connect.

Kindly also post the output of iptables -nvL & iptables -t nat -nvL from your linux router box.
 
Old 12-17-2006, 11:05 PM   #7
ricka
LQ Newbie
 
Registered: Aug 2004
Location: Atlanta, GA
Distribution: Suse 10.1
Posts: 11

Original Poster
Rep: Reputation: 0
I did not know how much of the tcpdump you would need, so I made sure it caught enough, but the output it too much to post here so I have linked it at http://joslnx.no-ip.org/bb/out.txt

The output from the iptables -nvL is as follows
Code:
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  131  9032 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
 2812 1020K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
   32  4601 input_int  all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           
  146 24313 input_ext  all  --  ath0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 input_ext  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-IN-ILL-TARGET ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  249 11948 TCPMSS     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp flags:0x06/0x02 TCPMSS clamp to PMTU 
    0     0 ACCEPT     all  --  xenbr0 xenbr0  0.0.0.0/0            0.0.0.0/0           
 4119 2191K forward_int  all  --  eth0   *       0.0.0.0/0            0.0.0.0/0           
 3635 1992K forward_ext  all  --  ath0   *       0.0.0.0/0            0.0.0.0/0           
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-FWD-ILL-ROUTING ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  132  9072 ACCEPT     all  --  *      lo      0.0.0.0/0            0.0.0.0/0           
 3841 2303K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW,RELATED,ESTABLISHED 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-OUT-ERROR ' 

Chain forward_ext (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 0 
   59  4633 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 3 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 11 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 12 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 14 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 18 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 3 code 2 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 5 
    0     0 ACCEPT     all  --  *      ath0    0.0.0.0/0            0.0.0.0/0           state NEW,RELATED,ESTABLISHED 
 3576 1988K ACCEPT     all  --  ath0   *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 PKTTYPE = multicast LOG flags 6 level 4 prefix `SFW2-FWDext-DROP-DEFLT ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           PKTTYPE = multicast 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-FWDext-DROP-DEFLT ' 
    0     0 LOG        icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-FWDext-DROP-DEFLT ' 
    0     0 LOG        udp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-FWDext-DROP-DEFLT ' 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 state INVALID LOG flags 6 level 4 prefix `SFW2-FWDext-DROP-DEFLT-INV ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain forward_int (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 0 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 3 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 11 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 12 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 14 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 18 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 3 code 2 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 5 
 4119 2191K ACCEPT     all  --  *      ath0    0.0.0.0/0            0.0.0.0/0           state NEW,RELATED,ESTABLISHED 
    0     0 ACCEPT     all  --  ath0   *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 PKTTYPE = multicast LOG flags 6 level 4 prefix `SFW2-FWDint-DROP-DEFLT ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           PKTTYPE = multicast 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-FWDint-DROP-DEFLT ' 
    0     0 LOG        icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-FWDint-DROP-DEFLT ' 
    0     0 LOG        udp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-FWDint-DROP-DEFLT ' 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 state INVALID LOG flags 6 level 4 prefix `SFW2-FWDint-DROP-DEFLT-INV ' 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain input_ext (2 references)
 pkts bytes target     prot opt in     out     source               destination         
    7   546 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           PKTTYPE = broadcast udp dpt:137 
    3   645 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           PKTTYPE = broadcast udp dpt:138 
    0     0 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           PKTTYPE = broadcast 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 4 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           icmp type 8 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 0 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 3 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 11 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 12 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 14 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 18 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 3 code 2 
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED icmp type 5 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:28171 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:28171 
   11   576 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:32585 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
   34  1788 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:32585 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:5801 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:5801 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:5901 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:5901 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:445 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:445 
    1    48 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:139 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
    1    48 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:139 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp dpt:22 flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-ACC-TCP ' 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:22 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:28171 
   43  5656 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:32585 
    7  1573 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:138 
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:137 
    0     0 reject_func  tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:113 state NEW 
    5  1505 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 PKTTYPE = multicast LOG flags 6 level 4 prefix `SFW2-INext-DROP-DEFLT ' 
   31 10691 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           PKTTYPE = multicast 
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 tcp flags:0x17/0x02 LOG flags 6 level 4 prefix `SFW2-INext-DROP-DEFLT ' 
    0     0 LOG        icmp --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-INext-DROP-DEFLT ' 
   11  1419 LOG        udp  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 LOG flags 6 level 4 prefix `SFW2-INext-DROP-DEFLT ' 
    0     0 LOG        all  --  *      *       0.0.0.0/0            0.0.0.0/0           limit: avg 3/min burst 5 state INVALID LOG flags 6 level 4 prefix `SFW2-INext-DROP-DEFLT-INV ' 
   20  3366 DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain input_int (1 references)
 pkts bytes target     prot opt in     out     source               destination         
   32  4601 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           

Chain reject_func (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REJECT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with tcp-reset 
    0     0 REJECT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable 
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-proto-unreachable
The output from the iptables -t nat -nvL is as follows:
Code:
Chain PREROUTING (policy ACCEPT 29534 packets, 7804K bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 214 packets, 27250 bytes)
 pkts bytes target     prot opt in     out     source               destination         
 1519  119K MASQUERADE  all  --  *      ath0    0.0.0.0/0            0.0.0.0/0           

Chain OUTPUT (policy ACCEPT 32586 packets, 2853K bytes)
 pkts bytes target     prot opt in     out     source               destination
 
Old 12-18-2006, 04:53 PM   #8
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Ricka,
Your own linux router's firewall doesnt stand as any bottleneck & nor did your tcpdump log suggested any problems. In fact i can see your box, 192.168.1.59 sending packets to too many peers in form of udp & until this linux router i have seen about 40% replies of these outbound udp packets also. The other thing i have noticed is that all your packets from windows box are being generated & rxd at port nos 28171. So until here everything is well. Now you got to make sure that you are actually recieving all these packets at your windows box itself. You can use any packet logger(ethereal is available for windows) to confirm that as well. Though i think that would'nt be the case.

Did you tried disabling the upnp functionality at your azureus also ? What exactly the NAT tester says at azureus ?

Hey btw i do not know anything about azureus, but at communication level.. things look fine from the tcpdump log & iptables rules.
Did you see this link until now http://www.azureuswiki.com/index.php/NAT_problem, do see maybe you can find something interesting.
 
  


Reply

Tags
masquerading, nat



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Port Forwarding and multiple gateways eqxro Linux - Networking 4 01-28-2006 09:32 AM
port forwarding or masquerading? rdrs Linux - Networking 3 08-14-2005 04:42 PM
port forwarding with iptables and multiple ethernet interf. CleonII Linux - Security 8 04-15-2005 08:27 AM
upnp multicast forwarding on linux saads Linux - Networking 0 01-26-2005 02:34 AM
ICS with multiple IP-s and multiple NATs arka Linux - Networking 2 06-02-2003 12:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration