修改为如下配置
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.40.165
netmask 255.255.255.0
auto eth1
iface eth1 inet static
address 10.251.5.130
netmask 255.255.255.0
gateway 10.251.5.254
保存之后重启网络 service networking restart
添加路由 route add -net 192.200.41.0/24 gw 192.168.40.254 dev eth0
192.200.41.0/24 为需要访问内网的网段,添加网关为内网网卡的网关。
现在可以在内网访问此主。
参考:https://blog.csdn.net/Blog_inG/article/details/89351758