Linux路由轉寄簡介

來源:互聯網
上載者:User

標籤:路由轉寄

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路由轉寄簡易圖.jpg" alt="wKiom1mhJSbyCvFfAACbjAuboPU453.jpg-wh_50" />

要求:

需要讓Linux01通過Linux02訪問Linux03,把Linux02轉換成一個路由器。

實施步驟:

(1)  準備環境:Linux01(ip:10.0.0.10)Linux02(雙網卡eth0:10.0.0.11  eth1:10.0.1.11)Linux03(ip:10.0.1.10)

(2)  配置Linux01,添加路由:route add -net 10.0.1.0/24 gw10.0.0.11

(3)  配置Linux02,開啟路由轉寄功能:echo "1" >/proc/sys/net/ipv4/ip_forward

(4)  配置Linux03,添加路由:route add -net 10.0.0.0/24 gw10.0.1.11

(5)  關閉所有防火牆


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


本文出自 “風雨山林” 部落格,請務必保留此出處http://fengyushanlin.blog.51cto.com/12092006/1959544

Linux路由轉寄簡介

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.