我有一台 Fedora 34 Linux,它有一个物理以太网接口(网卡3)、物理 WiFi 接口(NIC2)以及 USB/以太网接口(NIC1) (USB LTE Dongle)。我想使用 NIC3 将所有流量路由到 NIC1。我想保留 NIC2 作为到达 Linux 机器的管理接口。就这样。 该计划的区块图 - 点击此处查看图片
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.8.1 0.0.0.0 UG 100 0 0 enp0s29f7u5
0.0.0.0 192.168.99.254 0.0.0.0 UG 600 0 0 wlp16s0
0.0.0.0 192.168.55.10 0.0.0.0 UG 20101 0 0 ens1
192.168.8.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s29f7u5
192.168.55.0 0.0.0.0 255.255.255.0 U 101 0 0 ens1
192.168.99.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp16s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
[root@thanos ~]# ip route show
default via 192.168.8.1 dev enp0s29f7u5 proto dhcp metric 100
default via 192.168.99.254 dev wlp16s0 proto dhcp metric 600
default via 192.168.55.10 dev ens1 proto static metric 20101
192.168.8.0/24 dev enp0s29f7u5 proto kernel scope link src 192.168.8.127 metric 100
192.168.55.0/24 dev ens1 proto kernel scope link src 192.168.55.10 metric 101
192.168.99.0/24 dev wlp16s0 proto kernel scope link src 192.168.99.142 metric 600
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
enp0s29f7u5: connected to Wired connection 2
"Huawei E353/E3131"
ethernet (cdc_ether), 00:1E:10:1F:00:00, hw, mtu 1500
ip4 default, ip6 default
inet4 192.168.8.127/24
route4 0.0.0.0/0
route4 192.168.8.0/24
inet6 2a00:1110:209:1c4:763d:4da5:c8cf:5778/64
inet6 2a00:1110:222:5201:5ff0:45bc:f54b:d523/64
inet6 2a00:1110:209:1c4:10:2030:4050:2/128
inet6 fe80::1c5e:de37:2e84:8fee/64
route6 2a00:1110:222:5201::/64
route6 2a00:1110:209:1c4::/64
route6 ::/0
route6 2a00:1110:209:1c4:10:2030:4050:2/128
route6 fe80::/64
wlp16s0: connected to SB25
"Intel PRO/Wireless 3945ABG"
wifi (iwl3945), 00:1F:3C:87:2D:DE, hw, mtu 1500
inet4 192.168.99.142/24
route4 0.0.0.0/0
route4 192.168.99.0/24
inet6 fe80::ce52:130a:ec8a:39db/64
route6 fe80::/64
route6 ::/0
virbr0: connected (externally) to virbr0
"virbr0"
bridge, 52:54:00:60:80:14, sw, mtu 1500
inet4 192.168.122.1/24
route4 192.168.122.0/24
ens1: connected to System ens1
"Broadcom and subsidiaries NetLink BCM5787M"
ethernet (tg3), 00:1F:29:9D:A2:64, hw, mtu 1500
inet4 192.168.55.10/24
route4 192.168.55.0/24
route4 0.0.0.0/0
EDIT1:(附加信息)转发已启用 Iptables 已禁用
[root@thanos ~]# cat /proc/sys/net/ipv4/ip_forward
1
[root@thanos ~]# systemctl status iptables.service
○ iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2021-09-06 13:46:59 CEST; 57min ago
Process: 2043 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
Process: 2119 ExecStop=/usr/libexec/iptables/iptables.init stop (code=exited, status=0/SUCCESS)
Main PID: 2043 (code=exited, status=0/SUCCESS)
CPU: 67ms
Sep 06 13:45:54 thanos systemd[1]: Starting IPv4 firewall with iptables...
Sep 06 13:45:54 thanos iptables.init[2043]: iptables: Applying firewall rules: [ OK ]
Sep 06 13:45:54 thanos systemd[1]: Finished IPv4 firewall with iptables.
Sep 06 13:46:59 thanos systemd[1]: Stopping IPv4 firewall with iptables...
Sep 06 13:46:59 thanos iptables.init[2119]: iptables: Setting chains to policy ACCEPT: filter [ OK ]
Sep 06 13:46:59 thanos iptables.init[2119]: iptables: Flushing firewall rules: [ OK ]
Sep 06 13:46:59 thanos systemd[1]: iptables.service: Deactivated successfully.
Sep 06 13:46:59 thanos systemd[1]: Stopped IPv4 firewall with iptables.