LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-06-2005, 07:01 AM   #1
wiki
LQ Newbie
 
Registered: Aug 2005
Location: Singapore
Distribution: Red Hat Enterprise Linux WS
Posts: 5

Rep: Reputation: 0
Networking 2 pc


Hi,

I am trying to setup a communication between 2 PC say PC1 and PC2 via ethernet using sockets. I've created a simple server program for PC1 and a client program for PC2 and is able to transmit data and echo back to the sender. However, when I swap the order (server program for PC2 and a client program for PC1), I encounter an error saying that "No route to host".
PC1 can ping to PC2 and vice versa, and so I suspect some mechanism is blocking the transmission.

Is there anyone who knows what could be the likely reason?
 
Old 09-06-2005, 07:27 AM   #2
mickyg
Member
 
Registered: Oct 2004
Location: UK
Distribution: Ubuntu/Kubuntu
Posts: 249

Rep: Reputation: 30
It may help if we knew what distribution you are using, an idea would be to update the "Distribution" field in your profile.

When you say "No route to host" error, is this an error produced from your program? Do both the server and client give the same error, does it only happen on the client side or server side?

What programming language are you using? What port is the app using? Have you checked firewall settings on either machine?
 
Old 09-06-2005, 10:17 PM   #3
wiki
LQ Newbie
 
Registered: Aug 2005
Location: Singapore
Distribution: Red Hat Enterprise Linux WS
Posts: 5

Original Poster
Rep: Reputation: 0
I am using Red Hat Enterprise Linux WS. I believe the fault is due to the firewire settings. As running the following command:

/etc/rc.d/init.d/iptables stop

will solve my problem and I can run both server/client program on either PC. The problem now is that this is not a permanent solution. As whenever I reboot, the firewalls are activated again. I try deciphering the iptables but some terms looks alien to me.

Can anyone advise me if I still want my firewall to be up, but I also want to allow access of a particular IP say 178.13.18.18 to my pc, how can I do it? And is there a permanent solution that allow a particular IP to access my pc even after rebooting? Please enlighten me. Thanks!




Qn1:What programming language are you using?
I am using C++ with cross complier.

Qn2:What port is the app using?
I randomly select a port greater than 1023.
 
Old 09-11-2005, 07:56 AM   #4
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hi wiki,
it's obvious that your firewall is blocking your connection. first of all you must issue the command "iptables -F" which will flush your default iptables that was setup when you installed your OS. after that you have to save your changes by issuing the command " service iptables save". this will save the configuration,. after that you have to configure the new rules. you must issue the command
" iptables -I INPUT -d 'your ip' -j REJECT" . then add this command also..
" iptables -I INPUT -d 178.13.18.18 -j ALLOW".
Remember this will block every connection from any systems except 178.13.18.18.
Another very important configuration that i have to suggest is that you dont flush ur default iptables using the command " iptables -F". let it stay.. you just that issue the command " iptables -I INPUT -d 178.13.18.18 -j ALLOW".
now your 178.13.18.18 will be allowed in. after that always remember to save the service using the command " service iptables save" and restart it using " service iptables restart". this must solve your problem .......
please feel free to contact
vimal........
 
Old 09-12-2005, 10:51 PM   #5
wiki
LQ Newbie
 
Registered: Aug 2005
Location: Singapore
Distribution: Red Hat Enterprise Linux WS
Posts: 5

Original Poster
Rep: Reputation: 0
Hi Vimal,

Thanks a lot! Your suggestion work very well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
networking mifan Mandriva 3 08-18-2005 09:52 AM
new to networking essoft478 Linux - Networking 2 12-18-2004 05:20 PM
networking thornton Linux - Networking 1 07-10-2004 02:00 AM
Random Networking to Non-Networking o-o Ne0BDP Slackware 3 07-08-2004 02:18 AM
networking garr71 Linux - Networking 2 11-29-2001 01:21 AM

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

All times are GMT -5. The time now is 02:54 AM.

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