LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Reply on same network interface (UDP) (https://www.linuxquestions.org/questions/linux-networking-3/reply-on-same-network-interface-udp-4175622835/)

SBond87 02-01-2018 01:50 AM

Reply on same network interface (UDP)
 
Hello together,

is it possible to reply all incoming packets/request on the same network interface?

This is my setting:
I have a headless Raspberry Pi (raspbian/debain stretch) with two network interfaces (eth0 and eth1). The first interface (eth0) uses a public IP address, which is static. This interface is intended to provide access to the Pi (time- and web server, SSH) via the Internet. The second interface (eth1) uses the Raspberry Pi for general Internet connection (perform updates, sync own time or whatever) and uses a dynamic IP via DHCP. A general Internet connectivity over eth0 is not possible, so I have to use eth1 on the Pi.

My problem is that Internet (on the Pi) and the Internet access to the Pi are not working correctly.

first configuration (/etc/dhcpcd.conf):
Code:

interface eth0
static ip_address=141.41.241.68/28
static routers=141.41.241.65

after reboot 'ifconfig' shows the correct IP settings:
Code:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 141.41.241.68  netmask 255.255.255.240  broadcast 141.41.241.79
        ...

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        ...

result:
  • Internet on the Raspberry Pi (eth1): doesn't work
  • Access to Raspberry Pi over Internet (via eth0) --> SSH (TCP): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> Apache web server (TCP): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> NTP time server (UDP): works fine

------------------------------------------------------------------------------------------------------

Now I tried to change the metric of the interfaces, hoping that the change of prioritization is successful.

my second configuration (/etc/dhcpcd.conf):
Code:

interface eth1
metric 200

interface eth0
static ip_address=141.41.241.68/28
static routers=141.41.241.65
metric 201

result:
  • Internet on the Raspberry Pi (eth1): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> SSH (TCP): doesn't work
  • Access to Raspberry Pi over Internet (via eth0) --> Apache web server (TCP): doesn't work
  • Access to Raspberry Pi over Internet (via eth0) --> NTP time server (UDP): doesn't work

Ok. I think all traffic going out to eth1 at default. With the tool 'iptraf-ng' I was able to see the problem:

Code:

TCP Connections (Source Host:Port)  Iface
--------------------------------------------------
80.187.108.126:53024                eth0
141.41.241.68:80                    eth0
141.41.241.68:80                    eth1
80.187.108.126:53024                eth1
80.187.108.126:53025                eth0
141.41.241.68:80                    eth0
141.41.241.68:80                    eth1
80.187.108.126:53025                eth1

UDP Connections
--------------------------------------------------
UDP (76 bytes) from 80.187.108.126:28599 to 141.41.241.68:123 on eth0
UDP (76 bytes) from 192.168.0.101:123 to 80.187.108.126:28599 on eth1

We see:
On TCP: some connections going out to the wrong interface (eth1).
On UDP: The request from 80.187.108.126 came over eth0 and the response was sent over eth1.

------------------------------------------------------------------------------------------------------

Next, I defined the routing table to reply incoming packets on same network interface...

Code:

echo 100 public >> /etc/iproute2/rt_tables
ip rule add from 141.41.241.68/32 table public
ip route add default via 141.41.241.65 dev eth0 table public

result:
  • Internet on the Raspberry Pi (eth1): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> SSH (TCP): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> Apache web server (TCP): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> NTP time server (UDP): doesn't work

and 'iptraf-ng' shows:

Code:

TCP Connections (Source Host:Port)  Iface
--------------------------------------------------
141.41.241.68:80                    eth0
80.187.108.126:52083                eth0
141.41.241.68:80                    eth0
80.187.108.126:52084                eth0
141.41.241.68:80                    eth0
80.187.108.126:52085                eth0
141.41.241.68:80                    eth0
80.187.108.126:52086                eth0
141.41.241.68:80                    eth0
80.187.108.126:52087                eth0

UDP Connections
--------------------------------------------------
UDP (76 bytes) from 80.187.108.126:28599 to 141.41.241.68:123 on eth0
UDP (76 bytes) from 192.168.0.101:123 to 80.187.108.126:28599 on eth1

We see:
On TCP: now it works correctly
On UDP: same problem :(

What can I do to send UDP responses over the correct interface (eth0)? I have no idea why TCP works fine but UDP fails :( Its very frustrating and I have no more ideas. I hope someone can help.

...or is it possible to bind a process (or processes) to a IP address? Maybe it avoids this behavior.


best regards,
SBond


ps: sorry for my bad english

jlinkels 02-01-2018 07:27 AM

Why do you have two static routers. A static router is a default gateway. It tells the next hop packets need to be sent to if the IP is not on the same subnet.

That makes sense for the external interface. Everything which is not on 141.41.241.68/28 should be forwarded to 141.41.241.65

But there is no need to assign a router to 192.168.0.0/24. Everything which is on this subnet will be reachable thru eth1. Without routing.

Everything which is not on 192.168.0.0/24 will go out on 141.41.241.65 which is correct.

What I think I see is that traffic coming in on eth0 is sent out on eth1 instead of eth0 because there are two default gateways. I would remove the 192.168.0.1 gw completely and start again from the basic configuration.

I don't know why the difference between UDP and TCP. May because UDP is more stateless that TCP and doesn't know there is a established connection to use for a reply.

jlinkels

SBond87 02-01-2018 07:46 AM

oh sorry. It is an copy/paste error in my post. I removed it. I have one static router (141.41.241.65) in my configuration file. This is really weird. I try to solve this problem since 3 days :(

jlinkels 02-01-2018 08:11 AM

Weird. With the router mixup it seemed easy.

Can you try to initiate a UDP connection from the Pi and see where it is transmitted? So issue this command:
Code:

echo hello world | netcat -u 0.debian.pool.ntp.org 123
Before you give that command, in a different window monitor the traffic on eth0 or eth1:
Code:

sudo tcpdump -i eth0 host 0.debian.pool.ntp.org
once and then repeat:
Code:

sudo tcpdump -i eth1 host 0.debian.pool.ntp.org
On one of the interfaces tcpdump should give something like:
Code:

14:03:50.545460 IP aaa.bbb.ccc.ddd.59622 > Time100.Stupi.SE.ntp: NTPv5, unspecified, length 12
On the other interface just nothing.

When tcpdump is running you issue the netcat command. When testing this, you take out the variable that something is replied to.

jlinkels

SBond87 02-01-2018 08:25 AM

I'm not able to test this today, but I give you tomorrow the results. Thanks for you help. :)

SBond87 02-02-2018 05:07 AM

ok. here are the results:

command:
Code:

root@raspberrypi:~# echo hello world | netcat -u 0.debian.pool.ntp.org 123

eth0 monitor:
Code:

root@raspberrypi:~# sudo tcpdump -i eth0 host 0.debian.pool.ntp.org
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes


eth1 monitor:
Code:

root@raspberrypi:~# sudo tcpdump -i eth1 host 0.debian.pool.ntp.org
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes

09:39:58.711182 IP 192.168.0.101.32859 > frank.askja.de.ntp: NTPv5, unspecified, length 12

I think it looks right.


here are other connections:

iptraf-ng:
Code:

UDP Connections
-----------------------------------------------
# NTP clients
UDP (76 bytes) from 192.168.0.101:33595 to 192.53.103.108:123 on eth1      (NTPv4 request:  Raspberry Pi --> ptbtime1.ptb.de time server)
UDP (78 bytes) from 192.53.103.108:123 to 192.168.0.101:33595 on eth1      (NTPv4 response: ptbtime1.ptb.de time server --> Raspberry Pi)

UDP (76 bytes) from 192.168.0.101:33595 to 192.53.103.104:123 on eth1      (NTPv4 request:  Raspberry Pi --> ptbtime2.ptb.de time server)
UDP (78 bytes) from 192.53.103.104:123 to 192.168.0.101:33595 on eth1      (NTPv4 response: ptbtime2.ptb.de time server --> Raspberry Pi)

UDP (76 bytes) from 192.168.0.101:33595 to 192.53.103.103:123 on eth1      (NTPv4 request:  Raspberry Pi --> ptbtime3.ptb.de time server)
UDP (78 bytes) from 192.53.103.103:123 to 192.168.0.101:33595 on eth1      (NTPv4 response: ptbtime3.ptb.de time server --> Raspberry Pi)

# NTP server
UDP (76 bytes) from 77.23.214.176:123 to 141.41.241.68:123 on eth0        (NTPv4 request:  my PC --> Raspberry Pi (time server))
UDP (76 bytes) from 192.168.0.101:123 to 77.23.214.176:123 on eth1        (NTPv4 response: Raspberry Pi (time server) --> my PC) --> my PC never received this response


Well, my Raspberry Pi works as NTP client and NTP server (2 processes). The client connections are fine. My Raspberry Pi is sending requests to the NTP servers over the internet connection (eth1) and receive the response messages on the same interface. This is correct, because I have no regular internet connectivity on eth0. But the problem is my NTP server. If I unplug the cable from eth1, then the server works correctly and sends the response packets over eth0. But in this case my clients doesn't work anymore, because they have no more internet connection.

is it possible to bind a process to a network interface? I thought it is a small problem and easy to solve, but ...geeeez :(
I mean... it must be possible ...somehow :(


best regards,
SBond

-----
I hope my english is good enough for you

jlinkels 02-02-2018 06:43 AM

Things are not right.
Quote:

Originally Posted by SBond87 (Post 5814113)
09:39:58.711182 IP 192.168.0.101.32859 > frank.askja.de.ntp: NTPv5, unspecified, length 12

is not supposed to happen. The fake NTP request should go out on eth0, not on eth1.

Please make sure eth0 and eth1 have the IP addresses as you specified before:
Quote:

Originally Posted by SBond87 (Post 5814113)
Code:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 141.41.241.68  netmask 255.255.255.240  broadcast 141.41.241.79
        ...

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        ...


I am asking this because you say:
Quote:

Originally Posted by SBond87 (Post 5814113)
My Raspberry Pi is sending requests to the NTP servers over the internet connection (eth1) and receive the response messages on the same interface.

What does the output show of
Code:

/sbin/route -n
jlinkels

SBond87 02-02-2018 08:02 AM

thanks for support :)

here are my current settings:

- Raspberry Pi 3 with Raspbian (Image version: 2017-11-29)
-> headless operation
-> onbord ethernet (eth0):
---> public access (static IP)
---> for Apache web server, SSH, NTP server

-> Ethernet-USB-Dongle (eth1):
---> dynamic IP (DHCP)
---> general Internet connection (RasPi --> TP-Link router --> institute network)
---> for updates and NTP client (time synchronization is important for my Pi)

-> onboard wireless (wlan0):
---> dynamic IP (DHCP)
---> fallback connection, when I locked myself out (RasPi --> TP-Link router --> institute network)
---> same connection like eth1
---> ... only local access ^^



cat /etc/dhcpcd.conf
:

Code:

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
##########option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

#nohook lookup-hostname

interface eth1
metric 200

interface eth0
static ip_address=141.41.241.68/28
static routers=141.41.241.65
#static domain_name_servers=141.41.1.150 141.41.1.250 8.8.8.8
metric 201

#interface wlan0
#metric 300

the include of the line 'domain_name_servers' does not help. Therefore it is commented out.

ifconfig:

Code:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 141.41.241.68  netmask 255.255.255.240  broadcast 141.41.241.79
        inet6 fe80::d666:5a95:3373:d15c  prefixlen 64  scopeid 0x20<link>
        [...]

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::c409:11d6:2ad1:ce2f  prefixlen 64  scopeid 0x20<link>
        [...]

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        [...]

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.100  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::1513:e07:8927:a49c  prefixlen 64  scopeid 0x20<link>
        [...]


cat /etc/iproute2/rt_tables:


Code:

# reserved values
#
255    local
254    main
253    default
0      unspec
#
# local
#
#1      inr.ruhep

100 public

route -n:
Code:

Kernel-IP-Routentabelle
Ziel            Router          Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.0.1    0.0.0.0        UG    200    0        0 eth1
0.0.0.0        141.41.241.65  0.0.0.0        UG    201    0        0 eth0
0.0.0.0        192.168.0.1    0.0.0.0        UG    303    0        0 wlan0
141.41.241.64  0.0.0.0        255.255.255.240 U    201    0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    200    0        0 eth1
192.168.0.0    0.0.0.0        255.255.255.0  U    303    0        0 wlan0

192.168.0.1 (eth1) has a lower metric to realize the internet connectivity (because eth0 have no general internet).

ip rule show:
Code:

0:      from all lookup local
32765:  from 141.41.241.68 lookup public
32766:  from all lookup main
32767:  from all lookup default


ip route show
:
Code:

default via 192.168.0.1 dev eth1 src 192.168.0.101 metric 200
default via 141.41.241.65 dev eth0 src 141.41.241.68 metric 201
default via 192.168.0.1 dev wlan0 src 192.168.0.100 metric 303
141.41.241.64/28 dev eth0 proto kernel scope link src 141.41.241.68 metric 201
192.168.0.0/24 dev eth1 proto kernel scope link src 192.168.0.101 metric 200
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.100 metric 303


ip route list table public:
Code:

default via 141.41.241.65 dev eth0

jlinkels 02-02-2018 08:56 AM

OK, one of the problems is definitely in the routing.
Quote:

Ziel Router Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 200 0 0 eth1
0.0.0.0 141.41.241.65 0.0.0.0 UG 201 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 303 0 0 wlan0
The IP stack has 3 default gateways. Note that you ca have multiple NICs but there is only ONE IP stack in the entire OS.

I know you assigned metrics to the various interfaces (and that this has some effect, but I don't know if it is the intended effect)

What is the reason you have multiple connections to the public internet? You have a public IP address, that should void the need for going through your router for yet another internet connection.

I would start with this: disable the wlan, just have eth0 (public IP) and eth1 (internal LAN). Do away with metrics and all that stuff. Easiest is to implement all addresses as static. DHCP comes later.

Your routing table should look like this:
Code:

Ziel            Router          Genmask        Flags Metric Ref    Use Iface
0.0.0.0        141.41.241.65  0.0.0.0        UG    201    0        0 eth0
141.41.241.64  0.0.0.0        255.255.255.240 U    201    0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    200    0        0 eth1

Then your Pi should work as NTP client (on eth0) and NTP server (on eth1) as intended. It might not be your eventually wanted situation. But it is better to start from a simple working situation and add exceptions later.

You also say eth0 does not have general internet access. What do you mean by that? Is it connected to the public internet or not? Or is there a router in between restricting certain addresses? In that case it might be easier to route all internet traffic over eth1, and route only the access to the NTP server specifically. I think the 3 default gateways is the source of your problem.

jlinkels

SBond87 02-02-2018 11:30 AM

Quote:

Originally Posted by jlinkels (Post 5814787)
What is the reason you have multiple connections to the public internet? You have a public IP address, that should void the need for going through your router for yet another internet connection.

Quote:

Originally Posted by jlinkels (Post 5814787)
OK, one of the problems is definitely in the routing.
You also say eth0 does not have general internet access. What do you mean by that? Is it connected to the public internet or not? Or is there a router in between restricting certain addresses? In that case it might be easier to route all internet traffic over eth1, and route only the access to the NTP server specifically. I think the 3 default gateways is the source of your problem.

Well, I'm doing research at a technical college in the field of secure time transmission and I need a own (public) NTP server for some tests. For this I got a public IP address form my univerity. The access on this address is restricted and if have only some ports (UDP/TCP) for incoming and outgoing traffic. If I connect my Pi to this ethernet port (with eth0), then I have access from the internet to my Raspberry pi (e.g. SSH). But my Pi has no general "internet connection" in this case. I mean programs cannot connect with the internet and download updates or sync with timer servers or ping a server (e.g. ping www.google.com). And this is bad, because my Raspberry Pi need a continuous time synchronization with other time servers. To do this, I connects my Pi with a local router (TP-Link) that offers a regular internet connection.

I can often help myself, but I'm not a expert for linux or network configurations. But this problem is really annoying, because it looks totaly simple.

this is my table at th beginning:

Code:

Ziel            Router          Genmask        Flags Metric Ref    Use Iface
0.0.0.0        192.168.0.1    0.0.0.0        UG    200    0        0 eth1
0.0.0.0        141.41.241.65  0.0.0.0        UG    201    0        0 eth0
0.0.0.0        192.168.0.1    0.0.0.0        UG    303    0        0 wlan0
141.41.241.64  0.0.0.0        255.255.255.240 U    201    0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    200    0        0 eth1
192.168.0.0    0.0.0.0        255.255.255.0  U    303    0        0 wlan0

and we want this:

Code:

Ziel            Router          Genmask        Flags Metric Ref    Use Iface
0.0.0.0        141.41.241.65  0.0.0.0        UG    201    0        0 eth0
141.41.241.64  0.0.0.0        255.255.255.240 U    201    0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    200    0        0 eth1


...um...ok, at first I changed my settings:

/etc/dhcpcd.conf: new config:

Code:

interface eth0
static ip_address=141.41.241.68/28
static routers=141.41.241.65

interface eth1
static ip_address=192.168.0.101/24
static routers=192.168.0.1

After that I rebooted my Pi and turned off the wireless connection:

ip link set wlan0 down

result:
route -n

Code:

0.0.0.0        141.41.241.65  0.0.0.0        UG    202    0        0 eth0
0.0.0.0        192.168.0.1    0.0.0.0        UG    204    0        0 eth1
141.41.241.64  0.0.0.0        255.255.255.240 U    202    0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    204    0        0 eth1

Do you know how I can delete the second entry?

test rusults:
  • Internet on the Raspberry Pi (eth1): doesn't work
  • Access to Raspberry Pi over Internet (via eth0) --> SSH (TCP): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> Apache web server (TCP): works fine
  • Access to Raspberry Pi over Internet (via eth0) --> NTP time server (UDP): works fine

jlinkels 02-02-2018 11:58 AM

Yes, remove the line
Code:

static routers = 192.168.01
from the network interfaces and restart networking.

Don't worry about internet access. Just check if you can have the Pi as NTP server on the LAN network. I assume it is still working correctly as NTP client because Pi know how to get to the public IP of your NTP server.

If that works, the next thing we will do is to remove the defaut gw from 141.n.n.n and make a dedicated route to get to your NTP server over the public internet.

jlinkels

SBond87 02-02-2018 12:18 PM

ok :)

changed /etc/dhcpcd.conf:

Code:

interface eth0
static ip_address=141.41.241.68/28
static routers=141.41.241.65

interface eth1
static ip_address=192.168.0.101/24

then rebooted my Pi and turned off the wireless connection (ip link set wlan0 down)

result:

route -n

Code:

0.0.0.0        141.41.241.65  0.0.0.0        UG    202    0        0 eth0
141.41.241.64  0.0.0.0        255.255.255.240 U    202    0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    204    0        0 eth1

SSH and NTP server are working (eth0). NTP client (own time sync for Pi) shutting down after some seconds, because no internet access. ...and therefore not able to find other public time servers

should I remove 'static routers=141.41.241.65' now? I'm not sure if I can access my Pi after this. Until next Monday I have no access to the hardware (if I lock myself out).

jlinkels 02-02-2018 01:29 PM

Don't lock yourself out.

I don't understand why you cannot reach your time server on internet. This interface 141.41.241.68/28 is created to access the NTP server over internet, isn't it?

As I understand you have this public IP address which is heavily restricted but just to reach your NTP server. If the default gw is pointing to 141.41.241.65 why can't you reach your time server? I know the connection is not good for anything else, but the Pi (the NTP client here) does not know better as to direct all traffic including NTP requests to 141.41.241.65.

You also say you don't have internet access, but you reach you Pi from the outside using this IP? You you have somehow access to 141.41.241.68?

Oh wait, while I am writing this I see something else which doesn't look right. I overlooked it first. I thought you were setting the static addressed in /etc/networking/interfaces. But you say you do that in /etc/dhcpd.conf.

Don't for the time being. Put this in your /etc/network/interfaces on the Pi. And check if I use the correct IP addresses which were assigned to you.
Code:

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

#This interface should get you to the internet,
#or hopefully provide access from the outside
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 141.41.241.68
        netmask 255.255.255.240
        network 141.41.241.64
        gateway 141.41.241.65
        broadcast 141.41.241.79
        nameserver 8.8.8.8

#This interface only allows local access from 192.168.0.xxx
#Check if 192.168.0.101 is available for you
auto eth1
allow-hotplug eth1
iface eth1 inet static
        address 192.168.0.101
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255

And see what happens now.

jlinkels

SBond87 02-02-2018 02:27 PM

changed config (disabled entries):

nano /etc/dhcpcd.conf

Code:

#interface eth0
#static ip_address=141.41.241.68/28
#static routers=141.41.241.65

#interface eth1
#static ip_address=192.168.0.101/24
#static routers=192.168.0.1

#interface wlan0
#metric 300

Now I changed the other config file:
nano /etc/network/interfaces


Code:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

#This interface should get you to the internet,
#or hopefully provide access from the outside
auto eth0
allow-hotplug eth0
iface eth0 inet static
        address 141.41.241.68
        netmask 255.255.255.240
        network 141.41.241.64
        gateway 141.41.241.65
        broadcast 141.41.241.79
        # nameserver 8.8.8.8
        nameserver 141.41.1.150 141.41.1.250 8.8.8.8  --> added research DNS server (but no success)


#This interface only allows local access from 192.168.0.xxx
#Check if 192.168.0.101 is available for you
auto eth1
allow-hotplug eth1
iface eth1 inet static
        address 192.168.0.101
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255


sudo reboot

ifconfig


Code:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 141.41.241.68  netmask 255.255.255.240  broadcast 141.41.241.79
        inet6 fe80::ba27:ebff:feab:aec7  prefixlen 64  scopeid 0x20<link>
        [...]

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::224:9bff:fe1b:4947  prefixlen 64  scopeid 0x20<link>
        [...]

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        [...]


route -n

Code:

Ziel            Router          Genmask        Flags Metric Ref    Use Iface
0.0.0.0        141.41.241.65  0.0.0.0        UG    0      0        0 eth0
141.41.241.64  0.0.0.0        255.255.255.240 U    0      0        0 eth0
192.168.0.0    0.0.0.0        255.255.255.0  U    0      0        0 eth1


Ok, NTP server and SSH still working, but no internet.
Maybe you are a little confused about the NTP configuration. Well, my Raspberry Pi works with 2 processes as client and server simultaneously. The first process is the NTP client. This mode allow the time sync of my Pi itself. The NTP client contacts other NTP server (3 in my case) over a normal internet connection. But it doesn't work over the eth0 connection. The NTP client need eth1 to reach the needed time servers. The second process is my own NTP server. It opens a socket with the Port 123. This Port is open and the server can receive requests and send response packets on eth0. This works currently.

I can reach my Pi over 'nts1-e.ostfalia.de' over custom ports for SSH and port 123 for NTPv4. Ping does not work (blocked by IT infrastructure)

ok. what are the next steps? ...and thanks for you support and your time :)

jlinkels 02-02-2018 02:49 PM

Yes, I am confused.

Do I then understand it correctly that you access your Pi from home using nts1-e.ostfalia.de but you are not on one of the addresses between 141.41.241.65 through 141.41.241.78? You have a normal public address at home and you access the Pi from there?

It is clear that your Pi is both server and client. That is normal.

So far, with the last changes you made what I see is totally what I expect. That is the good news.

The only thing now left is how you can access eth0 from the internet, while you still have outgoing internet connections on eth1 to retrieve the time from your 3 time servers. If you can clarify the questions in the first paragraph I'll think about it. It might be over the weekend before I am back.

jlinkels


All times are GMT -5. The time now is 09:40 AM.