1

I have ubuntu 20.04 server with 2 interfaces / eth0:94.101.177.244 eth1:94.101.176.149

Eth0 is work well and When i ping from server to out with eth1, it success.

But when i ping from pc eth1, it fails.

~$ ip route show
default via 94.101.176.1 dev eth0 proto dhcp src 94.101.177.244 metric 100
default via 94.101.176.1 dev eth1 proto dhcp src 94.101.176.149 metric 100
94.101.176.0/22 dev eth0 proto kernel scope link src 94.101.177.244
94.101.176.0/22 dev eth1 proto kernel scope link src 94.101.176.149
169.254.169.254 via 94.101.176.10 dev eth0 proto dhcp src 94.101.177.244 metric 100
169.254.169.254 via 94.101.176.10 dev eth1 proto dhcp src 94.101.176.149 metric 100


~$ cat /etc/iproute2/rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
#1      inr.ruhep


~$ ip rule show
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default

#from pc
ping 94.101.177.149

Pinging 94.101.177.149 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 94.101.177.149:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
#from server
~$ ping google.com -I eth1
PING google.com (216.239.38.120) from 94.101.176.149 eth1: 56(84) bytes of data.
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=1 ttl=107 time=27.8 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=2 ttl=107 time=26.0 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=3 ttl=107 time=25.5 ms
64 bytes from any-in-2678.1e100.net (216.239.38.120): icmp_seq=4 ttl=107 time=25.6 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 25.480/26.217/27.783/0.924 ms

I know problem here are creating route table for each interface, but i don't know how do it...

Mahdi
  • 61
  • 4
  • connecting two network interfaces in a machine to an identical subnet is [usually not a good idea](https://access.redhat.com/solutions/30564), i.e. there's no assurance which interface will send and which interface will receive the traffic. what's your use case here? – mforsetti Oct 03 '22 at 04:26
  • What netmasks are on your interfaces and what is the purpose of eth1? – Nils Oct 05 '22 at 10:45
  • @mforsetti i know, but my use case is for tunneling server to another OpenVpn server and alongside use as OpenVpn Server. idk this is correct way or not, but i'm not so familier with interfaces.. – Mahdi Oct 06 '22 at 07:39

1 Answers1

0

Your issue here is that you have 2 default gateway, so you have to create 2 routing table.

Please see following link:

https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System

Advise if I've put you on the right rails.

Regards Stagira

  • i know problem is tables, but i don't know how to configure, if you can sent exact commonds i will be glad... – Mahdi Oct 06 '22 at 07:41