 |
教程: Linux教程-网络管理-如何用Linux安装TCP/IP路由器 |
 |
|
|
| 教程: Linux教程-网络管理-如何用Linux安装TCP/IP路由器 |
|
|
|
|
net 140.115.0.0 netmask 255.255.0.0 eth0
route add -net 140.115.50.160 netmask 255.255.255.224 eth1
route add default gw 140.115.1.254 metric 1
^^^^^^^^^^^^^^^^^^^^^^^^^
此为通往校外的 Gateway
後,再执行 rc.inet1 或重新开机,可以利用 route 指令来检查设定是否正确,以下就是
Router 值行 route 的输出:
Destination Gateway Genmask Flags MSS Window Use Iface
140.115.50.160 * 255.255.255.224 U 1436 0 234 eth1
140.115.0.0 * 255.255.0.0 U 1436 0 29125 eth0
127.0.0.0 * 255.0.0.0 U 1936 0 34 lo
default 140.115.1.254 * UG 1436 0 79 eth0
----------------------------------------------------------------------------
如何设定 Subnet 中机器的网路位址与 Kernel Routing table
Subnet 中的机器其设定方法较 Router 简单.其只有一张网路卡,即 eth0,所以在
机器 ds170 的 /etc/rc.d/rc.inet1 中加入
ifconfig eth0 140.115.50.170 netmask 255.255.255.224 broadcast 140.115.50.191
route add -net 140.115.50.160 netmask 255.255.255.224 eth0
route add default gw 140.115.50.161 metric 1
^^^^^^^^^^^^^^^^^^^^^^^^^^
此我们将 Gateway 设为 Router 的 eth1 IP address
----------------------------------------------------------------------------
设定 Proxy ARP 来连通 Subnet
以上设定完成後,你就可以由 Router 连上 ds170,亦可以由 ds170 联上 Router, 但是
若要由 ds170 直接连到外面 Class B net 上之机器,如 dslab,则无法直接连通, 因为
ds170 直接将 package(注意是资料不是ARP) 送到 router(可由 static routing
table 中决定),router 再帮你在 class B network 中送 ARP,所以 dslab 会听到此
ARP ,但当 dslab 要将 ARP 送回来时,由於 router 或 gateway 会将 broadcast 和
multicast 的 package 挡下来,而不会forwarding,所以说 dslab 回应的 ARP 无法让
ds170 所收到 ,於是我们需在 Router上设定 Proxy ARP,其功能就是代 subnet 中的机
器回应 class B 中机器所 broadcast 的 ARP,让 class B 中要送往 subnet 的
package 先送到 router, 之後 router 再帮其送往 subnet 中的机器.
所以应该在 Router 的 /etc/rc.d/rc.inet1 中加入
arp -s 140.115.50.170 04:00:23:53:90:21 pub
^^^^^^^^^^^^^^^^^
此为 Router eth0 介面的 hardware address
上一页 [1] [2]
|
|
| 教程录入:admin 责任编辑:admin |
|
|
上一篇教程: 教程: Linux教程-网络管理-Cisco方案实现端到端QoS
下一篇教程: 教程: Linux教程-网络管理-100分钟,我教你配CISCO RIP |
|
|
|
|
|
|
|
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|
|
|
|