Настройка маршрутизации трафика для Linux

Не могу решить проблему с маршрутизацией трафика на Linux на этой системе:

root@fl-imx6ull:~# uname -a
Linux fl-imx6ull 4.1.15 #1 SMP PREEMPT Tue Apr 8 08:26:30 MSK 2025 armv7l armv7l armv7l GNU/Linux
root@fl-imx6ull:~#

У меня есть два подключения. Одно реализовано через ppp (подключен модем SIMCOM A7682E с SIM картой), другое через Ethernet.

root@fl-imx6ull:~# ip route
default dev eth0  scope link
default via 192.168.3.1 dev eth0
default dev ppp0  scope link
10.64.64.64 dev ppp0  proto kernel  scope link  src 10.184.51.81
169.254.0.0/16 dev eth0  proto kernel  scope link  src 169.254.220.182
192.168.3.0/24 dev eth0  proto kernel  scope link  src 192.168.3.200
root@fl-imx6ull:~#

Ethernet предназначен для работы в локальной сети с другими устройствами (все в подсети 192.168.3.0/24) ppp в свою очередь предназначен для доступа к внешней сети Интернет (т.е. имеет приоритет для всех запросов, кроме 192.168.3.0/24) Сейчас у меня это работает следующим образом. При запуске системы, после инициализации ppp и до подключения кабеля ethernet, трафик идет куда нужно, и я могу отправить пинг на google.com. Но через несколько секунд после подключения кабеля ethernet, он начинает пытаться направить весь трафик через себя:

root@fl-imx6ull:~# ping google.com
PING google.com (173.194.221.100) 56(84) bytes of data.
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=1 ttl=104 time=94.4 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=2 ttl=104 time=86.5 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=3 ttl=104 time=84.8 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=4 ttl=104 time=83.7 ms
fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=21 ttl=104 time=78.6 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=22 ttl=104 time=84.8 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=23 ttl=104 time=75.7 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=24 ttl=104 time=83.6 ms
64 bytes from lm-in-f100.1e100.net (173.194.221.100): icmp_seq=25 ttl=104 time=73.4 ms
From fl-imx6ull.local (192.168.3.200) icmp_seq=61 Destination Host Unreachable
From fl-imx6ull.local (192.168.3.200) icmp_seq=62 Destination Host Unreachable

Настройка PPP выполняется с помощью скрипта:

# named simcom-pppd and place in /etc/ppp/peers
/dev/ttymxc2 115200
#Insert the username and password for authentication, default user and password are test
user "megafon" password "megafon"
# The chat script, customize your APN in this file
connect 'chat -s -v -f /etc/ppp/peers/simcom-connect-chat'
# The close script
disconnect 'chat -s -v -f /etc/ppp/peers/simcom-disconnect-chat'
# Hide password in debug messages
hide-password
# The phone is not required to authenticate
noauth
# Debug info from pppd
#debug
# If you want to use the HSDPA link as your gateway
defaultroute
# pppd must not propose any IP address to the peer
noipdefault
# No ppp compression
novj
novjccomp
noccp
ipcp-accept-local
ipcp-accept-remote
local
# For sanity, keep a lock on the serial line
lock
modem
dump
nodetach
# Hardware flow control
nocrtscts
remotename 3gppp
ipparam 3gppp
ipcp-max-failure 30
# Ask the peer for up to 2 DNS server addresses
usepeerdns

и запускается соответствующим вызовом: pppd call simcom-pppd &

Настройка eth0 в /etc/network/interfaces выглядит так:

# Wired or wireless interfaces
allow-hotplug eth0
auto eth0
iface eth0 inet static
    address 192.168.3.200
        netmask 255.255.255.0
    up route add default gw 192.168.3.1 ppp0
    down route del default gw 192.168.3.1 ppp0
        gateway 192.168.3.1

и запускается соответствующим вызовом: ifup eth0

Я заметил, что как только эта строка появляется в "ip route", пинги перестают отправляться: default dev eth0 scope link


Ответы (0 шт):