LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Multiple Subnets same Eth. No PINGS ! (https://www.linuxquestions.org/questions/linux-networking-3/multiple-subnets-same-eth-no-pings-4175632240/)

melquisedec 06-19-2018 12:39 PM

Multiple Subnets same Eth. No PINGS !
 
Hi,


I have configured 3 different IP's on the same ETH:

eth0 Link encap:Ethernet HWaddr 00:50:56:A2:19:4C
inet addr:192.168.0.19 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:57565234 errors:0 dropped:0 overruns:0 frame:0
TX packets:54922960 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12028012936 (11.2 GiB) TX bytes:11920605780 (11.1 GiB)

eth0:1 Link encap:Ethernet HWaddr 00:50:56:A2:19:4C
inet addr:172.24.249.154 Bcast:172.24.249.155 Mask:255.255.255.252
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:2 Link encap:Ethernet HWaddr 00:50:56:A2:19:4C
inet addr:172.22.166.194 Bcast:172.22.166.195 Mask:255.255.255.252
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:3 Link encap:Ethernet HWaddr 00:50:56:A2:19:4C
inet addr:172.22.166.154 Bcast:172.22.166.155 Mask:255.255.255.252
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1


The routes are:

Destination Gateway Genmask Flags Metric Ref Use Iface
172.24.249.152 0.0.0.0 255.255.255.252 U 0 0 0 eth0
172.22.166.192 0.0.0.0 255.255.255.252 U 0 0 0 eth0
172.22.166.152 0.0.0.0 255.255.255.252 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0



The interfaces are good:

ping -c 2 172.24.249.154
PING 172.24.249.154 (172.24.249.154) 56(84) bytes of data.
64 bytes from 172.24.249.154: icmp_seq=1 ttl=64 time=0.067 ms
64 bytes from 172.24.249.154: icmp_seq=2 ttl=64 time=0.054 ms

ping -c 2 172.22.166.154
PING 172.22.166.154 (172.22.166.154) 56(84) bytes of data.
64 bytes from 172.22.166.154: icmp_seq=1 ttl=64 time=0.085 ms
64 bytes from 172.22.166.154: icmp_seq=2 ttl=64 time=0.040 ms

ping -c 2 172.22.166.194
PING 172.22.166.194 (172.22.166.194) 56(84) bytes of data.
64 bytes from 172.22.166.194: icmp_seq=1 ttl=64 time=0.042 ms
64 bytes from 172.22.166.194: icmp_seq=2 ttl=64 time=0.052 ms


But just the first one can ping to his gateway:

ping -c 2 172.24.249.153
PING 172.24.249.153 (172.24.249.153) 56(84) bytes of data.
64 bytes from 172.24.249.153: icmp_seq=1 ttl=255 time=0.389 ms
64 bytes from 172.24.249.153: icmp_seq=2 ttl=255 time=0.497 ms


the other ones:


ping -c 2 172.22.166.193
PING 172.22.166.193 (172.22.166.193) 56(84) bytes of data.
From 172.22.166.194 icmp_seq=1 Destination Host Unreachable
From 172.22.166.194 icmp_seq=2 Destination Host Unreachable

ping -c 2 172.22.166.153
PING 172.22.166.153 (172.22.166.153) 56(84) bytes of data.
From 172.22.166.154 icmp_seq=1 Destination Host Unreachable
From 172.22.166.154 icmp_seq=2 Destination Host Unreachable


I try to see the icmp traffic with TCPDUMP but just the first one have "traffic"


so what is the problem ? if I restart the server and I configure just the number 2, it works !


Best regards

nini09 06-19-2018 02:26 PM

How do you create eth0:1 interface?

scasey 06-19-2018 03:24 PM

I wouldn't think one can define three different subnets on the same NIC...there is only one cable, after all. How can that be connected to three different networks?

I'm guessing that the one that works is the one that's configure in the same subnet as the gateway.

Mayhaps someone who knows will jump in.

melquisedec 06-19-2018 09:38 PM

@nini9

I have created with ifconfig:

ifconfig eth0:1 172.24.249.154 netmask 255.255.255.252

ifconfig eth0:2 172.22.166.154 netmask 255.255.255.252

ifconfig eth0:3 172.22.166.194 netmask 255.255.255.252


@scasey

the cable is connected to a switch at the same time with the gateways. Basically the idea is just share the medium.

kaushalpatel1982 06-19-2018 11:19 PM

Do you have all routers in the same VLAN?

All Routers should be in the same vlan as your interface to get reply. Also check ARP response from router.

melquisedec 06-20-2018 07:59 AM

@kaushalpatel1982


Yes, all routers are in the same VLAN. I can't Understand that just first IP get response, when I use TCPDUMP I can see just traffic of first IP. I don't know why de O.S don't "send" anything by the ETH, maybe there is some misconfiguration in the kernel.

scasey 06-20-2018 09:18 AM

If you have mulitple IP addresses on one NIC, the IP that will be used is the one configured in the server.
I have one IP for mail, another for web server and ftp, others for DNS services, one exclusivly for ssh.
If I were to monitor the IP for mail, I'd not see any ftp or web traffic, for example.

Of course you are using different IPs in your ping command.

I seriously doubt there's an OS or kernel issue here.

What is in /etc/resolv.conf?

melquisedec 06-20-2018 09:43 AM

Hi Sean,

the /etc/resolv.conf has just my domain and DNS server. I have Firewalls with many virtual IP's with any trouble. I think the problem is in O.S because when I try ping to these gateways: 172.22.166.153 and 172.22.166.193, there is no activity in the ethernet ( I use tcpdump -I eth0 -n to check that). Obviously if you don't send anything to the LAN, it will no response.

Why Centos don't send anything through eth0 ? the ping just "died" in the O.S. What is really funny is the response to the broadcast address. Look tcpdump can "see" the icmp traffic to broadcast address like:

10:04:38.468523 IP 172.22.166.194 > 172.22.166.192: ICMP echo request, id 5231, seq 1, length 64
10:04:39.468369 IP 172.22.166.194 > 172.22.166.192: ICMP echo request, id 5231, seq 2, length 64
10:04:40.474902 IP 172.22.166.194 > 172.22.166.192: ICMP echo request, id 5231, seq 3, length 64


but there is any activity when I try to ping to gateway 172.22.166.193.


I can't understand!

scasey 06-20-2018 10:29 AM

So you're saying only the configuration for eth0:1 is working? Right? That's not the "first" IP, it's the third one.
There must be an issue with the routing, or the switch, or the gateway then.

My server is CentOS, and all five of the IP addresses work just fine, including the one on eth0...but then, they are all in the same netblock. Still, that would say that having multiple IP addresses on one NIC is not a problem for the OS.

I really can't help you with your multiple netblocks on one NIC much...and I've never seen a switch used to connect one computer to multiple gateways. (which is not to say it can't be done...I've just never seen it). My troubleshooting mojo just says it's not the OS, or, probably, even the server. Look elsewhere.

Oh! Oh! Why do you not have eth0:0 set? Try that. Skipping the first sub-ifcfg could be a problem.
Put 192.168.0.19 on eth0
172.24.249.154 on eth0:0
172.22.166.194 on eth0:1
172.22.166.194 on eth0:2

Also, I'm not sure how to check the gateway values...my server has a default line with the gateway (again, all using the same gateway) How does one specify multiple gateways in the routing table?

[Edit: my 1,000th post! We be havin' fun now!!]

nini09 06-21-2018 02:36 PM

I am not sure what is your exact requirement? The interface eth0:1 is VLAN interface name normally. If you use vconfig to create these three interfaces, such as eth0:10, eth0:11 and eth0:12. And then you can have multiple subnets on one physical interface, one on physical interface and other on VLAN interface.

melquisedec 06-21-2018 09:28 PM

hi

@Sean: your idea unfortunately did works.

@nini09: I can't use Vlan because the other endpoints can't tagging his packets

This strange configuration has as goal, the connection between 3 SIP Trunks over the same Router of the same ISP. The ISP just give me a router with 3 different ports, so there is 3 different cables (of the same router) connected to the switch. Each cable has his own subnet but Cantos can't manage these kind of "situation".

kaushalpatel1982 06-21-2018 11:20 PM

This might be the problem of ARP Flux. Run the commands given below :

Quote:

sysctl -w net.ipv4.conf.all.arp_announce=1
sysctl -w net.ipv4.conf.all.arp_ignore=2
Also do check at router side APR flux configuration.

scasey 06-23-2018 01:39 PM

Quote:

Originally Posted by melquisedec (Post 5870366)
@Sean: your idea unfortunately did works.

Which idea? "unfortunately did works" ?

melquisedec 06-25-2018 06:34 PM

Hi @kaushalpatel1982

I'll try morning, the server hat:

sysctl -a | grep net.ipv4.conf.all.arp_ignore
net.ipv4.conf.all.arp_ignore = 0

sysctl -a | grep net.ipv4.conf.all.arp_announce
net.ipv4.conf.all.arp_announce = 0

Hi Sean,

you said:

"Oh! Oh! Why do you not have eth0:0 set? Try that. Skipping the first sub-ifcfg could be a problem.
Put 192.168.0.19 on eth0
172.24.249.154 on eth0:0
172.22.166.194 on eth0:1
172.22.166.194 on eth0:2"

I try to use eth0:0 like you suggest, but it doesn't work!


All times are GMT -5. The time now is 06:43 PM.