LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-30-2006, 08:44 AM   #1
steelback
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Rep: Reputation: 0
"in LAN" routing problem


I have a working router and some ports are forwarded to PCs in the network.
A redirecting rule:
(router):4662 -> 192.168.227.12:4662
Now i can connect from the world to the machine behind the router(217.75.151.157 and 192.168.227.20) (jule is a machine not from my LAN)
Code:
joro@jule:~$ telnet 217.75.151.157 4662
Trying 217.75.151.157...
Connected to 217.75.151.157.
Escape character is '^]'.
bla bla bla, the connection is working!!Q!!
Connection closed by foreign host.
joro@jule:~$
but i cant connect to the 217.75.151.157:4662 from the LAN (malkia is the router)
Code:
joro@malkia:~$ telnet 217.75.151.157 4662
Trying 217.75.151.157...
telnet: connect to address 217.75.151.157: Connection refused
joro@malkia:~$
The idea of this is allowing peer-to-peer programs(eMule) on my network, to contact each other using different ports on the router 217.75.151.157
 
Old 01-30-2006, 08:50 AM   #2
steelback
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Original Poster
Rep: Reputation: 0
here are the important 2 lines in my script:
Code:
iptables -t nat -A PREROUTING -p tcp --dport 4662 -j DNAT --to-destination 192.168.227.12:4662
iptables -A FORWARD -p tcp --dport 4662 -j ACCEPT
that is a piece of my iptables config file:
Code:
# Flush NAT in the beginning:
iptables -t nat -F
iptables -t nat -P PREROUTING DROP

iptables -t nat -A PREROUTING -i $INTERNAL -j ACCEPT # po dobre taka, shtoto inache si zapushvam dhcp-to

# ############################# forwarding ###########################
iptables -t nat -A PREROUTING -p tcp --dport 4662 -j DNAT --to-destination 192.168.227.12:4662
iptables -t nat -A PREROUTING -p udp --dport 4672 -j DNAT --to-destination 192.168.227.12:4672
iptables -t nat -A PREROUTING -p tcp --dport 4562 -j DNAT --to-destination 192.168.227.12:4562
iptables -t nat -A PREROUTING -p udp --dport 4572 -j DNAT --to-destination 192.168.227.12:4572
iptables -A FORWARD -p tcp --dport 4662 -j ACCEPT
# ############################ end forwarding ########################

iptables -A FORWARD -i $EXTERNAL -o $INTERNAL -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INTERNAL -o $EXTERNAL -j ACCEPT
iptables -t nat -A POSTROUTING -o $EXTERNAL -j MASQUERADE

Last edited by steelback; 01-30-2006 at 03:51 PM.
 
Old 01-30-2006, 09:51 AM   #3
carlmarshall
Member
 
Registered: Jan 2004
Location: North Yorkshire, UK
Distribution: Centos 5
Posts: 133

Rep: Reputation: 16
Probably more down to your router than the system. Try connecting to the internal IP address; if it works, it's the router.

Carl.
 
Old 01-30-2006, 03:35 PM   #4
steelback
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Original Poster
Rep: Reputation: 0
i can connect using the local IP
Code:
root@malkia:~# telnet 192.168.227.12 4662
Trying 192.168.227.12...
Connected to 192.168.227.12.
Escape character is '^]'.
i can connect using the local IP
Connection closed by foreign host.
root@malkia:~#
Yes, the problem must be in the configuration of iptables, but for me everything is clear?

Last edited by steelback; 01-30-2006 at 06:02 PM.
 
Old 01-31-2006, 03:34 AM   #5
carlmarshall
Member
 
Registered: Jan 2004
Location: North Yorkshire, UK
Distribution: Centos 5
Posts: 133

Rep: Reputation: 16
Sounds like it's not the iptables but that the router won't allow a reflective connection, i.e. internal -> external -> internal.
I've found that several routers can't handle this type of connection.

Carl.
 
Old 01-31-2006, 04:34 AM   #6
steelback
LQ Newbie
 
Registered: Jan 2006
Posts: 4

Original Poster
Rep: Reputation: 0
May be, I dont know. Any ideas how to solve my problem?

Joro
 
  


Reply



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
Problem with "3Com", "3CRSHPW_96 Wireless LAN PC Card " Adil_uk Linux - Wireless Networking 0 12-18-2005 05:45 PM
problem "make"ing gtk+ "/usr/bin/env: perl -w" caid Linux - Newbie 8 07-29-2005 04:51 AM
have to ping gateway to "kickstart" net connection and routing bPrompter Linux - Networking 0 01-19-2005 02:56 PM
Problem install LAN card "SMC1255TX" vanhelsing Linux - Hardware 0 07-11-2004 10:40 AM
LAN problem after "fixing" nforce drivers ChristophUoR Mandriva 0 03-03-2004 09:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:43 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