0

I have 2 NICs and the 2nd one (with ip, 10.1.1.2) is connected to private n/w. A machine (windows with ip, 10.1.1.3) on private n/w was able to ping this machine which is a Linux one. But from this machine, I am unable to ping back. arping command works. traceroute 10.1.1.3 goes to gateway of NIC1.

For solving this problem after several experiments, this is the best I could do and want help in proceeding further:

  1. Switched management to NetworkManager by setting "managed=true" in /etc/NetworkManager/NetworkManager.conf

  2. added DEFROUTE=no
    under the section of [ipv4] in the file,
    /etc/NetworkManager/system-connections/Wired connection 2.nmconnection

  3. Added "2 internal2" in the file /etc/iproute2/rt_tables

  4. ip route add default dev eth1 table internal2

  5. ip rule add from all to 10.1.1.3 lookup internal2 prio 1000

  6. ip route show table main (see below)

  7. route -n (see below)

Output of ip route show ...:

default via 192.168.1.1 dev eth0 proto static metric 100 
10.1.1.0/24 dev eth1 proto kernel scope link src 10.1.1.2 metric 101 
192.168.116.0/22 dev eth0 proto kernel scope link src 164.99.116.152 metric 100

Output of route -n:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
10.1.1.0        0.0.0.0         255.255.255.0   U     101    0        0 eth1
192.168.116.0   0.0.0.0         255.255.252.0   U     100    0        0 eth0

After some time, at times, I see only 2 entries, meaning the added entry is cleared:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
192.168.116.0   0.0.0.0         255.255.252.0   U     100    0        0 eth0

After all the above, traceroute and ping hang. After some time when routing table looses one entry, again things are back to normal. I see traceroute going to default gateway.

My aim is to make sure ping 10.1.1.3 gives result. In the private network, there is no gateway.

I have even tried with the following rule but the network heals back to normal state after some time :)

ip rule add from all to all lookup internal2 prio 1000

edit 1: adding contents of cat /etc/NetworkManager/system-connections/Wired\ connection\ 2.nmconnection:

[connection]
id=Wired connection 2
uuid=de14c2b9-4828-3599-8440-c32d778395ed
type=ethernet
autoconnect-priority=-999
permissions=
timestamp=1597651876

[ethernet]
mac-address=00:0C:29:BB:48:72
mac-address-blacklist=

[ipv4]
address1=10.1.1.2/24
dns-search=
method=auto
DEFROUTE=no

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
ip6-privacy=0
method=auto

edit2: after self healing,

ip addr

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0c:29:bb:48:68 brd ff:ff:ff:ff:ff:ff
    inet 192.168.116.152/22 brd 192.168.1.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fda7:e6ee:2e09:0:e444:fc21:ec4b:5dca/64 scope global tentative dynamic noprefixroute 
       valid_lft 2591999sec preferred_lft 604799sec
    inet6 fdfe:9042:c53d:0:181e:7fbb:e3ce:9b9/64 scope global tentative dynamic noprefixroute 
       valid_lft 2592000sec preferred_lft 604800sec
    inet6 fe80::e1dc:c1:89f1:9bd8/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0c:29:bb:48:72 brd ff:ff:ff:ff:ff:ff

edit 3: As final step, I have recreated the ip addresses using GUI interface given by the distribution (MX Linux) and it for some time. Before the self heal has happened, here is the routing table:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
0.0.0.0         10.1.1.2        0.0.0.0         UG    101    0        0 eth1
10.1.1.0        0.0.0.0         255.255.255.0   U     101    0        0 eth1
192.168.116.0   0.0.0.0         255.255.252.0   U     100    0        0 eth0

I have given gateway as the self node address. Everything worked and I was able to ping as I had wanted.

In few minutes, self heal has happened and after it here is the routing table again:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    100    0        0 eth0
192.168.116.0   0.0.0.0         255.255.252.0   U     100    0        0 eth0

ip route
default via 192.168.1.1 dev eth0 proto static metric 100 
default via 10.1.1.2 dev eth1 proto static metric 101 
10.1.1.0/24 dev eth1 proto kernel scope link src 10.1.1.2 metric 101 
192.168.116.0/22 dev eth0 proto kernel scope link src 192.168.116.152 metric 100 

edit 4:

Working after disabling apparent healing as suggested in comments with the following command:

service network-manager stop
8
  • 1
    If the network is "healing", this is probably NetworkManager trying to do things for you. I suggest stopping it outright and using lower level commands to start both network devices. The only explicit route you should need to set is the default route. This should let you ping the private network, and do all the stuff on the public network and internet. Once this works, the question becomes how to configure NetworkManager to maintain this state (and there, I can't help you).
    – David G.
    Aug 17 '20 at 16:35
  • 1
    Your network topology is so simple that there is no need for more than one routing table. Since there is no gateway on the private network, you only need a simple route like the one in item 7 on your list: 10.1.1.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1. There is definitely no need for more than one default route. Aug 17 '20 at 16:38
  • What is the contents of /etc/NetworkManager/system-connections/Wired connection 2.nmconnection? Please edit your question to show this. Aug 17 '20 at 17:08
  • If I find no solution, then will add a gateway in private network. Aug 18 '20 at 3:45
  • A gateway will only work if the gateway itself is reachable using the current routing. With the second routing table you posted, you cannot add a gateway to NIC 2. You'll have to find out why the entry gets deleted. Aug 18 '20 at 4:30
0

If the network is "healing", this is probably NetworkManager trying to do things for you. I suggest stopping it outright and using lower level commands to start both network devices.

The only explicit route you should need to set is the default route.

This should let you ping the private network, and do all the stuff on the public network and internet. Once this works, the question becomes how to configure NetworkManager to maintain this state (and there, I can't help you).

0
0

After few times restarts, finding even with NetworkManager running, the configuration is working. I think adding ip of eth1 as gateway may be the actual answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.