从特定接口 ping google.com

从特定接口 ping google.com

我通过 wlan0(wifi) 连接到互联网,并且还有一个以太网端口(未连接到互联网)。我正在寻找一些 iptables 规则/路由添加,这将使我能够通过 eth1 成功执行 ping(ping -I eth1 www.google.com)。

这是我的界面详细信息:

saurabh@pc-saurabh:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:24:e8:e9:4b:bf brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/24 brd 10.0.0.255 scope global eth1
    inet6 fe80::224:e8ff:fee9:4bbf/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:24:d6:42:3d:5c brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.6/24 brd 192.168.11.255 scope global wlan0
    inet6 fe80::224:d6ff:fe42:3d5c/64 scope link 
       valid_lft forever preferred_lft forever

这是我的路线:

saurabh@pc-saurabh:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.168.11.0    0.0.0.0         255.255.255.0   U     2      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
0.0.0.0         192.168.11.1    0.0.0.0         UG    0      0        0 wlan0

相关内容