LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-16-2020, 04:57 PM   #1
jplev22
Member
 
Registered: Dec 2003
Location: New Brunswick, Canada
Distribution: Debian 10 Buster
Posts: 85

Rep: Reputation: 16
Cannot ping second ethernet device


I am setting up an internal subnet on the second ethernet adapter of my server. The intent is to eventually route all that subnet's traffic though a tunnel.

However, I can't seen to get past the ethernet device.
(enp8s0=internal subnet eno1=subnet connected to wan)

Example:
Code:
$ ping -I enp8s0 192.168.190.20
PING 192.168.190.20 (192.168.190.20) from 192.168.192.1 enp8s0: 56(84) bytes of data.

--- 192.168.190.20 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 66ms
ip route:
Code:
default via 192.168.190.1 dev eno1 onlink 
192.168.190.0/24 dev eno1 proto kernel scope link src 192.168.190.20 
192.168.192.0/24 dev enp8s0 proto kernel scope link src 192.168.192.1
I also modified the iptables using:
Code:
$ sudo iptables -t nat -A POSTROUTING -j MASQUERADE
$ sudo iptables -A FORWARD -i enp8s0 -o eno1 -j ACCEPT
Confirmed ip forward is enabled:
Code:
$ sudo cat /proc/sys/net/ipv4/ip_forward
1
Any clue? Thanks for any input.
 
Old 04-16-2020, 07:47 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,403
Blog Entries: 28

Rep: Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166Reputation: 6166
What is the ip address you are pinging from?
 
Old 04-16-2020, 07:51 PM   #3
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,858

Rep: Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151
Well this won't work, you're specifying the wrong interface (based on your routing table)
Code:
$ ping -I enp8s0 192.168.190.20
In any case, no need to specify the interface. Just do...
Code:
ping 192.168.190.20

Last edited by ferrari; 04-16-2020 at 07:52 PM.
 
Old 04-16-2020, 08:36 PM   #4
jplev22
Member
 
Registered: Dec 2003
Location: New Brunswick, Canada
Distribution: Debian 10 Buster
Posts: 85

Original Poster
Rep: Reputation: 16
@frankbell I am pinging form 192.168.192.1. (IP associated with enp8s0)

@ferrari I though the "-I" flag meant ping from a specific device. Please correct my understanding if incorrect. Indeed ping 192.168.190.20 does work.

I do get the same negative result if I ping from a client on the 192.168.192.0/24 subnet.

Here's a ping & tcpdump for reference:

Code:
$ ping -I enp8s0 192.168.190.1
PING 192.168.190.1 (192.168.190.1) from 192.168.192.1 enp8s0: 56(84) bytes of data.
--- 192.168.190.1 ping statistics ---
438 packets transmitted, 0 received, 100% packet loss, time 909ms
Code:
$ sudo tcpdump -i enp8s0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp8s0, link-type EN10MB (Ethernet), capture size 262144 bytes
22:29:28.690616 ARP, Request who-has _gateway tell JPStudy, length 28
22:29:29.714679 ARP, Request who-has _gateway tell JPStudy, length 28
22:29:30.197417 IP 192.168.192.29.39276 > _gateway.domain: 46423+ TXT? push.apple.com. (32)
22:29:30.197472 IP 192.168.192.29.39276 > dns.google.domain: 46423+ TXT? push.apple.com. (32)
22:29:30.197489 IP 192.168.192.29.39276 > dns.google.domain: 46423+ TXT? push.apple.com. (32)
22:29:30.738623 ARP, Request who-has _gateway tell JPStudy, length 28
22:29:31.762621 ARP, Request who-has _gateway tell JPStudy, length 28
Running tcpdump on eno1, there is not one 192.168.192.x that appears.
 
Old 04-17-2020, 12:52 AM   #5
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,858

Rep: Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151
In this case only one interface (en01) can reach the target address. No routing is required, since the server is directly connected to the subnet belonging to the IP address of interest.

Last edited by ferrari; 04-17-2020 at 12:55 AM.
 
Old 04-17-2020, 12:59 AM   #6
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,858

Rep: Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151Reputation: 1151
Quote:
@ferrari I though the "-I" flag meant ping from a specific device.
No, it means interface. From 'man ping'...
Quote:
-I interface
interface is either an address, or an interface name. If interface is an address, it sets source address to specified interface address. If interface in an interface name, it sets source
interface to specified interface. For IPv6, when doing ping to a link-local scope address, link specification (by the '%'-notation in destination, or by this option) is required.
It really only has relevance if there are two or more routes to a given IP address from a given device (usually a router). The source address will be that of the interface the packet is being sent from.
 
Old 04-17-2020, 11:10 AM   #7
jplev22
Member
 
Registered: Dec 2003
Location: New Brunswick, Canada
Distribution: Debian 10 Buster
Posts: 85

Original Poster
Rep: Reputation: 16
Thank for the explanation.

Traffic is finally routed through my server:

NAT had to be setup in nftables
[code]
nft add table nat
nft add chain nat post { type nat hook postrouting priority 0 \; }
nft add chain nat pre { type nat hook prerouting priority 0 \; }
nft add rule nat post ip saddr 192.168.192.0/24 oif ono1 snat 192.168.190.20 [\code]

Now my lan clients have access to the internet. Thanks for your input.

Reference: http://computer-outlines.over-blog.com/article-nftables-6-a-nftables-linux-internet-gateway-123294152.html
 
  


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
[SOLVED] Server can ping clients, but clients cannot ping server and i cannot SSH into Server jzakharia Linux - Networking 5 07-05-2015 02:21 PM
Strange Ping Issue - Can't ping localhost but can ping others on LAN code_slinger Linux - Networking 15 03-30-2015 02:39 PM
I cannot ping with command 'ping IP' address but can ping with 'ping IP -I eth0' sanketmlad Linux - Networking 2 07-15-2011 05:32 AM
Ping PING Ping uid0sd Linux - Networking 1 02-13-2007 06:50 PM
cannot add second ip to the second nic card shardam *BSD 1 04-23-2005 12:30 AM

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

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