环境
eth0需要连接外网,eth1连接内网。实际测试时,发现通过eth0无法ping通外网。
配置文件信息,cat /etc/network/interfaces
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 172.32.11.60
netmask 255.255.255.0
network 172.32.11.1
gateway 172.32.11.1
auto eth1
iface eth1 inet static
address 192.168.254.241
netmask 255.255.255.240
network 192.168.254.241
gateway 192.168.254.241
调试
查看路由表,发现有两个默认网关,eth1的mx6qsabresd.lo(192.168.254.241)和eth0的172.32.11.1
root@imx6qsabresd:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default imx6qsabresd.lo 0.0.0.0 UG 0 0 0 eth1
default 172.32.11.1 0.0.0.0 UG 0