LinuxQuestions.org
Help answer threads with 0 replies.
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 04-16-2015, 08:25 AM   #1
DenisM
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Rep: Reputation: Disabled
Question How to reply via interface that received a request, in CentOS 6?


A server has public and private interfaces. When I ping its public IP from another host in the same private network it replies via private interface and ping fails.
How to remember an interface that got request to reply back via than interface?
 
Old 04-16-2015, 08:29 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
What exactly are you trying to do? Are you using hostname or the IP address for ping. If you are using hostname and if your local DNS has got private IP against that hostname it will use that private IP.

Are you trying to say that pinging the host on public IP fails? If that is the case then you have to check with network team because when you try to ping a public IP the request is going to the internet and then coming back. If they have blocked ICMP response on router it will definitely fail.
 
Old 04-16-2015, 08:56 AM   #3
DenisM
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Question

Code:
+-----------+
| router    |
| 1.0.0.1   |
|192.168.0.1| ------------------+
+--|--|-----+                   |
   |  +-------+                 |
 eth0        eth1             eth0
1.0.0.2  192.168.0.2       192.168.0.3
+--|----------|-+            +--|-----+
|     server    |            | host   |
+---------------+            +--------+

Both server and host connected to the same router (via switch of course). When I ping 1.0.0.2 from the host, the server gets its private address 192.168.0.3, not NATed, and replies to private interface as well. And the host doesn't see the reply.

Last edited by DenisM; 04-16-2015 at 09:02 AM.
 
Old 04-16-2015, 09:21 AM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Quote:
Originally Posted by DenisM View Post
Code:
+-----------+
| router    |
| 1.0.0.1   |
|192.168.0.1| ------------------+
+--|--|-----+                   |
   |  +-------+                 |
 eth0        eth1             eth0
1.0.0.2  192.168.0.2       192.168.0.3
+--|----------|-+            +--|-----+
|     server    |            | host   |
+---------------+            +--------+

Both server and host connected to the same router (via switch of course). When I ping 1.0.0.2 from the host, the server gets its private address 192.168.0.3, not NATed, and replies to private interface as well. And the host doesn't see the reply.
Are you saying that when you ping 1.0.0.2 from 192.168.0.3 you get a reply from 192.168.0.2? What do you mean by host doesn't see the reply?
 
Old 04-16-2015, 09:38 AM   #5
DenisM
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thumbs down

Quote:
Are you saying that when you ping 1.0.0.2 from 192.168.0.3 you get a reply from 192.168.0.2? What do you mean by host doesn't see the reply?
The ping to be successful, the reply (pong) expected to be from 1.0.0.2, isn't it? So ping fails.
 
Old 04-16-2015, 09:43 AM   #6
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Did you try to use traceroute to see from where you are getting request timed out? That lead to another question do you get "request timed out" or "Destination host unreachable" when you ping?
 
Old 04-16-2015, 09:54 AM   #7
DenisM
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
It seems to me that you ask irrelevant questions, sorry.

1) traceroute:
traceroute to 1.0.0.2 (1.0.0.2), 30 hops max, 40 byte packets
1 192.168.0.1 (192.168.0.1) 0.269 ms 0.254 ms 0.270 ms
2 * * *
3 * * *
4 * * *

2) When ping doesn't get pong it prints nothing:

PING 1.0.0.2 (1.0.0.2) 56(84) bytes of data.

--- 1.0.0.2 ping statistics ---
11 packets transmitted, 0 received, 100 packet loss, time 10001ms
 
Old 04-16-2015, 10:07 AM   #8
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Quote:
Originally Posted by DenisM View Post
It seems to me that you ask irrelevant questions, sorry.

1) traceroute:
traceroute to 1.0.0.2 (1.0.0.2), 30 hops max, 40 byte packets
1 192.168.0.1 (192.168.0.1) 0.269 ms 0.254 ms 0.270 ms
2 * * *
3 * * *
4 * * *

2) When ping doesn't get pong it prints nothing:

PING 1.0.0.2 (1.0.0.2) 56(84) bytes of data.

--- 1.0.0.2 ping statistics ---
11 packets transmitted, 0 received, 100 packet loss, time 10001ms
I will ignore the comment "It seems to me that you ask irrelevant questions, sorry." because:

In my first post I have specifically asked you that what exactly you are trying to do? In response to that you have given me your network diagram and provided information about the network. Still you did not mention what exactly you want to do here

Next post I asked you to clarify: "Are you saying that when you ping 1.0.0.2 from 192.168.0.3 you get a reply from 192.168.0.2? What do you mean by host doesn't see the reply?"

And you are telling me about ping and pong. Let me make the things simple: your machine with one interface will only be able to ping on public interface if router allows. Router is used to separate broadcast domain basically two networks. So until and unless you have configured the router to allow communication between two network and allowed ICMP request flow it won't work.

Obviously your local network ping and pong will work because it falls in the same network and doesn't even have to go to the router (basically Layer 2 communication)

If you are still not sure then I have no idea how to explain.

Last edited by T3RM1NVT0R; 04-16-2015 at 10:10 AM.
 
Old 04-30-2015, 09:29 AM   #9
DenisM
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Solved

Add 2 lines to /etc/iproute2/rt_table:
Code:
1   Pub
192 Priv
Create 4 new files in /etc/sysconfig/network-scripts/ as follows:
Code:
route-eth0:
1.0.0.0/8 dev eth0 src 1.0.0.2 table Pub
default via 1.0.0.1 table Pub
Code:
route-eth1:
192.168.0.0/24 dev eth1 src 192.168.0.2 table Priv
default via 192.168.0.1 table Priv
Code:
rule-eth0
from 1.0.0.2 table Pub
Code:
rule-eth1
from 192.168.0.2 table Priv
Now reboot or `service network restart`.
 
  


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
webserver doesn't reply to external request but it reply's to local request ziba Linux - Server 4 05-11-2009 05:27 PM
kickstart error: No DHCP reply received iguthrie Red Hat 0 06-18-2007 09:48 AM
Warning: Received invalid reply digest from server ghabsh Linux - Server 1 05-02-2007 12:15 AM
appear to have received our own echo-reply aeh13_2000 Linux - Networking 3 08-17-2006 08:22 AM
web request and no reply linuxboy69 Linux - Networking 3 11-20-2003 03:47 AM

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

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