我们有一台运行 openVPN 客户端的机器,其唯一目的是能够在连接到远程网络时通过 SSH 连接到客户端。VPN 基本正常工作,但它正在路由全部通过 VPN 传输流量。为了避免在将大文件上传到 S3 等时路由器过载,我们希望通过 VPN 传输流量仅有的如果它是 VPN 网络上的地址。
route
和的当前输出ifconfig
:
user@host0:~$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.10.1 0.0.0.0 UG 50 0 0 tap0
default 192.168.1.1 0.0.0.0 UG 100 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth1
192.168.1.0 * 255.255.255.0 U 100 0 0 eth0
192.168.2.0 * 255.255.255.0 U 0 0 0 eth1
192.168.10.0 * 255.255.255.0 U 50 0 0 tap0
user@host0:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:04:4b:a7:fa:e5
inet addr:192.168.1.223 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::7a45:f5b1:1b87:c6f0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:166634 errors:0 dropped:0 overruns:0 frame:0
TX packets:11065 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37358476 (37.3 MB) TX bytes:985891 (985.8 KB)
Interrupt:42
eth1 Link encap:Ethernet HWaddr 00:0c:8b:90:06:7c
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:8bff:fe90:67c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:4000 Metric:1
RX packets:34645 errors:0 dropped:0 overruns:0 frame:0
TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10462790 (10.4 MB) TX bytes:13440 (13.4 KB)
Interrupt:132 Memory:50100000-50120000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:4953 errors:0 dropped:0 overruns:0 frame:0
TX packets:4953 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:463022 (463.0 KB) TX bytes:463022 (463.0 KB)
tap0 Link encap:Ethernet HWaddr c6:81:e7:8b:58:00
inet addr:192.168.10.2 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::c481:e7ff:fe8b:5800/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10199 errors:0 dropped:0 overruns:0 frame:0
TX packets:409 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1983982 (1.9 MB) TX bytes:55419 (55.4 KB)
除非流量发往 VPN 子网上的另一个地址,否则跳过接口的适当规则ip route
是什么?iptables
tap0