linux服务器添加路由条目的目的是在打通不通网段网卡之前的数据流,也可以通过防火墙去转发nat,此处是构建路由条目的方法:
有两块网卡eth0和eth1
1.在eth0上添加路由条目
route add –net 192.168.100.0/24 dev eth0
2.在eth1上添加路由条目
route add –net 192.168.1.0/24 dev eth1
3.设置路由转发功能 echo 1 > /peoc/sys/net/ipv4/ip_forward
验证是否成功,通过route命令查看即可