650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/03/D3/wKiom1mhJSbyCvFfAACbjAuboPU453.jpg-wh_500x0-wm_ 3-wmp_4-s_1497226562.jpg "title=" Linux route forwarding simple diagram. jpg "alt=" wkiom1mhjsbycvffaacbjaubopu453.jpg-wh_50 "/>
Requirements:
Need to let Linux01 access Linux03 through Linux02, convert Linux02 to a router.
Implementation steps:
(1) Preparation environment: LINUX01 (ip:10.0.0.10) Linux02 (dual Nic eth0:10.0.0.11 eth1:10.0.1.11) Linux03 (ip:10.0.1.10)
(2) Configure LINUX01, add route: Route add-net 10.0.1.0/24 gw10.0.0.11
(3) Configure Linux02, turn on the route forwarding function: echo "1" >/proc/sys/net/ipv4/ip_forward
(4) Configure Linux03, add route: Route add-net 10.0.0.0/24 gw10.0.1.11
(5) Turn off all firewalls
LINUX01:
[[email protected] ~]# traceroute -n 10.0.1.10traceroute to 10.0.1.10 (10.0.1.10), 30 hops max, 60 byte packets 1 10.0.0.11 0.188 ms 0.141 ms 0.113 ms 2 10.0.1.10 0.676 ms 1.081 ms 1.048 ms[[email protected] ~]# route -nKernel IP routing tableDestination Gateway genmask flags Metric Ref Use Iface10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth010.0.1.0 10.0.0.11 255.255.255.0 UG 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
LINUX03:
[[email protected] ~]# traceroute -n 10.0.0.10traceroute to 10.0.0.10 (10.0.0.10), 30 hops max, 60 byte packets 1 10.0.1.11 3.137 ms 3.056 ms 3.000 ms 2 10.0.0.10 4.003 ms 3.981 ms 3.948 m[[email protected] ~]# route -nKernel IP routing tableDestination Gateway genmask flags Metric Ref Use Iface10.0.0.0 10.0.1.11 255.255.255.0 UG 0 0 0 eth010.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
This article is from the "wind and Rain Forest" blog, please make sure to keep this source http://fengyushanlin.blog.51cto.com/12092006/1959544
Introduction to Linux Routing and forwarding